RestApiOriginProps

class aws_cdk.aws_cloudfront_origins.RestApiOriginProps(*, connection_attempts=None, connection_timeout=None, custom_headers=None, origin_shield_region=None, keepalive_timeout=None, read_timeout=None)

Bases: aws_cdk.aws_cloudfront.OriginOptions

Properties for an Origin for an API Gateway REST API.

Parameters
  • connection_attempts (Union[int, float, None]) – The number of times that CloudFront attempts to connect to the origin; valid values are 1, 2, or 3 attempts. Default: 3

  • connection_timeout (Optional[Duration]) – The number of seconds that CloudFront waits when trying to establish a connection to the origin. Valid values are 1-10 seconds, inclusive. Default: Duration.seconds(10)

  • custom_headers (Optional[Mapping[str, str]]) – A list of HTTP header names and values that CloudFront adds to requests it sends to the origin. 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

  • keepalive_timeout (Optional[Duration]) – Specifies how long, in seconds, CloudFront persists its connection to the origin. The valid range is from 1 to 180 seconds, inclusive. Note that values over 60 seconds are possible only after a limit increase request for the origin response timeout quota has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time. Default: Duration.seconds(5)

  • read_timeout (Optional[Duration]) – Specifies how long, in seconds, CloudFront waits for a response from the origin, also known as the origin response timeout. The valid range is from 1 to 180 seconds, inclusive. Note that values over 60 seconds are possible only after a limit increase request for the origin response timeout quota has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time. Default: Duration.seconds(30)

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront_origins as cloudfront_origins
import aws_cdk.core as cdk

rest_api_origin_props = cloudfront_origins.RestApiOriginProps(
    connection_attempts=123,
    connection_timeout=cdk.Duration.minutes(30),
    custom_headers={
        "custom_headers_key": "customHeaders"
    },
    keepalive_timeout=cdk.Duration.minutes(30),
    origin_shield_region="originShieldRegion",
    read_timeout=cdk.Duration.minutes(30)
)

Attributes

connection_attempts

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

valid values are 1, 2, or 3 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.

Valid values are 1-10 seconds, inclusive.

Default

Duration.seconds(10)

Return type

Optional[Duration]

custom_headers

A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.

Default

{}

Return type

Optional[Mapping[str, str]]

keepalive_timeout

Specifies how long, in seconds, CloudFront persists its connection to the origin.

The valid range is from 1 to 180 seconds, inclusive.

Note that values over 60 seconds are possible only after a limit increase request for the origin response timeout quota has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time.

Default

Duration.seconds(5)

Return type

Optional[Duration]

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]

read_timeout

Specifies how long, in seconds, CloudFront waits for a response from the origin, also known as the origin response timeout.

The valid range is from 1 to 180 seconds, inclusive.

Note that values over 60 seconds are possible only after a limit increase request for the origin response timeout quota has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time.

Default

Duration.seconds(30)

Return type

Optional[Duration]