aws-cloudfront-s3 - AWS Solutions Constructs

aws-cloudfront-s3

All classes are under active development and subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.

Language Package
Python
aws_solutions_constructs.aws_cloudfront_s3
Typescript
@aws-solutions-constructs/aws-cloudfront-s3
Java
software.amazon.awsconstructs.services.cloudfronts3

This AWS Solutions Constructs pattern implements an Amazon CloudFront distribution fronting an Amazon S3 bucket.

Here is a minimal deployable pattern definition:

const { CloudFrontToS3 } = require('@aws-solutions-constructs/aws-cloudfront-s3'); new CloudFrontToS3(stack, 'test-cloudfront-s3', {});

Initializer

new CloudFrontToS3(scope: Construct, id: string, props: CloudFrontToS3Props);

Parameters

Pattern Construct Props

Name Type Description
existingBucketObj? s3.Bucket An optional, existing bucket to be used instead of the default bucket. If an existing bucket is provided, the bucketProps property will be ignored.
bucketProps? s3.BucketProps Optional user-provided properties to override the default properties for the bucket. Ignored if an existingBucketObj is provided.
cloudFrontDistributionProps? cloudfront.CloudFrontWebDistributionProps Optional user provided props to override the default props for CloudFront Distribution
insertHttpSecurityHeaders? boolean Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from CloudFront

Pattern Properties

Name Type Description
cloudFrontWebDistribution cloudfront.CloudFrontWebDistribution Returns an instance of the CloudFront web distribution created by the pattern.
s3Bucket s3.Bucket Returns an instance of the S3 bucket created by the pattern.
s3LoggingBucket? s3.Bucket Returns an instance of the logging bucket created by the pattern for the S3 bucket.
edgeLambdaFunctionVersion? lambda.Version Returns an instance of the Lambda edge function version created by the pattern.
cloudFrontLoggingBucket? s3.Bucket Returns an instance of the logging bucket created by the pattern for the CloudFront web distribution.

Default settings

Out-of-the-box implementation of this pattern without any overrides will set the following defaults:

Amazon CloudFront

  • Configure Access logging for CloudFront WebDistribution

  • Enable automatic injection of best practice HTTP security headers in all responses from CloudFront WebDistribution

Amazon S3 Bucket

  • Configure Access logging for S3 Bucket

  • Enable server-side encryption for S3 Bucket using AWS managed KMS Key

  • Turn on the versioning for S3 Bucket

  • Don't allow public access for S3 Bucket

  • Retain the S3 Bucket when deleting the CloudFormation stack

  • Enforce encryption of data in transit

Architecture