Skip to main content

AWS CloudFront distribution for frontend web app (spa) optimized.

Project description

AWS Secure Frontend Web App CloudFront Distribution (for AWS CDK v2)

GitHub npm (scoped) PyPI Nuget GitHub Workflow Status (branch) GitHub release (latest SemVer)

View on Construct Hub

AWS CloudFront distribution for frontend web app (spa) optimized.

Install

TypeScript

npm install @gammarers/aws-secure-frontend-web-app-cloudfront-distribution
# or
yarn add @gammarers/aws-secure-frontend-web-app-cloudfront-distribution

Python

pip install gammarers.aws-secure-frontend-web-app-cloudfront-distribution

C# / .NET

dotnet add package Gammarers.CDK.AWS.SecureFrontendWebAppCloudFrontDistribution

Example

for Origin Access Control

import { SecureFrontendWebAppCloudFrontDistribution, S3OriginAccessType } from '@gammarers/aws-secure-frontend-web-app-cloudfront-distribution';

declare const originBucket: s3.Bucket;
declare const accessLogBucket: s3.Bucket;
declare const certificate: acm.Certificate;
declare const cfnOriginAccessControl: cloudfront.CfnOriginAccessControl

new SecureFrontendWebAppCloudFrontDistribution(stack, 'SecureFrontendWebAppCloudFrontDistribution', {
  comment: 'frontend web app distribution.', // optional
  accessLogBucket: accessLogBucket, // optional
  certificate: certificate,
  distributionDomainName: 'example.com',
  s3OriginAccessType: S3OriginAccessType.ORIGIN_ACCESS_CONTROL,
  originAccessControlId: cfnOriginAccessControl.attrId,
  originBucket: originBucket,
});

for Origin Access Identity

import { SecureFrontendWebAppCloudFrontDistribution, S3OriginAccessType } from '@gammarers/aws-secure-frontend-web-app-cloudfront-distribution';

declare const originBucket: s3.Bucket;
declare const accessLogBucket: s3.Bucket;
declare const certificate: acm.Certificate;
declare const originAccessIdentity: cloudfront.OriginAccessIdentity;

new SecureFrontendWebAppCloudFrontDistribution(stack, 'SecureFrontendWebAppCloudFrontDistribution', {
  comment: 'frontend web app distribution.', // optional
  accessLogBucket: accessLogBucket, // optional
  certificate: certificate,
  distributionDomainName: 'example.com',
  s3OriginAccessType: S3OriginAccessType.ORIGIN_ACCESS_IDENTITY,
  originAccessIdentity: originAccessIdentity,
  originBucket: originBucket,
});

License

This project is licensed under the Apache-2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

File details

Details for the file gammarers_aws_secure_frontend_web_app_cloudfront_distribution-1.4.11.tar.gz.

File metadata

File hashes

Hashes for gammarers_aws_secure_frontend_web_app_cloudfront_distribution-1.4.11.tar.gz
Algorithm Hash digest
SHA256 88fb1dc07fe67b7a52c844f16ba6b5bb9cc67854909f7c837157de03e975f07b
MD5 5829dad8bc0ea586d238b8c20bf60aee
BLAKE2b-256 2a19b9eb38f1904fb8eaae58cda50e5fe2e326148acfa3263c42b5cc905bd7c1

See more details on using hashes here.

File details

Details for the file gammarers.aws_secure_frontend_web_app_cloudfront_distribution-1.4.11-py3-none-any.whl.

File metadata

File hashes

Hashes for gammarers.aws_secure_frontend_web_app_cloudfront_distribution-1.4.11-py3-none-any.whl
Algorithm Hash digest
SHA256 dd27e2d837708e7ed46c5a52c55c282ef59ae02edb75d7eb04b6a11a2cec1f62
MD5 8e03dde5da0431aa00aa34ccf95ee86e
BLAKE2b-256 1c6b4b44474a540d4f5f2390b94b43da726a48e4ecf36fe9998225772b4d7916

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page