OriginOptions Struct
Options to define an Origin.
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_cloudfront as cloudfront } from 'aws-cdk-lib';
const originOptions: cloudfront.OriginOptions = {
connectionAttempts: 123,
connectionTimeout: cdk.Duration.minutes(30),
customHeaders: {
customHeadersKey: 'customHeaders',
},
originAccessControlId: 'originAccessControlId',
originId: 'originId',
originShieldEnabled: false,
originShieldRegion: 'originShieldRegion',
responseCompletionTimeout: cdk.Duration.minutes(30),
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_cloudfront as cloudfront
origin_options = cloudfront.OriginOptions(
connection_attempts=123,
connection_timeout=cdk.Duration.minutes(30),
custom_headers={
"custom_headers_key": "customHeaders"
},
origin_access_control_id="originAccessControlId",
origin_id="originId",
origin_shield_enabled=False,
origin_shield_region="originShieldRegion",
response_completion_timeout=cdk.Duration.minutes(30)
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.cloudfront.*;
OriginOptions originOptions = OriginOptions.builder()
.connectionAttempts(123)
.connectionTimeout(Duration.minutes(30))
.customHeaders(Map.of(
"customHeadersKey", "customHeaders"))
.originAccessControlId("originAccessControlId")
.originId("originId")
.originShieldEnabled(false)
.originShieldRegion("originShieldRegion")
.responseCompletionTimeout(Duration.minutes(30))
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.CloudFront;
var originOptions = new OriginOptions {
ConnectionAttempts = 123,
ConnectionTimeout = Duration.Minutes(30),
CustomHeaders = new Dictionary<string, string> {
{ "customHeadersKey", "customHeaders" }
},
OriginAccessControlId = "originAccessControlId",
OriginId = "originId",
OriginShieldEnabled = false,
OriginShieldRegion = "originShieldRegion",
ResponseCompletionTimeout = Duration.Minutes(30)
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
originOptions := &OriginOptions{
ConnectionAttempts: jsii.Number(123),
ConnectionTimeout: cdk.Duration_Minutes(jsii.Number(30)),
CustomHeaders: map[string]*string{
"customHeadersKey": jsii.String("customHeaders"),
},
OriginAccessControlId: jsii.String("originAccessControlId"),
OriginId: jsii.String("originId"),
OriginShieldEnabled: jsii.Boolean(false),
OriginShieldRegion: jsii.String("originShieldRegion"),
ResponseCompletionTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
}
Properties
connectionAttemptsoptionalnumberconnection_attemptsoptionalint | floatconnectionAttemptsoptionalNumberConnectionAttemptsoptionaldoubleConnectionAttemptsoptional*float64= 3#The number of times that CloudFront attempts to connect to the origin;
valid values are 1, 2, or 3 attempts.
connectionTimeoutoptionalDurationconnection_timeoutoptionalDurationconnectionTimeoutoptionalDurationConnectionTimeoutoptionalDurationConnectionTimeoutoptionalDuration= 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.
customHeadersoptional{ [key: string]: string }custom_headersoptionaltyping.Mapping[str, str]customHeadersoptionalMap<String, String>CustomHeadersoptionalIDictionary<string, string>CustomHeadersoptional*map[string]*string= {}#A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
originAccessControlIdoptionalstringorigin_access_control_idoptionalstroriginAccessControlIdoptionalStringOriginAccessControlIdoptionalstringOriginAccessControlIdoptional*string#The unique identifier of an origin access control for this origin.
Default: no origin access control
originIdoptionalstringorigin_idoptionalstroriginIdoptionalStringOriginIdoptionalstringOriginIdoptional*string#A unique identifier for the origin.
Default: an originid will be generated for you
This value must be unique within the distribution.
originShieldEnabledoptionalbooleanorigin_shield_enabledoptionalbooloriginShieldEnabledoptionalBooleanOriginShieldEnabledoptionalboolOriginShieldEnabledoptional*bool= 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.
originShieldRegionoptionalstringorigin_shield_regionoptionalstroriginShieldRegionoptionalStringOriginShieldRegionoptionalstringOriginShieldRegionoptional*string#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
responseCompletionTimeoutoptionalDurationresponse_completion_timeoutoptionalDurationresponseCompletionTimeoutoptionalDurationResponseCompletionTimeoutoptionalDurationResponseCompletionTimeoutoptionalDuration#The time that a request from CloudFront to the origin can stay open and wait for a response.
Default: undefined - AWS CloudFront default is not enforcing a maximum value
If the complete response isn't received from the origin by this time, CloudFront ends the connection.
Valid values are 1-3600 seconds, inclusive.