SourceConfiguration

class aws_cdk.aws_cloudfront.SourceConfiguration(*, behaviors, connection_attempts=None, connection_timeout=None, custom_origin_source=None, failover_criteria_status_codes=None, failover_custom_origin_source=None, failover_s3_origin_source=None, origin_headers=None, origin_path=None, origin_shield_region=None, s3_origin_source=None)

Bases: object

A source configuration is a wrapper for CloudFront origins and behaviors.

An origin is what CloudFront will “be in front of” - that is, CloudFront will pull it’s assets from an origin.

If you’re using s3 as a source - pass the s3Origin property, otherwise, pass the customOriginSource property.

One or the other must be passed, and it is invalid to pass both in the same SourceConfiguration.

Parameters
  • behaviors (Sequence[Behavior]) – The behaviors associated with this source. At least one (default) behavior must be included.

  • connection_attempts (Union[int, float, None]) – The number of times that CloudFront attempts to connect to the origin. You can specify 1, 2, or 3 as the number of attempts. Default: 3

  • connection_timeout (Optional[Duration]) – The number of seconds that CloudFront waits when trying to establish a connection to the origin. You can specify a number of seconds between 1 and 10 (inclusive). Default: cdk.Duration.seconds(10)

  • custom_origin_source (Optional[CustomOriginConfig]) – A custom origin source - for all non-s3 sources.

  • failover_criteria_status_codes (Optional[Sequence[FailoverStatusCode]]) – HTTP status code to failover to second origin. Default: [500, 502, 503, 504]

  • failover_custom_origin_source (Optional[CustomOriginConfig]) – A custom origin source for failover in case the s3OriginSource returns invalid status code. Default: - no failover configuration

  • failover_s3_origin_source (Optional[S3OriginConfig]) – An s3 origin source for failover in case the s3OriginSource returns invalid status code. Default: - no failover configuration

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

  • origin_path (Optional[str]) – (deprecated) 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

  • s3_origin_source (Optional[S3OriginConfig]) – An s3 origin source - if you’re using s3 for your assets.

Attributes

behaviors

The behaviors associated with this source.

At least one (default) behavior must be included.

Return type

List[Behavior]

connection_attempts

The number of times that CloudFront attempts to connect to the origin.

You can specify 1, 2, or 3 as the number of attempts.

Default

3

Return type

Union[int, float, None]

connection_timeout

The number of seconds that CloudFront waits when trying to establish a connection to the origin.

You can specify a number of seconds between 1 and 10 (inclusive).

Default

cdk.Duration.seconds(10)

Return type

Optional[Duration]

custom_origin_source

A custom origin source - for all non-s3 sources.

Return type

Optional[CustomOriginConfig]

failover_criteria_status_codes

HTTP status code to failover to second origin.

Default

[500, 502, 503, 504]

Return type

Optional[List[FailoverStatusCode]]

failover_custom_origin_source

A custom origin source for failover in case the s3OriginSource returns invalid status code.

Default
  • no failover configuration

Return type

Optional[CustomOriginConfig]

failover_s3_origin_source

An s3 origin source for failover in case the s3OriginSource returns invalid status code.

Default
  • no failover configuration

Return type

Optional[S3OriginConfig]

origin_headers

(deprecated) Any additional headers to pass to the origin.

Default
  • No additional headers are passed.

Deprecated

Use originHeaders on s3OriginSource or customOriginSource

Stability

deprecated

Return type

Optional[Mapping[str, str]]

origin_path

(deprecated) The relative path to the origin root to use for sources.

Default

/

Deprecated

Use originPath on s3OriginSource or customOriginSource

Stability

deprecated

Return type

Optional[str]

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

See

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html

Return type

Optional[str]

s3_origin_source

An s3 origin source - if you’re using s3 for your assets.

Return type

Optional[S3OriginConfig]