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.3.tar.gz.

File metadata

File hashes

Hashes for gammarers.aws-secure-frontend-web-app-cloudfront-distribution-1.4.3.tar.gz
Algorithm Hash digest
SHA256 8f382304c88b6e55ce77f929877c6920ebeb9a31e2f9b2a46fd90747b17dae10
MD5 e60d88f5319b9b7523f58ed4dc299acf
BLAKE2b-256 8cc3f1ebd9edd94837c0989584558b4936070e231d889fcdbf982764d4b2155f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gammarers.aws_secure_frontend_web_app_cloudfront_distribution-1.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 752a03ab21ade378f03ae9984739114b6e8695d0e3370638273701168934bccd
MD5 230b66ac23bb82b99b7f5edcf6db5088
BLAKE2b-256 3a2ccabaedb3f77dd1f54f3d995b4c811b8e3c5f6b92d73e12bd1e8c8a53f097

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