Documentation
¶
Index ¶
- func FunctionUrlOrigin_WithOriginAccessControl(lambdaFunctionUrl awslambda.IFunctionUrl, props *FunctionUrlOriginWithOACProps) awscloudfront.IOrigin
- func NewFunctionUrlOrigin_Override(f FunctionUrlOrigin, lambdaFunctionUrl awslambda.IFunctionUrl, ...)
- func NewHttpOrigin_Override(h HttpOrigin, domainName *string, props *HttpOriginProps)
- func NewLoadBalancerV2Origin_Override(l LoadBalancerV2Origin, loadBalancer awselasticloadbalancingv2.ILoadBalancerV2, ...)
- func NewOriginGroup_Override(o OriginGroup, props *OriginGroupProps)
- func NewRestApiOrigin_Override(r RestApiOrigin, restApi awsapigateway.RestApiBase, props *RestApiOriginProps)
- func NewS3BucketOrigin_Override(s S3BucketOrigin, bucket awss3.IBucket, props *S3BucketOriginBaseProps)
- func NewS3Origin_Override(s S3Origin, bucket awss3.IBucket, props *S3OriginProps)deprecated
- func NewS3StaticWebsiteOrigin_Override(s S3StaticWebsiteOrigin, bucket awss3.IBucket, ...)
- func NewVpcOrigin_Override(v VpcOrigin, domainName *string, props *VpcOriginProps)
- func S3BucketOrigin_WithBucketDefaults(bucket awss3.IBucket, props *awscloudfront.OriginProps) awscloudfront.IOrigin
- func S3BucketOrigin_WithOriginAccessControl(bucket awss3.IBucket, props *S3BucketOriginWithOACProps) awscloudfront.IOrigin
- func S3BucketOrigin_WithOriginAccessIdentity(bucket awss3.IBucket, props *S3BucketOriginWithOAIProps) awscloudfront.IOrigin
- type FunctionUrlOrigin
- type FunctionUrlOriginBaseProps
- type FunctionUrlOriginProps
- type FunctionUrlOriginWithOACProps
- type HttpOrigin
- type HttpOriginProps
- type LoadBalancerV2Origin
- type LoadBalancerV2OriginProps
- type OriginGroup
- type OriginGroupProps
- type RestApiOrigin
- type RestApiOriginProps
- type S3BucketOrigin
- type S3BucketOriginBaseProps
- type S3BucketOriginWithOACProps
- type S3BucketOriginWithOAIProps
- type S3Origindeprecated
- type S3OriginProps
- type S3StaticWebsiteOrigin
- type S3StaticWebsiteOriginProps
- type VpcOrigin
- func VpcOrigin_WithApplicationLoadBalancer(alb awselasticloadbalancingv2.IApplicationLoadBalancer, ...) VpcOrigin
- func VpcOrigin_WithEc2Instance(instance awsec2.IInstance, props *VpcOriginWithEndpointProps) VpcOrigin
- func VpcOrigin_WithNetworkLoadBalancer(nlb awselasticloadbalancingv2.INetworkLoadBalancer, ...) VpcOrigin
- func VpcOrigin_WithVpcOrigin(origin awscloudfront.IVpcOrigin, props *VpcOriginProps) VpcOrigin
- type VpcOriginProps
- type VpcOriginWithEndpointProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FunctionUrlOrigin_WithOriginAccessControl ¶ added in v2.168.0
func FunctionUrlOrigin_WithOriginAccessControl(lambdaFunctionUrl awslambda.IFunctionUrl, props *FunctionUrlOriginWithOACProps) awscloudfront.IOrigin
Create a Lambda Function URL Origin with Origin Access Control (OAC) configured.
func NewFunctionUrlOrigin_Override ¶ added in v2.129.0
func NewFunctionUrlOrigin_Override(f FunctionUrlOrigin, lambdaFunctionUrl awslambda.IFunctionUrl, props *FunctionUrlOriginProps)
func NewHttpOrigin_Override ¶
func NewHttpOrigin_Override(h HttpOrigin, domainName *string, props *HttpOriginProps)
func NewLoadBalancerV2Origin_Override ¶
func NewLoadBalancerV2Origin_Override(l LoadBalancerV2Origin, loadBalancer awselasticloadbalancingv2.ILoadBalancerV2, props *LoadBalancerV2OriginProps)
func NewOriginGroup_Override ¶
func NewOriginGroup_Override(o OriginGroup, props *OriginGroupProps)
func NewRestApiOrigin_Override ¶ added in v2.25.0
func NewRestApiOrigin_Override(r RestApiOrigin, restApi awsapigateway.RestApiBase, props *RestApiOriginProps)
func NewS3BucketOrigin_Override ¶ added in v2.156.0
func NewS3BucketOrigin_Override(s S3BucketOrigin, bucket awss3.IBucket, props *S3BucketOriginBaseProps)
func NewS3Origin_Override
deprecated
func NewS3Origin_Override(s S3Origin, bucket awss3.IBucket, props *S3OriginProps)
Deprecated: Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
func NewS3StaticWebsiteOrigin_Override ¶ added in v2.156.0
func NewS3StaticWebsiteOrigin_Override(s S3StaticWebsiteOrigin, bucket awss3.IBucket, props *S3StaticWebsiteOriginProps)
func NewVpcOrigin_Override ¶ added in v2.180.0
func NewVpcOrigin_Override(v VpcOrigin, domainName *string, props *VpcOriginProps)
func S3BucketOrigin_WithBucketDefaults ¶ added in v2.156.0
func S3BucketOrigin_WithBucketDefaults(bucket awss3.IBucket, props *awscloudfront.OriginProps) awscloudfront.IOrigin
Create a S3 Origin with default S3 bucket settings (no origin access control).
func S3BucketOrigin_WithOriginAccessControl ¶ added in v2.156.0
func S3BucketOrigin_WithOriginAccessControl(bucket awss3.IBucket, props *S3BucketOriginWithOACProps) awscloudfront.IOrigin
Create a S3 Origin with Origin Access Control (OAC) configured.
func S3BucketOrigin_WithOriginAccessIdentity ¶ added in v2.156.0
func S3BucketOrigin_WithOriginAccessIdentity(bucket awss3.IBucket, props *S3BucketOriginWithOAIProps) awscloudfront.IOrigin
Create a S3 Origin with Origin Access Identity (OAI) configured OAI is a legacy feature and we **strongly** recommend you to use OAC via `withOriginAccessControl()` unless it is not supported in your required region (e.g. China regions).
Types ¶
type FunctionUrlOrigin ¶ added in v2.129.0
type FunctionUrlOrigin interface {
awscloudfront.OriginBase
// Binds the origin to the associated Distribution.
//
// Can be used to grant permissions, create dependent resources, etc.
Bind(scope constructs.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig
RenderCustomOriginConfig() *awscloudfront.CfnDistribution_CustomOriginConfigProperty
RenderS3OriginConfig() *awscloudfront.CfnDistribution_S3OriginConfigProperty
RenderVpcOriginConfig() *awscloudfront.CfnDistribution_VpcOriginConfigProperty
// Validates that responseCompletionTimeout is greater than or equal to readTimeout when both are specified.
//
// This method should be called by subclasses that support readTimeout.
ValidateResponseCompletionTimeoutWithReadTimeout(responseCompletionTimeout awscdk.Duration, readTimeout awscdk.Duration)
}
An Origin for a Lambda Function URL.
Example:
import lambda "github.com/aws/aws-cdk-go/awscdk"
var fn Function
fnUrl := fn.AddFunctionUrl(&FunctionUrlOptions{
AuthType: lambda.FunctionUrlAuthType_NONE,
})
cloudfront.NewDistribution(this, jsii.String("Distribution"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: origins.NewFunctionUrlOrigin(fnUrl, &FunctionUrlOriginProps{
ReadTimeout: awscdk.Duration_Seconds(jsii.Number(30)),
ResponseCompletionTimeout: awscdk.Duration_*Seconds(jsii.Number(90)),
KeepaliveTimeout: awscdk.Duration_*Seconds(jsii.Number(45)),
}),
},
})
func NewFunctionUrlOrigin ¶ added in v2.129.0
func NewFunctionUrlOrigin(lambdaFunctionUrl awslambda.IFunctionUrl, props *FunctionUrlOriginProps) FunctionUrlOrigin
type FunctionUrlOriginBaseProps ¶ added in v2.168.0
type FunctionUrlOriginBaseProps struct {
// The number of times that CloudFront attempts to connect to the origin;
//
// valid values are 1, 2, or 3 attempts.
// Default: 3.
//
ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"`
// 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)
//
ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"`
// A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
// Default: {}.
//
CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"`
// The unique identifier of an origin access control for this origin.
// Default: - no origin access control.
//
OriginAccessControlId *string `field:"optional" json:"originAccessControlId" yaml:"originAccessControlId"`
// A unique identifier for the origin.
//
// This value must be unique within the distribution.
// Default: - an originid will be generated for you.
//
OriginId *string `field:"optional" json:"originId" yaml:"originId"`
// 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.
// Default: - true.
//
OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"`
// When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
//
// Default: - origin shield not enabled.
//
OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"`
// The time that a request from CloudFront to the origin can stay open and wait for a response.
//
// If the complete response isn't received from the origin by this time, CloudFront ends the connection.
//
// Valid values are 1-3600 seconds, inclusive.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#response-completion-timeout
//
// Default: undefined - AWS CloudFront default is not enforcing a maximum value.
//
ResponseCompletionTimeout awscdk.Duration `field:"optional" json:"responseCompletionTimeout" yaml:"responseCompletionTimeout"`
// 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').
// Default: '/'.
//
OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"`
}
Properties for configuring a origin using a standard Lambda Functions URLs.
Example:
// 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"
functionUrlOriginBaseProps := &FunctionUrlOriginBaseProps{
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"),
OriginPath: jsii.String("originPath"),
OriginShieldEnabled: jsii.Boolean(false),
OriginShieldRegion: jsii.String("originShieldRegion"),
ResponseCompletionTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
}
type FunctionUrlOriginProps ¶ added in v2.129.0
type FunctionUrlOriginProps struct {
// The number of times that CloudFront attempts to connect to the origin;
//
// valid values are 1, 2, or 3 attempts.
// Default: 3.
//
ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"`
// 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)
//
ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"`
// A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
// Default: {}.
//
CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"`
// The unique identifier of an origin access control for this origin.
// Default: - no origin access control.
//
OriginAccessControlId *string `field:"optional" json:"originAccessControlId" yaml:"originAccessControlId"`
// A unique identifier for the origin.
//
// This value must be unique within the distribution.
// Default: - an originid will be generated for you.
//
OriginId *string `field:"optional" json:"originId" yaml:"originId"`
// 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.
// Default: - true.
//
OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"`
// When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
//
// Default: - origin shield not enabled.
//
OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"`
// The time that a request from CloudFront to the origin can stay open and wait for a response.
//
// If the complete response isn't received from the origin by this time, CloudFront ends the connection.
//
// Valid values are 1-3600 seconds, inclusive.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#response-completion-timeout
//
// Default: undefined - AWS CloudFront default is not enforcing a maximum value.
//
ResponseCompletionTimeout awscdk.Duration `field:"optional" json:"responseCompletionTimeout" yaml:"responseCompletionTimeout"`
// 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').
// Default: '/'.
//
OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"`
// Specifies which IP protocol CloudFront uses when connecting to your origin.
//
// If your origin uses both IPv4 and IPv6 protocols, you can choose dualstack to help optimize reliability.
// Default: OriginIpAddressType.IPV4
//
IpAddressType awscloudfront.OriginIpAddressType `field:"optional" json:"ipAddressType" yaml:"ipAddressType"`
// 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)
//
KeepaliveTimeout awscdk.Duration `field:"optional" json:"keepaliveTimeout" yaml:"keepaliveTimeout"`
// Specifies how long, in seconds, CloudFront waits for a response from 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(30)
//
ReadTimeout awscdk.Duration `field:"optional" json:"readTimeout" yaml:"readTimeout"`
}
Properties for a Lambda Function URL Origin.
Example:
import lambda "github.com/aws/aws-cdk-go/awscdk"
var fn Function
fnUrl := fn.AddFunctionUrl(&FunctionUrlOptions{
AuthType: lambda.FunctionUrlAuthType_NONE,
})
cloudfront.NewDistribution(this, jsii.String("Distribution"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: origins.NewFunctionUrlOrigin(fnUrl, &FunctionUrlOriginProps{
ReadTimeout: awscdk.Duration_Seconds(jsii.Number(30)),
ResponseCompletionTimeout: awscdk.Duration_*Seconds(jsii.Number(90)),
KeepaliveTimeout: awscdk.Duration_*Seconds(jsii.Number(45)),
}),
},
})
type FunctionUrlOriginWithOACProps ¶ added in v2.168.0
type FunctionUrlOriginWithOACProps struct {
// The number of times that CloudFront attempts to connect to the origin;
//
// valid values are 1, 2, or 3 attempts.
// Default: 3.
//
ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"`
// 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)
//
ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"`
// A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
// Default: {}.
//
CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"`
// The unique identifier of an origin access control for this origin.
// Default: - no origin access control.
//
OriginAccessControlId *string `field:"optional" json:"originAccessControlId" yaml:"originAccessControlId"`
// A unique identifier for the origin.
//
// This value must be unique within the distribution.
// Default: - an originid will be generated for you.
//
OriginId *string `field:"optional" json:"originId" yaml:"originId"`
// 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.
// Default: - true.
//
OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"`
// When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
//
// Default: - origin shield not enabled.
//
OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"`
// The time that a request from CloudFront to the origin can stay open and wait for a response.
//
// If the complete response isn't received from the origin by this time, CloudFront ends the connection.
//
// Valid values are 1-3600 seconds, inclusive.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#response-completion-timeout
//
// Default: undefined - AWS CloudFront default is not enforcing a maximum value.
//
ResponseCompletionTimeout awscdk.Duration `field:"optional" json:"responseCompletionTimeout" yaml:"responseCompletionTimeout"`
// 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').
// Default: '/'.
//
OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"`
// Specifies which IP protocol CloudFront uses when connecting to your origin.
//
// If your origin uses both IPv4 and IPv6 protocols, you can choose dualstack to help optimize reliability.
// Default: OriginIpAddressType.IPV4
//
IpAddressType awscloudfront.OriginIpAddressType `field:"optional" json:"ipAddressType" yaml:"ipAddressType"`
// 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)
//
KeepaliveTimeout awscdk.Duration `field:"optional" json:"keepaliveTimeout" yaml:"keepaliveTimeout"`
// Specifies how long, in seconds, CloudFront waits for a response from 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(30)
//
ReadTimeout awscdk.Duration `field:"optional" json:"readTimeout" yaml:"readTimeout"`
// An optional Origin Access Control.
// Default: - an Origin Access Control will be created.
//
OriginAccessControl awscloudfront.IOriginAccessControl `field:"optional" json:"originAccessControl" yaml:"originAccessControl"`
}
Properties for configuring a Lambda Functions URLs with OAC.
Example:
import lambda "github.com/aws/aws-cdk-go/awscdk"
var fn Function
fnUrl := fn.AddFunctionUrl(&FunctionUrlOptions{
AuthType: lambda.FunctionUrlAuthType_AWS_IAM,
})
// Define a custom OAC
oac := cloudfront.NewFunctionUrlOriginAccessControl(this, jsii.String("MyOAC"), &FunctionUrlOriginAccessControlProps{
OriginAccessControlName: jsii.String("CustomLambdaOAC"),
Signing: cloudfront.Signing_SIGV4_ALWAYS(),
})
// Set up Lambda Function URL with OAC in CloudFront Distribution
// Set up Lambda Function URL with OAC in CloudFront Distribution
cloudfront.NewDistribution(this, jsii.String("MyDistribution"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: origins.FunctionUrlOrigin_WithOriginAccessControl(fnUrl, &FunctionUrlOriginWithOACProps{
OriginAccessControl: oac,
}),
},
})
type HttpOrigin ¶
type HttpOrigin interface {
awscloudfront.OriginBase
// Binds the origin to the associated Distribution.
//
// Can be used to grant permissions, create dependent resources, etc.
Bind(scope constructs.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig
RenderCustomOriginConfig() *awscloudfront.CfnDistribution_CustomOriginConfigProperty
RenderS3OriginConfig() *awscloudfront.CfnDistribution_S3OriginConfigProperty
RenderVpcOriginConfig() *awscloudfront.CfnDistribution_VpcOriginConfigProperty
// Validates that responseCompletionTimeout is greater than or equal to readTimeout when both are specified.
//
// This method should be called by subclasses that support readTimeout.
ValidateResponseCompletionTimeoutWithReadTimeout(responseCompletionTimeout awscdk.Duration, readTimeout awscdk.Duration)
}
An Origin for an HTTP server or S3 bucket configured for website hosting.
Example:
myBucket := s3.NewBucket(this, jsii.String("myBucket"))
cloudfront.NewDistribution(this, jsii.String("myDist"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: origins.NewOriginGroup(&OriginGroupProps{
PrimaryOrigin: origins.S3BucketOrigin_WithOriginAccessControl(myBucket),
FallbackOrigin: origins.NewHttpOrigin(jsii.String("www.example.com")),
// optional, defaults to: 500, 502, 503 and 504
FallbackStatusCodes: []*f64{
jsii.Number(404),
},
}),
},
})
func NewHttpOrigin ¶
func NewHttpOrigin(domainName *string, props *HttpOriginProps) HttpOrigin
type HttpOriginProps ¶
type HttpOriginProps struct {
// The number of times that CloudFront attempts to connect to the origin;
//
// valid values are 1, 2, or 3 attempts.
// Default: 3.
//
ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"`
// 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)
//
ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"`
// A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
// Default: {}.
//
CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"`
// The unique identifier of an origin access control for this origin.
// Default: - no origin access control.
//
OriginAccessControlId *string `field:"optional" json:"originAccessControlId" yaml:"originAccessControlId"`
// A unique identifier for the origin.
//
// This value must be unique within the distribution.
// Default: - an originid will be generated for you.
//
OriginId *string `field:"optional" json:"originId" yaml:"originId"`
// 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.
// Default: - true.
//
OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"`
// When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
//
// Default: - origin shield not enabled.
//
OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"`
// The time that a request from CloudFront to the origin can stay open and wait for a response.
//
// If the complete response isn't received from the origin by this time, CloudFront ends the connection.
//
// Valid values are 1-3600 seconds, inclusive.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#response-completion-timeout
//
// Default: undefined - AWS CloudFront default is not enforcing a maximum value.
//
ResponseCompletionTimeout awscdk.Duration `field:"optional" json:"responseCompletionTimeout" yaml:"responseCompletionTimeout"`
// 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').
// Default: '/'.
//
OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"`
// The HTTP port that CloudFront uses to connect to the origin.
// Default: 80.
//
HttpPort *float64 `field:"optional" json:"httpPort" yaml:"httpPort"`
// The HTTPS port that CloudFront uses to connect to the origin.
// Default: 443.
//
HttpsPort *float64 `field:"optional" json:"httpsPort" yaml:"httpsPort"`
// Specifies which IP protocol CloudFront uses when connecting to your origin.
//
// If your origin uses both IPv4 and IPv6 protocols, you can choose dualstack to help optimize reliability.
// Default: undefined - AWS Cloudfront default is IPv4.
//
IpAddressType awscloudfront.OriginIpAddressType `field:"optional" json:"ipAddressType" yaml:"ipAddressType"`
// 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)
//
KeepaliveTimeout awscdk.Duration `field:"optional" json:"keepaliveTimeout" yaml:"keepaliveTimeout"`
// The SSL versions to use when interacting with the origin.
// Default: OriginSslPolicy.TLS_V1_2
//
OriginSslProtocols *[]awscloudfront.OriginSslPolicy `field:"optional" json:"originSslProtocols" yaml:"originSslProtocols"`
// Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin.
// Default: OriginProtocolPolicy.HTTPS_ONLY
//
ProtocolPolicy awscloudfront.OriginProtocolPolicy `field:"optional" json:"protocolPolicy" yaml:"protocolPolicy"`
// 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)
//
ReadTimeout awscdk.Duration `field:"optional" json:"readTimeout" yaml:"readTimeout"`
}
Properties for an Origin backed by an S3 website-configured bucket, load balancer, or custom HTTP server.
Example:
origin := origins.NewHttpOrigin(jsii.String("www.example.com"), &HttpOriginProps{
IpAddressType: cloudfront.OriginIpAddressType_IPV6,
})
cloudfront.NewDistribution(this, jsii.String("Distribution"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: *Origin,
},
})
type LoadBalancerV2Origin ¶
type LoadBalancerV2Origin interface {
HttpOrigin
// Binds the origin to the associated Distribution.
//
// Can be used to grant permissions, create dependent resources, etc.
Bind(scope constructs.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig
RenderCustomOriginConfig() *awscloudfront.CfnDistribution_CustomOriginConfigProperty
RenderS3OriginConfig() *awscloudfront.CfnDistribution_S3OriginConfigProperty
RenderVpcOriginConfig() *awscloudfront.CfnDistribution_VpcOriginConfigProperty
// Validates that responseCompletionTimeout is greater than or equal to readTimeout when both are specified.
//
// This method should be called by subclasses that support readTimeout.
ValidateResponseCompletionTimeoutWithReadTimeout(responseCompletionTimeout awscdk.Duration, readTimeout awscdk.Duration)
}
An Origin for a v2 load balancer.
Example:
// Creates a distribution from an ELBv2 load balancer
var vpc Vpc
// Create an application load balancer in a VPC. 'internetFacing' must be 'true'
// for CloudFront to access the load balancer and use it as an origin.
lb := elbv2.NewApplicationLoadBalancer(this, jsii.String("LB"), &ApplicationLoadBalancerProps{
Vpc: Vpc,
InternetFacing: jsii.Boolean(true),
})
cloudfront.NewDistribution(this, jsii.String("myDist"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: origins.NewLoadBalancerV2Origin(lb),
},
})
func NewLoadBalancerV2Origin ¶
func NewLoadBalancerV2Origin(loadBalancer awselasticloadbalancingv2.ILoadBalancerV2, props *LoadBalancerV2OriginProps) LoadBalancerV2Origin
type LoadBalancerV2OriginProps ¶
type LoadBalancerV2OriginProps struct {
// The number of times that CloudFront attempts to connect to the origin;
//
// valid values are 1, 2, or 3 attempts.
// Default: 3.
//
ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"`
// 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)
//
ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"`
// A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
// Default: {}.
//
CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"`
// The unique identifier of an origin access control for this origin.
// Default: - no origin access control.
//
OriginAccessControlId *string `field:"optional" json:"originAccessControlId" yaml:"originAccessControlId"`
// A unique identifier for the origin.
//
// This value must be unique within the distribution.
// Default: - an originid will be generated for you.
//
OriginId *string `field:"optional" json:"originId" yaml:"originId"`
// 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.
// Default: - true.
//
OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"`
// When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
//
// Default: - origin shield not enabled.
//
OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"`
// The time that a request from CloudFront to the origin can stay open and wait for a response.
//
// If the complete response isn't received from the origin by this time, CloudFront ends the connection.
//
// Valid values are 1-3600 seconds, inclusive.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#response-completion-timeout
//
// Default: undefined - AWS CloudFront default is not enforcing a maximum value.
//
ResponseCompletionTimeout awscdk.Duration `field:"optional" json:"responseCompletionTimeout" yaml:"responseCompletionTimeout"`
// 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').
// Default: '/'.
//
OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"`
// The HTTP port that CloudFront uses to connect to the origin.
// Default: 80.
//
HttpPort *float64 `field:"optional" json:"httpPort" yaml:"httpPort"`
// The HTTPS port that CloudFront uses to connect to the origin.
// Default: 443.
//
HttpsPort *float64 `field:"optional" json:"httpsPort" yaml:"httpsPort"`
// Specifies which IP protocol CloudFront uses when connecting to your origin.
//
// If your origin uses both IPv4 and IPv6 protocols, you can choose dualstack to help optimize reliability.
// Default: undefined - AWS Cloudfront default is IPv4.
//
IpAddressType awscloudfront.OriginIpAddressType `field:"optional" json:"ipAddressType" yaml:"ipAddressType"`
// 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)
//
KeepaliveTimeout awscdk.Duration `field:"optional" json:"keepaliveTimeout" yaml:"keepaliveTimeout"`
// The SSL versions to use when interacting with the origin.
// Default: OriginSslPolicy.TLS_V1_2
//
OriginSslProtocols *[]awscloudfront.OriginSslPolicy `field:"optional" json:"originSslProtocols" yaml:"originSslProtocols"`
// Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin.
// Default: OriginProtocolPolicy.HTTPS_ONLY
//
ProtocolPolicy awscloudfront.OriginProtocolPolicy `field:"optional" json:"protocolPolicy" yaml:"protocolPolicy"`
// 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)
//
ReadTimeout awscdk.Duration `field:"optional" json:"readTimeout" yaml:"readTimeout"`
}
Properties for an Origin backed by a v2 load balancer.
Example:
var loadBalancer ApplicationLoadBalancer
origin := origins.NewLoadBalancerV2Origin(loadBalancer, &LoadBalancerV2OriginProps{
ConnectionAttempts: jsii.Number(3),
ConnectionTimeout: awscdk.Duration_Seconds(jsii.Number(5)),
ReadTimeout: awscdk.Duration_*Seconds(jsii.Number(45)),
ResponseCompletionTimeout: awscdk.Duration_*Seconds(jsii.Number(120)),
KeepaliveTimeout: awscdk.Duration_*Seconds(jsii.Number(45)),
ProtocolPolicy: cloudfront.OriginProtocolPolicy_MATCH_VIEWER,
})
type OriginGroup ¶
type OriginGroup interface {
awscloudfront.IOrigin
// The method called when a given Origin is added (for the first time) to a Distribution.
Bind(scope constructs.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig
}
An Origin that represents a group.
Consists of a primary Origin, and a fallback Origin called when the primary returns one of the provided HTTP status codes.
Example:
myBucket := s3.NewBucket(this, jsii.String("myBucket"))
cloudfront.NewDistribution(this, jsii.String("myDist"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: origins.NewOriginGroup(&OriginGroupProps{
PrimaryOrigin: origins.S3BucketOrigin_WithOriginAccessControl(myBucket),
FallbackOrigin: origins.NewHttpOrigin(jsii.String("www.example.com")),
// optional, defaults to: 500, 502, 503 and 504
FallbackStatusCodes: []*f64{
jsii.Number(404),
},
}),
},
})
func NewOriginGroup ¶
func NewOriginGroup(props *OriginGroupProps) OriginGroup
type OriginGroupProps ¶
type OriginGroupProps struct {
// The fallback origin that should serve requests when the primary fails.
FallbackOrigin awscloudfront.IOrigin `field:"required" json:"fallbackOrigin" yaml:"fallbackOrigin"`
// The primary origin that should serve requests for this group.
PrimaryOrigin awscloudfront.IOrigin `field:"required" json:"primaryOrigin" yaml:"primaryOrigin"`
// The list of HTTP status codes that, when returned from the primary origin, would cause querying the fallback origin.
// Default: - 500, 502, 503 and 504.
//
FallbackStatusCodes *[]*float64 `field:"optional" json:"fallbackStatusCodes" yaml:"fallbackStatusCodes"`
// The selection criteria for the origin group.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/high_availability_origin_failover.html#concept_origin_groups.creating
//
// Default: - OriginSelectionCriteria.DEFAULT
//
SelectionCriteria awscloudfront.OriginSelectionCriteria `field:"optional" json:"selectionCriteria" yaml:"selectionCriteria"`
}
Construction properties for `OriginGroup`.
Example:
myBucket := s3.NewBucket(this, jsii.String("myBucket"))
cloudfront.NewDistribution(this, jsii.String("myDist"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: origins.NewOriginGroup(&OriginGroupProps{
PrimaryOrigin: origins.S3BucketOrigin_WithOriginAccessControl(myBucket),
FallbackOrigin: origins.NewHttpOrigin(jsii.String("www.example.com")),
// optional, defaults to: 500, 502, 503 and 504
FallbackStatusCodes: []*f64{
jsii.Number(404),
},
}),
},
})
type RestApiOrigin ¶ added in v2.25.0
type RestApiOrigin interface {
awscloudfront.OriginBase
// Binds the origin to the associated Distribution.
//
// Can be used to grant permissions, create dependent resources, etc.
Bind(scope constructs.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig
RenderCustomOriginConfig() *awscloudfront.CfnDistribution_CustomOriginConfigProperty
RenderS3OriginConfig() *awscloudfront.CfnDistribution_S3OriginConfigProperty
RenderVpcOriginConfig() *awscloudfront.CfnDistribution_VpcOriginConfigProperty
// Validates that responseCompletionTimeout is greater than or equal to readTimeout when both are specified.
//
// This method should be called by subclasses that support readTimeout.
ValidateResponseCompletionTimeoutWithReadTimeout(responseCompletionTimeout awscdk.Duration, readTimeout awscdk.Duration)
}
An Origin for an API Gateway REST API.
Example:
var api RestApi
cloudfront.NewDistribution(this, jsii.String("Distribution"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: origins.NewRestApiOrigin(api),
},
})
func NewRestApiOrigin ¶ added in v2.25.0
func NewRestApiOrigin(restApi awsapigateway.RestApiBase, props *RestApiOriginProps) RestApiOrigin
type RestApiOriginProps ¶ added in v2.25.0
type RestApiOriginProps struct {
// The number of times that CloudFront attempts to connect to the origin;
//
// valid values are 1, 2, or 3 attempts.
// Default: 3.
//
ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"`
// 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)
//
ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"`
// A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
// Default: {}.
//
CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"`
// The unique identifier of an origin access control for this origin.
// Default: - no origin access control.
//
OriginAccessControlId *string `field:"optional" json:"originAccessControlId" yaml:"originAccessControlId"`
// A unique identifier for the origin.
//
// This value must be unique within the distribution.
// Default: - an originid will be generated for you.
//
OriginId *string `field:"optional" json:"originId" yaml:"originId"`
// 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.
// Default: - true.
//
OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"`
// When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
//
// Default: - origin shield not enabled.
//
OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"`
// The time that a request from CloudFront to the origin can stay open and wait for a response.
//
// If the complete response isn't received from the origin by this time, CloudFront ends the connection.
//
// Valid values are 1-3600 seconds, inclusive.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#response-completion-timeout
//
// Default: undefined - AWS CloudFront default is not enforcing a maximum value.
//
ResponseCompletionTimeout awscdk.Duration `field:"optional" json:"responseCompletionTimeout" yaml:"responseCompletionTimeout"`
// 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').
// Default: '/'.
//
OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"`
// 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)
//
KeepaliveTimeout awscdk.Duration `field:"optional" json:"keepaliveTimeout" yaml:"keepaliveTimeout"`
// 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)
//
ReadTimeout awscdk.Duration `field:"optional" json:"readTimeout" yaml:"readTimeout"`
}
Properties for an Origin for an API Gateway REST API.
Example:
var api RestApi
cloudfront.NewDistribution(this, jsii.String("Distribution"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: origins.NewRestApiOrigin(api, &RestApiOriginProps{
OriginPath: jsii.String("/custom-origin-path"),
}),
},
})
type S3BucketOrigin ¶ added in v2.156.0
type S3BucketOrigin interface {
awscloudfront.OriginBase
// Binds the origin to the associated Distribution.
//
// Can be used to grant permissions, create dependent resources, etc.
Bind(scope constructs.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig
RenderCustomOriginConfig() *awscloudfront.CfnDistribution_CustomOriginConfigProperty
RenderS3OriginConfig() *awscloudfront.CfnDistribution_S3OriginConfigProperty
RenderVpcOriginConfig() *awscloudfront.CfnDistribution_VpcOriginConfigProperty
// Validates that responseCompletionTimeout is greater than or equal to readTimeout when both are specified.
//
// This method should be called by subclasses that support readTimeout.
ValidateResponseCompletionTimeoutWithReadTimeout(responseCompletionTimeout awscdk.Duration, readTimeout awscdk.Duration)
}
A S3 Bucket Origin.
Example:
import kms "github.com/aws/aws-cdk-go/awscdk"
myKmsKey := kms.NewKey(this, jsii.String("myKMSKey"))
myBucket := s3.NewBucket(this, jsii.String("mySSEKMSEncryptedBucket"), &BucketProps{
Encryption: s3.BucketEncryption_KMS,
EncryptionKey: myKmsKey,
ObjectOwnership: s3.ObjectOwnership_BUCKET_OWNER_ENFORCED,
})
cloudfront.NewDistribution(this, jsii.String("myDist"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: origins.S3BucketOrigin_WithOriginAccessControl(myBucket),
},
})
type S3BucketOriginBaseProps ¶ added in v2.156.0
type S3BucketOriginBaseProps struct {
// The number of times that CloudFront attempts to connect to the origin;
//
// valid values are 1, 2, or 3 attempts.
// Default: 3.
//
ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"`
// 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)
//
ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"`
// A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
// Default: {}.
//
CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"`
// The unique identifier of an origin access control for this origin.
// Default: - no origin access control.
//
OriginAccessControlId *string `field:"optional" json:"originAccessControlId" yaml:"originAccessControlId"`
// A unique identifier for the origin.
//
// This value must be unique within the distribution.
// Default: - an originid will be generated for you.
//
OriginId *string `field:"optional" json:"originId" yaml:"originId"`
// 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.
// Default: - true.
//
OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"`
// When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
//
// Default: - origin shield not enabled.
//
OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"`
// The time that a request from CloudFront to the origin can stay open and wait for a response.
//
// If the complete response isn't received from the origin by this time, CloudFront ends the connection.
//
// Valid values are 1-3600 seconds, inclusive.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#response-completion-timeout
//
// Default: undefined - AWS CloudFront default is not enforcing a maximum value.
//
ResponseCompletionTimeout awscdk.Duration `field:"optional" json:"responseCompletionTimeout" yaml:"responseCompletionTimeout"`
// 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').
// Default: '/'.
//
OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"`
}
Properties for configuring a origin using a standard S3 bucket.
Example:
// 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"
s3BucketOriginBaseProps := &S3BucketOriginBaseProps{
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"),
OriginPath: jsii.String("originPath"),
OriginShieldEnabled: jsii.Boolean(false),
OriginShieldRegion: jsii.String("originShieldRegion"),
ResponseCompletionTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
}
type S3BucketOriginWithOACProps ¶ added in v2.156.0
type S3BucketOriginWithOACProps struct {
// The number of times that CloudFront attempts to connect to the origin;
//
// valid values are 1, 2, or 3 attempts.
// Default: 3.
//
ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"`
// 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)
//
ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"`
// A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
// Default: {}.
//
CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"`
// The unique identifier of an origin access control for this origin.
// Default: - no origin access control.
//
OriginAccessControlId *string `field:"optional" json:"originAccessControlId" yaml:"originAccessControlId"`
// A unique identifier for the origin.
//
// This value must be unique within the distribution.
// Default: - an originid will be generated for you.
//
OriginId *string `field:"optional" json:"originId" yaml:"originId"`
// 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.
// Default: - true.
//
OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"`
// When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
//
// Default: - origin shield not enabled.
//
OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"`
// The time that a request from CloudFront to the origin can stay open and wait for a response.
//
// If the complete response isn't received from the origin by this time, CloudFront ends the connection.
//
// Valid values are 1-3600 seconds, inclusive.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#response-completion-timeout
//
// Default: undefined - AWS CloudFront default is not enforcing a maximum value.
//
ResponseCompletionTimeout awscdk.Duration `field:"optional" json:"responseCompletionTimeout" yaml:"responseCompletionTimeout"`
// 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').
// Default: '/'.
//
OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"`
// An optional Origin Access Control.
// Default: - an Origin Access Control will be created.
//
OriginAccessControl awscloudfront.IOriginAccessControl `field:"optional" json:"originAccessControl" yaml:"originAccessControl"`
// The level of permissions granted in the bucket policy and key policy (if applicable) to the CloudFront distribution.
// Default: [AccessLevel.READ]
//
OriginAccessLevels *[]awscloudfront.AccessLevel `field:"optional" json:"originAccessLevels" yaml:"originAccessLevels"`
}
Properties for configuring a S3 origin with OAC.
Example:
myBucket := s3.NewBucket(this, jsii.String("myBucket"))
oac := cloudfront.NewS3OriginAccessControl(this, jsii.String("MyOAC"), &S3OriginAccessControlProps{
Signing: cloudfront.Signing_SIGV4_NO_OVERRIDE(),
})
s3Origin := origins.S3BucketOrigin_WithOriginAccessControl(myBucket, &S3BucketOriginWithOACProps{
OriginAccessControl: oac,
})
cloudfront.NewDistribution(this, jsii.String("myDist"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: s3Origin,
},
})
type S3BucketOriginWithOAIProps ¶ added in v2.156.0
type S3BucketOriginWithOAIProps struct {
// The number of times that CloudFront attempts to connect to the origin;
//
// valid values are 1, 2, or 3 attempts.
// Default: 3.
//
ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"`
// 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)
//
ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"`
// A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
// Default: {}.
//
CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"`
// The unique identifier of an origin access control for this origin.
// Default: - no origin access control.
//
OriginAccessControlId *string `field:"optional" json:"originAccessControlId" yaml:"originAccessControlId"`
// A unique identifier for the origin.
//
// This value must be unique within the distribution.
// Default: - an originid will be generated for you.
//
OriginId *string `field:"optional" json:"originId" yaml:"originId"`
// 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.
// Default: - true.
//
OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"`
// When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
//
// Default: - origin shield not enabled.
//
OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"`
// The time that a request from CloudFront to the origin can stay open and wait for a response.
//
// If the complete response isn't received from the origin by this time, CloudFront ends the connection.
//
// Valid values are 1-3600 seconds, inclusive.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#response-completion-timeout
//
// Default: undefined - AWS CloudFront default is not enforcing a maximum value.
//
ResponseCompletionTimeout awscdk.Duration `field:"optional" json:"responseCompletionTimeout" yaml:"responseCompletionTimeout"`
// 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').
// Default: '/'.
//
OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"`
// An optional Origin Access Identity.
// Default: - an Origin Access Identity will be created.
//
OriginAccessIdentity awscloudfront.IOriginAccessIdentity `field:"optional" json:"originAccessIdentity" yaml:"originAccessIdentity"`
}
Properties for configuring a S3 origin with OAI.
Example:
myBucket := s3.NewBucket(this, jsii.String("myBucket"))
myOai := cloudfront.NewOriginAccessIdentity(this, jsii.String("myOAI"), &OriginAccessIdentityProps{
Comment: jsii.String("My custom OAI"),
})
s3Origin := origins.S3BucketOrigin_WithOriginAccessIdentity(myBucket, &S3BucketOriginWithOAIProps{
OriginAccessIdentity: myOai,
})
cloudfront.NewDistribution(this, jsii.String("myDist"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: s3Origin,
},
})
type S3Origin
deprecated
type S3Origin interface {
awscloudfront.IOrigin
// The method called when a given Origin is added (for the first time) to a Distribution.
// Deprecated: Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
Bind(scope constructs.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig
}
An Origin that is backed by an S3 bucket.
If the bucket is configured for website hosting, this origin will be configured to use the bucket as an HTTP server origin and will use the bucket's configured website redirects and error handling. Otherwise, the origin is created as a bucket origin and will use CloudFront's redirect and error handling.
Example:
var s3Bucket Bucket
// Add a cloudfront Function to a Distribution
cfFunction := cloudfront.NewFunction(this, jsii.String("Function"), &FunctionProps{
Code: cloudfront.FunctionCode_FromInline(jsii.String("function handler(event) { return event.request }")),
Runtime: cloudfront.FunctionRuntime_JS_2_0(),
})
cloudfront.NewDistribution(this, jsii.String("distro"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: origins.NewS3Origin(s3Bucket),
FunctionAssociations: []FunctionAssociation{
&FunctionAssociation{
Function: cfFunction,
EventType: cloudfront.FunctionEventType_VIEWER_REQUEST,
},
},
},
})
Deprecated: Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
func NewS3Origin
deprecated
func NewS3Origin(bucket awss3.IBucket, props *S3OriginProps) S3Origin
Deprecated: Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
type S3OriginProps ¶
type S3OriginProps struct {
// The number of times that CloudFront attempts to connect to the origin;
//
// valid values are 1, 2, or 3 attempts.
// Default: 3.
//
ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"`
// 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)
//
ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"`
// A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
// Default: {}.
//
CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"`
// The unique identifier of an origin access control for this origin.
// Default: - no origin access control.
//
OriginAccessControlId *string `field:"optional" json:"originAccessControlId" yaml:"originAccessControlId"`
// A unique identifier for the origin.
//
// This value must be unique within the distribution.
// Default: - an originid will be generated for you.
//
OriginId *string `field:"optional" json:"originId" yaml:"originId"`
// 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.
// Default: - true.
//
OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"`
// When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
//
// Default: - origin shield not enabled.
//
OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"`
// The time that a request from CloudFront to the origin can stay open and wait for a response.
//
// If the complete response isn't received from the origin by this time, CloudFront ends the connection.
//
// Valid values are 1-3600 seconds, inclusive.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#response-completion-timeout
//
// Default: undefined - AWS CloudFront default is not enforcing a maximum value.
//
ResponseCompletionTimeout awscdk.Duration `field:"optional" json:"responseCompletionTimeout" yaml:"responseCompletionTimeout"`
// 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').
// Default: '/'.
//
OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"`
// An optional Origin Access Identity of the origin identity cloudfront will use when calling your s3 bucket.
// Default: - An Origin Access Identity will be created.
//
OriginAccessIdentity awscloudfront.IOriginAccessIdentity `field:"optional" json:"originAccessIdentity" yaml:"originAccessIdentity"`
}
Properties to use to customize an S3 Origin.
Example:
// 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"
import "github.com/aws/aws-cdk-go/awscdk"
var originAccessIdentity OriginAccessIdentity
s3OriginProps := &S3OriginProps{
ConnectionAttempts: jsii.Number(123),
ConnectionTimeout: cdk.Duration_Minutes(jsii.Number(30)),
CustomHeaders: map[string]*string{
"customHeadersKey": jsii.String("customHeaders"),
},
OriginAccessControlId: jsii.String("originAccessControlId"),
OriginAccessIdentity: originAccessIdentity,
OriginId: jsii.String("originId"),
OriginPath: jsii.String("originPath"),
OriginShieldEnabled: jsii.Boolean(false),
OriginShieldRegion: jsii.String("originShieldRegion"),
ResponseCompletionTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
}
type S3StaticWebsiteOrigin ¶ added in v2.156.0
type S3StaticWebsiteOrigin interface {
HttpOrigin
// Binds the origin to the associated Distribution.
//
// Can be used to grant permissions, create dependent resources, etc.
Bind(scope constructs.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig
RenderCustomOriginConfig() *awscloudfront.CfnDistribution_CustomOriginConfigProperty
RenderS3OriginConfig() *awscloudfront.CfnDistribution_S3OriginConfigProperty
RenderVpcOriginConfig() *awscloudfront.CfnDistribution_VpcOriginConfigProperty
// Validates that responseCompletionTimeout is greater than or equal to readTimeout when both are specified.
//
// This method should be called by subclasses that support readTimeout.
ValidateResponseCompletionTimeoutWithReadTimeout(responseCompletionTimeout awscdk.Duration, readTimeout awscdk.Duration)
}
An Origin for a S3 bucket configured as a website endpoint.
Example:
myBucket := s3.NewBucket(this, jsii.String("myBucket"))
cloudfront.NewDistribution(this, jsii.String("myDist"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: origins.NewS3StaticWebsiteOrigin(myBucket),
},
})
func NewS3StaticWebsiteOrigin ¶ added in v2.156.0
func NewS3StaticWebsiteOrigin(bucket awss3.IBucket, props *S3StaticWebsiteOriginProps) S3StaticWebsiteOrigin
type S3StaticWebsiteOriginProps ¶ added in v2.156.0
type S3StaticWebsiteOriginProps struct {
// The number of times that CloudFront attempts to connect to the origin;
//
// valid values are 1, 2, or 3 attempts.
// Default: 3.
//
ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"`
// 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)
//
ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"`
// A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
// Default: {}.
//
CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"`
// The unique identifier of an origin access control for this origin.
// Default: - no origin access control.
//
OriginAccessControlId *string `field:"optional" json:"originAccessControlId" yaml:"originAccessControlId"`
// A unique identifier for the origin.
//
// This value must be unique within the distribution.
// Default: - an originid will be generated for you.
//
OriginId *string `field:"optional" json:"originId" yaml:"originId"`
// 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.
// Default: - true.
//
OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"`
// When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
//
// Default: - origin shield not enabled.
//
OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"`
// The time that a request from CloudFront to the origin can stay open and wait for a response.
//
// If the complete response isn't received from the origin by this time, CloudFront ends the connection.
//
// Valid values are 1-3600 seconds, inclusive.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#response-completion-timeout
//
// Default: undefined - AWS CloudFront default is not enforcing a maximum value.
//
ResponseCompletionTimeout awscdk.Duration `field:"optional" json:"responseCompletionTimeout" yaml:"responseCompletionTimeout"`
// 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').
// Default: '/'.
//
OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"`
// The HTTP port that CloudFront uses to connect to the origin.
// Default: 80.
//
HttpPort *float64 `field:"optional" json:"httpPort" yaml:"httpPort"`
// The HTTPS port that CloudFront uses to connect to the origin.
// Default: 443.
//
HttpsPort *float64 `field:"optional" json:"httpsPort" yaml:"httpsPort"`
// Specifies which IP protocol CloudFront uses when connecting to your origin.
//
// If your origin uses both IPv4 and IPv6 protocols, you can choose dualstack to help optimize reliability.
// Default: undefined - AWS Cloudfront default is IPv4.
//
IpAddressType awscloudfront.OriginIpAddressType `field:"optional" json:"ipAddressType" yaml:"ipAddressType"`
// 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)
//
KeepaliveTimeout awscdk.Duration `field:"optional" json:"keepaliveTimeout" yaml:"keepaliveTimeout"`
// The SSL versions to use when interacting with the origin.
// Default: OriginSslPolicy.TLS_V1_2
//
OriginSslProtocols *[]awscloudfront.OriginSslPolicy `field:"optional" json:"originSslProtocols" yaml:"originSslProtocols"`
// Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin.
// Default: OriginProtocolPolicy.HTTPS_ONLY
//
ProtocolPolicy awscloudfront.OriginProtocolPolicy `field:"optional" json:"protocolPolicy" yaml:"protocolPolicy"`
// 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)
//
ReadTimeout awscdk.Duration `field:"optional" json:"readTimeout" yaml:"readTimeout"`
}
Properties for configuring a origin using a S3 bucket configured as a website endpoint.
Example:
// 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"
import "github.com/aws/aws-cdk-go/awscdk"
s3StaticWebsiteOriginProps := &S3StaticWebsiteOriginProps{
ConnectionAttempts: jsii.Number(123),
ConnectionTimeout: cdk.Duration_Minutes(jsii.Number(30)),
CustomHeaders: map[string]*string{
"customHeadersKey": jsii.String("customHeaders"),
},
HttpPort: jsii.Number(123),
HttpsPort: jsii.Number(123),
IpAddressType: awscdk.Aws_cloudfront.OriginIpAddressType_IPV4,
KeepaliveTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
OriginAccessControlId: jsii.String("originAccessControlId"),
OriginId: jsii.String("originId"),
OriginPath: jsii.String("originPath"),
OriginShieldEnabled: jsii.Boolean(false),
OriginShieldRegion: jsii.String("originShieldRegion"),
OriginSslProtocols: []OriginSslPolicy{
awscdk.*Aws_cloudfront.OriginSslPolicy_SSL_V3,
},
ProtocolPolicy: awscdk.*Aws_cloudfront.OriginProtocolPolicy_HTTP_ONLY,
ReadTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
ResponseCompletionTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
}
type VpcOrigin ¶ added in v2.180.0
type VpcOrigin interface {
awscloudfront.OriginBase
Props() *VpcOriginProps
VpcOrigin() awscloudfront.IVpcOrigin
SetVpcOrigin(val awscloudfront.IVpcOrigin)
// Binds the origin to the associated Distribution.
//
// Can be used to grant permissions, create dependent resources, etc.
Bind(scope constructs.Construct, options *awscloudfront.OriginBindOptions) *awscloudfront.OriginBindConfig
RenderCustomOriginConfig() *awscloudfront.CfnDistribution_CustomOriginConfigProperty
RenderS3OriginConfig() *awscloudfront.CfnDistribution_S3OriginConfigProperty
RenderVpcOriginConfig() *awscloudfront.CfnDistribution_VpcOriginConfigProperty
// Validates that responseCompletionTimeout is greater than or equal to readTimeout when both are specified.
//
// This method should be called by subclasses that support readTimeout.
ValidateResponseCompletionTimeoutWithReadTimeout(responseCompletionTimeout awscdk.Duration, readTimeout awscdk.Duration)
}
Represents a distribution's VPC origin.
Example:
// Creates a distribution from a Network Load Balancer
var vpc Vpc
// Create a network load balancer in a VPC. 'internetFacing' can be 'false'.
nlb := elbv2.NewNetworkLoadBalancer(this, jsii.String("NLB"), &NetworkLoadBalancerProps{
Vpc: Vpc,
InternetFacing: jsii.Boolean(false),
VpcSubnets: &SubnetSelection{
SubnetType: ec2.SubnetType_PRIVATE_ISOLATED,
},
SecurityGroups: []ISecurityGroup{
ec2.NewSecurityGroup(this, jsii.String("NLB-SG"), &SecurityGroupProps{
Vpc: *Vpc,
}),
},
})
cloudfront.NewDistribution(this, jsii.String("myDist"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: origins.VpcOrigin_WithNetworkLoadBalancer(nlb),
},
})
func VpcOrigin_WithApplicationLoadBalancer ¶ added in v2.180.0
func VpcOrigin_WithApplicationLoadBalancer(alb awselasticloadbalancingv2.IApplicationLoadBalancer, props *VpcOriginWithEndpointProps) VpcOrigin
Create a VPC origin with an Application Load Balancer.
func VpcOrigin_WithEc2Instance ¶ added in v2.180.0
func VpcOrigin_WithEc2Instance(instance awsec2.IInstance, props *VpcOriginWithEndpointProps) VpcOrigin
Create a VPC origin with an EC2 instance.
func VpcOrigin_WithNetworkLoadBalancer ¶ added in v2.180.0
func VpcOrigin_WithNetworkLoadBalancer(nlb awselasticloadbalancingv2.INetworkLoadBalancer, props *VpcOriginWithEndpointProps) VpcOrigin
Create a VPC origin with a Network Load Balancer.
func VpcOrigin_WithVpcOrigin ¶ added in v2.180.0
func VpcOrigin_WithVpcOrigin(origin awscloudfront.IVpcOrigin, props *VpcOriginProps) VpcOrigin
Create a VPC origin with an existing VPC origin resource.
type VpcOriginProps ¶ added in v2.180.0
type VpcOriginProps struct {
// The number of times that CloudFront attempts to connect to the origin;
//
// valid values are 1, 2, or 3 attempts.
// Default: 3.
//
ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"`
// 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)
//
ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"`
// A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
// Default: {}.
//
CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"`
// The unique identifier of an origin access control for this origin.
// Default: - no origin access control.
//
OriginAccessControlId *string `field:"optional" json:"originAccessControlId" yaml:"originAccessControlId"`
// A unique identifier for the origin.
//
// This value must be unique within the distribution.
// Default: - an originid will be generated for you.
//
OriginId *string `field:"optional" json:"originId" yaml:"originId"`
// 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.
// Default: - true.
//
OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"`
// When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
//
// Default: - origin shield not enabled.
//
OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"`
// The time that a request from CloudFront to the origin can stay open and wait for a response.
//
// If the complete response isn't received from the origin by this time, CloudFront ends the connection.
//
// Valid values are 1-3600 seconds, inclusive.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#response-completion-timeout
//
// Default: undefined - AWS CloudFront default is not enforcing a maximum value.
//
ResponseCompletionTimeout awscdk.Duration `field:"optional" json:"responseCompletionTimeout" yaml:"responseCompletionTimeout"`
// 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').
// Default: '/'.
//
OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"`
// The domain name associated with your VPC origin.
// Default: - The default domain name of the endpoint.
//
DomainName *string `field:"optional" json:"domainName" yaml:"domainName"`
// 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)
//
KeepaliveTimeout awscdk.Duration `field:"optional" json:"keepaliveTimeout" yaml:"keepaliveTimeout"`
// 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)
//
ReadTimeout awscdk.Duration `field:"optional" json:"readTimeout" yaml:"readTimeout"`
}
Properties to define a VPC origin.
Example:
// 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"
vpcOriginProps := &VpcOriginProps{
ConnectionAttempts: jsii.Number(123),
ConnectionTimeout: cdk.Duration_Minutes(jsii.Number(30)),
CustomHeaders: map[string]*string{
"customHeadersKey": jsii.String("customHeaders"),
},
DomainName: jsii.String("domainName"),
KeepaliveTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
OriginAccessControlId: jsii.String("originAccessControlId"),
OriginId: jsii.String("originId"),
OriginPath: jsii.String("originPath"),
OriginShieldEnabled: jsii.Boolean(false),
OriginShieldRegion: jsii.String("originShieldRegion"),
ReadTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
ResponseCompletionTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
}
type VpcOriginWithEndpointProps ¶ added in v2.180.0
type VpcOriginWithEndpointProps struct {
// The number of times that CloudFront attempts to connect to the origin;
//
// valid values are 1, 2, or 3 attempts.
// Default: 3.
//
ConnectionAttempts *float64 `field:"optional" json:"connectionAttempts" yaml:"connectionAttempts"`
// 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)
//
ConnectionTimeout awscdk.Duration `field:"optional" json:"connectionTimeout" yaml:"connectionTimeout"`
// A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
// Default: {}.
//
CustomHeaders *map[string]*string `field:"optional" json:"customHeaders" yaml:"customHeaders"`
// The unique identifier of an origin access control for this origin.
// Default: - no origin access control.
//
OriginAccessControlId *string `field:"optional" json:"originAccessControlId" yaml:"originAccessControlId"`
// A unique identifier for the origin.
//
// This value must be unique within the distribution.
// Default: - an originid will be generated for you.
//
OriginId *string `field:"optional" json:"originId" yaml:"originId"`
// 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.
// Default: - true.
//
OriginShieldEnabled *bool `field:"optional" json:"originShieldEnabled" yaml:"originShieldEnabled"`
// When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html
//
// Default: - origin shield not enabled.
//
OriginShieldRegion *string `field:"optional" json:"originShieldRegion" yaml:"originShieldRegion"`
// The time that a request from CloudFront to the origin can stay open and wait for a response.
//
// If the complete response isn't received from the origin by this time, CloudFront ends the connection.
//
// Valid values are 1-3600 seconds, inclusive.
// See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistValuesOrigin.html#response-completion-timeout
//
// Default: undefined - AWS CloudFront default is not enforcing a maximum value.
//
ResponseCompletionTimeout awscdk.Duration `field:"optional" json:"responseCompletionTimeout" yaml:"responseCompletionTimeout"`
// 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').
// Default: '/'.
//
OriginPath *string `field:"optional" json:"originPath" yaml:"originPath"`
// The domain name associated with your VPC origin.
// Default: - The default domain name of the endpoint.
//
DomainName *string `field:"optional" json:"domainName" yaml:"domainName"`
// 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)
//
KeepaliveTimeout awscdk.Duration `field:"optional" json:"keepaliveTimeout" yaml:"keepaliveTimeout"`
// 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)
//
ReadTimeout awscdk.Duration `field:"optional" json:"readTimeout" yaml:"readTimeout"`
// The HTTP port for the CloudFront VPC origin endpoint configuration.
// Default: 80.
//
HttpPort *float64 `field:"optional" json:"httpPort" yaml:"httpPort"`
// The HTTPS port of the CloudFront VPC origin endpoint configuration.
// Default: 443.
//
HttpsPort *float64 `field:"optional" json:"httpsPort" yaml:"httpsPort"`
// A list that contains allowed SSL/TLS protocols for this distribution.
// Default: - TLSv1.2
//
OriginSslProtocols *[]awscloudfront.OriginSslPolicy `field:"optional" json:"originSslProtocols" yaml:"originSslProtocols"`
// The origin protocol policy for the CloudFront VPC origin endpoint configuration.
// Default: OriginProtocolPolicy.MATCH_VIEWER
//
ProtocolPolicy awscloudfront.OriginProtocolPolicy `field:"optional" json:"protocolPolicy" yaml:"protocolPolicy"`
// The name of the CloudFront VPC origin endpoint configuration.
// Default: - generated from the `id`.
//
VpcOriginName *string `field:"optional" json:"vpcOriginName" yaml:"vpcOriginName"`
}
Properties to define a VPC origin with endpoint.
Example:
// 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"
import "github.com/aws/aws-cdk-go/awscdk"
vpcOriginWithEndpointProps := &VpcOriginWithEndpointProps{
ConnectionAttempts: jsii.Number(123),
ConnectionTimeout: cdk.Duration_Minutes(jsii.Number(30)),
CustomHeaders: map[string]*string{
"customHeadersKey": jsii.String("customHeaders"),
},
DomainName: jsii.String("domainName"),
HttpPort: jsii.Number(123),
HttpsPort: jsii.Number(123),
KeepaliveTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
OriginAccessControlId: jsii.String("originAccessControlId"),
OriginId: jsii.String("originId"),
OriginPath: jsii.String("originPath"),
OriginShieldEnabled: jsii.Boolean(false),
OriginShieldRegion: jsii.String("originShieldRegion"),
OriginSslProtocols: []OriginSslPolicy{
awscdk.Aws_cloudfront.OriginSslPolicy_SSL_V3,
},
ProtocolPolicy: awscdk.*Aws_cloudfront.OriginProtocolPolicy_HTTP_ONLY,
ReadTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
ResponseCompletionTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
VpcOriginName: jsii.String("vpcOriginName"),
}
Source Files
¶
- FunctionUrlOrigin.go
- FunctionUrlOriginBaseProps.go
- FunctionUrlOriginProps.go
- FunctionUrlOriginWithOACProps.go
- FunctionUrlOrigin__checks.go
- HttpOrigin.go
- HttpOriginProps.go
- HttpOrigin__checks.go
- LoadBalancerV2Origin.go
- LoadBalancerV2OriginProps.go
- LoadBalancerV2Origin__checks.go
- OriginGroup.go
- OriginGroupProps.go
- OriginGroup__checks.go
- RestApiOrigin.go
- RestApiOriginProps.go
- RestApiOrigin__checks.go
- S3BucketOrigin.go
- S3BucketOriginBaseProps.go
- S3BucketOriginWithOACProps.go
- S3BucketOriginWithOAIProps.go
- S3BucketOrigin__checks.go
- S3Origin.go
- S3OriginProps.go
- S3Origin__checks.go
- S3StaticWebsiteOrigin.go
- S3StaticWebsiteOriginProps.go
- S3StaticWebsiteOrigin__checks.go
- VpcOrigin.go
- VpcOriginProps.go
- VpcOriginWithEndpointProps.go
- VpcOrigin__checks.go
- main.go