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

File metadata

File hashes

Hashes for gammarers.aws-secure-frontend-web-app-cloudfront-distribution-1.4.4.tar.gz
Algorithm Hash digest
SHA256 c4c262573482b4976a41d3a7397d5a59b708122be980ef5e68efd08fb734251e
MD5 153c43b25734b4a9122f282a69cb3870
BLAKE2b-256 79b698a09f7c1e39f385fc6fcf275accfdf922ed8977f53a4d9dfcdebbfce7e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gammarers.aws_secure_frontend_web_app_cloudfront_distribution-1.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 521017ac7c0d853c258e6c405bdcd034d6803754be8f71d8851de8ff7bade52c
MD5 279854eb76f90363e14987989bba121f
BLAKE2b-256 abb8111240dfba19ceecce2eba7350ca9401b8c12c8ce4cfa5ff1a3d925e34fe

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