aws-cdk-lib.aws_cloudfront_origins.RestApiOriginProps

interface RestApiOriginProps

LanguageType name
.NETAmazon.CDK.AWS.CloudFront.Origins.RestApiOriginProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscloudfrontorigins#RestApiOriginProps
Javasoftware.amazon.awscdk.services.cloudfront.origins.RestApiOriginProps
Pythonaws_cdk.aws_cloudfront_origins.RestApiOriginProps
TypeScript (source)aws-cdk-lib » aws_cloudfront_origins » RestApiOriginProps

Properties for an Origin for an API Gateway REST API.

Example

declare const api: apigateway.RestApi;
new cloudfront.Distribution(this, 'Distribution', {
  defaultBehavior: { origin: new origins.RestApiOrigin(api, { originPath: '/custom-origin-path' }) },
});

Properties

NameTypeDescription
connectionAttempts?numberThe number of times that CloudFront attempts to connect to the origin;
connectionTimeout?DurationThe number of seconds that CloudFront waits when trying to establish a connection to the origin.
customHeaders?{ [string]: string }A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
keepaliveTimeout?DurationSpecifies how long, in seconds, CloudFront persists its connection to the origin.
originId?stringA unique identifier for the origin.
originPath?stringAn optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin.
originShieldEnabled?booleanOrigin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false.
originShieldRegion?stringWhen you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
readTimeout?DurationSpecifies how long, in seconds, CloudFront waits for a response from the origin, also known as the origin response timeout.

connectionAttempts?

Type: number (optional, default: 3)

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

valid values are 1, 2, or 3 attempts.


connectionTimeout?

Type: Duration (optional, default: Duration.seconds(10))

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

Valid values are 1-10 seconds, inclusive.


customHeaders?

Type: { [string]: string } (optional, default: {})

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


keepaliveTimeout?

Type: Duration (optional, default: Duration.seconds(5))

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.


originId?

Type: string (optional, default: an originid will be generated for you)

A unique identifier for the origin.

This value must be unique within the distribution.


originPath?

Type: string (optional, default: '/')

An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin.

Must begin, but not end, with '/' (e.g., '/production/images').


originShieldEnabled?

Type: boolean (optional, default: true)

Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false.


originShieldRegion?

Type: string (optional, default: origin shield not enabled)

When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.

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


readTimeout?

Type: Duration (optional, default: Duration.seconds(30))

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.