FailoverStatusCode

class aws_cdk.aws_cloudfront.FailoverStatusCode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

HTTP status code to failover to second origin.

ExampleMetadata:

infused

Example:

# Configuring origin fallback options for the CloudFrontWebDistribution
cloudfront.CloudFrontWebDistribution(self, "ADistribution",
    origin_configs=[cloudfront.SourceConfiguration(
        s3_origin_source=cloudfront.S3OriginConfig(
            s3_bucket_source=s3.Bucket.from_bucket_name(self, "aBucket", "amzn-s3-demo-bucket"),
            origin_path="/",
            origin_headers={
                "myHeader": "42"
            },
            origin_shield_region="us-west-2"
        ),
        failover_s3_origin_source=cloudfront.S3OriginConfig(
            s3_bucket_source=s3.Bucket.from_bucket_name(self, "aBucketFallback", "amzn-s3-demo-bucket1"),
            origin_path="/somewhere",
            origin_headers={
                "myHeader2": "21"
            },
            origin_shield_region="us-east-1"
        ),
        failover_criteria_status_codes=[cloudfront.FailoverStatusCode.INTERNAL_SERVER_ERROR],
        behaviors=[cloudfront.Behavior(
            is_default_behavior=True
        )
        ]
    )
    ]
)

Attributes

BAD_GATEWAY

Bad Gateway (502).

FORBIDDEN

Forbidden (403).

GATEWAY_TIMEOUT

Gateway Timeout (504).

INTERNAL_SERVER_ERROR

Internal Server Error (500).

NOT_FOUND

Not found (404).

SERVICE_UNAVAILABLE

Service Unavailable (503).