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 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
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 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 }
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_AWS_IAM, }) cloudfront.NewDistribution(this, jsii.String("MyDistribution"), &DistributionProps{ DefaultBehavior: &BehaviorOptions{ Origin: origins.FunctionUrlOrigin_WithOriginAccessControl(fnUrl), }, })
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"` // 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 cdk "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"), }
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"` // 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. // // 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:
// 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" functionUrlOriginProps := &FunctionUrlOriginProps{ ConnectionAttempts: jsii.Number(123), ConnectionTimeout: cdk.Duration_Minutes(jsii.Number(30)), CustomHeaders: map[string]*string{ "customHeadersKey": jsii.String("customHeaders"), }, 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)), }
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"` // 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. // // 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 }
An Origin for an HTTP server or S3 bucket configured for website hosting.
Example:
// Adding realtime logs config to a Cloudfront Distribution on default behavior. import kinesis "github.com/aws/aws-cdk-go/awscdk" var stream stream realTimeConfig := cloudfront.NewRealtimeLogConfig(this, jsii.String("realtimeLog"), &RealtimeLogConfigProps{ EndPoints: []endpoint{ cloudfront.*endpoint_FromKinesisStream(stream), }, Fields: []*string{ jsii.String("timestamp"), jsii.String("c-ip"), jsii.String("time-to-first-byte"), jsii.String("sc-status"), }, RealtimeLogConfigName: jsii.String("my-delivery-stream"), SamplingRate: jsii.Number(100), }) cloudfront.NewDistribution(this, jsii.String("myCdn"), &DistributionProps{ DefaultBehavior: &BehaviorOptions{ Origin: origins.NewHttpOrigin(jsii.String("www.example.com")), RealtimeLogConfig: realTimeConfig, }, })
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"` // 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 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:
// 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" httpOriginProps := &HttpOriginProps{ 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), 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)), }
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 }
An Origin for a v2 load balancer.
Example:
import ec2 "github.com/aws/aws-cdk-go/awscdk" import elbv2 "github.com/aws/aws-cdk-go/awscdk" 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"` // 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 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:
import elbv2 "github.com/aws/aws-cdk-go/awscdk" 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)), 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"` }
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 }
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"` // 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 }
A S3 Bucket Origin.
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 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"` // 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 cdk "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"), }
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"` // 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")) s3Origin := origins.S3BucketOrigin_WithOriginAccessControl(myBucket, &S3BucketOriginWithOACProps{ OriginAccessLevels: []accessLevel{ cloudfront.*accessLevel_READ, cloudfront.*accessLevel_WRITE, cloudfront.*accessLevel_DELETE, }, })
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"` // 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:
// Adding an existing Lambda@Edge function created in a different stack // to a CloudFront distribution. var s3Bucket bucket functionVersion := lambda.Version_FromVersionArn(this, jsii.String("Version"), jsii.String("arn:aws:lambda:us-east-1:123456789012:function:functionName:1")) cloudfront.NewDistribution(this, jsii.String("distro"), &DistributionProps{ DefaultBehavior: &BehaviorOptions{ Origin: origins.NewS3Origin(s3Bucket), EdgeLambdas: []edgeLambda{ &edgeLambda{ FunctionVersion: *FunctionVersion, EventType: cloudfront.LambdaEdgeEventType_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"` // 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 cdk "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"), }
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 }
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"` // 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 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), 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)), }
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
- main.go