S3OriginConfig

class aws_cdk.aws_cloudfront.S3OriginConfig(*, s3_bucket_source, origin_access_identity=None, origin_headers=None, origin_path=None, origin_shield_region=None)

Bases: object

S3 origin configuration for CloudFront.

Parameters
  • s3_bucket_source (IBucket) – The source bucket to serve content from.

  • origin_access_identity (Optional[IOriginAccessIdentity]) – The optional Origin Access Identity of the origin identity cloudfront will use when calling your s3 bucket. Default: No Origin Access Identity which requires the S3 bucket to be public accessible

  • origin_headers (Optional[Mapping[str, str]]) – Any additional headers to pass to the origin. Default: - No additional headers are passed.

  • origin_path (Optional[str]) – The relative path to the origin root to use for sources. Default: /

  • origin_shield_region (Optional[str]) – When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled

ExampleMetadata

infused

Example:

# source_bucket: s3.Bucket

viewer_certificate = cloudfront.ViewerCertificate.from_iam_certificate("MYIAMROLEIDENTIFIER",
    aliases=["MYALIAS"]
)

cloudfront.CloudFrontWebDistribution(self, "MyCfWebDistribution",
    origin_configs=[cloudfront.SourceConfiguration(
        s3_origin_source=cloudfront.S3OriginConfig(
            s3_bucket_source=source_bucket
        ),
        behaviors=[cloudfront.Behavior(is_default_behavior=True)]
    )
    ],
    viewer_certificate=viewer_certificate
)

Attributes

origin_access_identity

The optional Origin Access Identity of the origin identity cloudfront will use when calling your s3 bucket.

Default

No Origin Access Identity which requires the S3 bucket to be public accessible

origin_headers

Any additional headers to pass to the origin.

Default
  • No additional headers are passed.

origin_path

The relative path to the origin root to use for sources.

Default

/

origin_shield_region

When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.

Default
  • origin shield not enabled

s3_bucket_source

The source bucket to serve content from.