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, s3_origin_source=None)

Bases: object

(experimental) 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 (List[Behavior]) – (experimental) The behaviors associated with this source. At least one (default) behavior must be included.

  • connection_attempts (Union[int, float, None]) – (experimental) 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]) – (experimental) 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]) – (experimental) A custom origin source - for all non-s3 sources.

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

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

  • failover_s3_origin_source (Optional[S3OriginConfig]) – (experimental) 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: /

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

Stability

experimental

Attributes

behaviors

(experimental) The behaviors associated with this source.

At least one (default) behavior must be included.

Stability

experimental

Return type

List[Behavior]

connection_attempts

(experimental) 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

Stability

experimental

Return type

Union[int, float, None]

connection_timeout

(experimental) 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)

Stability

experimental

Return type

Optional[Duration]

custom_origin_source

(experimental) A custom origin source - for all non-s3 sources.

Stability

experimental

Return type

Optional[CustomOriginConfig]

failover_criteria_status_codes

(experimental) HTTP status code to failover to second origin.

Default

[500, 502, 503, 504]

Stability

experimental

Return type

Optional[List[FailoverStatusCode]]

failover_custom_origin_source

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

Default
  • no failover configuration

Stability

experimental

Return type

Optional[CustomOriginConfig]

failover_s3_origin_source

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

Default
  • no failover configuration

Stability

experimental

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]

s3_origin_source

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

Stability

experimental

Return type

Optional[S3OriginConfig]