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

File metadata

File hashes

Hashes for gammarers_aws_secure_frontend_web_app_cloudfront_distribution-1.4.18.tar.gz
Algorithm Hash digest
SHA256 d358bd0eaf3cbba4128ee5f91051ff32ea62b6a33b9525ad7ed46f078be66699
MD5 64a8b97839e2b83f315e1cb64797e9a4
BLAKE2b-256 c505b4de3c56210e815a91e75bfe90903e8c3a83e8a307dc077092a98cd69bb0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gammarers.aws_secure_frontend_web_app_cloudfront_distribution-1.4.18-py3-none-any.whl
Algorithm Hash digest
SHA256 a0ee22eda0092e0d11c1dc1738b2acecdc015c0de1f4cdf8ee8ce391b16b5d45
MD5 6190fa270ff7ab3b732a1348706f4460
BLAKE2b-256 3cafb4d307ffa0891f41a65006429076efa0a4126b55e2952631bbd9530e2d59

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