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

File metadata

File hashes

Hashes for gammarers_aws_secure_frontend_web_app_cloudfront_distribution-1.4.19.tar.gz
Algorithm Hash digest
SHA256 3ad97e1e35dbb594d84c7a80e8a8350df1d67e129e27f5b487f537f5a25096dd
MD5 47ddd04db8653a8eed01990b46306f3b
BLAKE2b-256 9aff830b35cfbbd31ba65d0fd376bccc4fa91764664341cb8ad8d011a11b6df3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gammarers.aws_secure_frontend_web_app_cloudfront_distribution-1.4.19-py3-none-any.whl
Algorithm Hash digest
SHA256 f738b3e4ec90dbd758c99905d7df7a2301da830b73ff9ee283536e83aa074619
MD5 440d0b2ce0e09b8b6cf4b9fd62d384f8
BLAKE2b-256 a61b4ad2fd07e6604eac2cda3d42f2b6a00b7c93c973401cbff8134b0c7fb74c

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