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

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]) – 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[List[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]]) – 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: /

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

stability :stability: experimental

Attributes

behaviors

The behaviors associated with this source.

At least one (default) behavior must be included.

stability :stability: experimental

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 :default: 3

stability :stability: experimental

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 :default: cdk.Duration.seconds(10)

stability :stability: experimental

Return type

Optional[Duration]

custom_origin_source

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

stability :stability: experimental

Return type

Optional[CustomOriginConfig]

failover_criteria_status_codes

HTTP status code to failover to second origin.

default :default: [500, 502, 503, 504]

stability :stability: experimental

Return type

Optional[List[FailoverStatusCode]]

failover_custom_origin_source

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

default :default: - no failover configuration

stability :stability: experimental

Return type

Optional[CustomOriginConfig]

failover_s3_origin_source

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

default :default: - no failover configuration

stability :stability: experimental

Return type

Optional[S3OriginConfig]

origin_headers

Any additional headers to pass to the origin.

default :default: - No additional headers are passed.

deprecated :deprecated: Use originHeaders on s3OriginSource or customOriginSource

stability :stability: deprecated

Return type

Optional[Mapping[str, str]]

origin_path

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

default :default: /

deprecated :deprecated: Use originPath on s3OriginSource or customOriginSource

stability :stability: deprecated

Return type

Optional[str]

s3_origin_source

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

stability :stability: experimental

Return type

Optional[S3OriginConfig]