interface CloudFrontWebDistributionProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.CloudFront.CloudFrontWebDistributionProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awscloudfront#CloudFrontWebDistributionProps |
![]() | software.amazon.awscdk.services.cloudfront.CloudFrontWebDistributionProps |
![]() | aws_cdk.aws_cloudfront.CloudFrontWebDistributionProps |
![]() | aws-cdk-lib » aws_cloudfront » CloudFrontWebDistributionProps |
Example
declare const sourceBucket: s3.Bucket;
const viewerCertificate = cloudfront.ViewerCertificate.fromIamCertificate('MYIAMROLEIDENTIFIER', {
aliases: ['MYALIAS'],
});
new cloudfront.CloudFrontWebDistribution(this, 'MyCfWebDistribution', {
originConfigs: [
{
s3OriginSource: {
s3BucketSource: sourceBucket,
},
behaviors : [ {isDefaultBehavior: true} ],
},
],
viewerCertificate: viewerCertificate,
});
Properties
Name | Type | Description |
---|---|---|
origin | Source [] | The origin configurations for this distribution. |
comment? | string | A comment for this distribution in the CloudFront console. |
default | string | The default object to serve. |
enable | boolean | If your distribution should have IPv6 enabled. |
enabled? | boolean | Enable or disable the distribution. |
error | Custom [] | How CloudFront should handle requests that are not successful (eg PageNotFound). |
geo | Geo | Controls the countries in which your content is distributed. |
http | Http | The max supported HTTP Versions. |
logging | Logging | Optional - if we should enable logging. |
price | Price | The price class for the distribution (this impacts how many locations CloudFront uses for your distribution, and billing). |
viewer | Viewer | Specifies whether you want viewers to use HTTP or HTTPS to request your objects, whether you're using an alternate domain name with HTTPS, and if so, if you're using AWS Certificate Manager (ACM) or a third-party certificate authority. |
viewer | Viewer | The default viewer policy for incoming clients. |
web | string | Unique identifier that specifies the AWS WAF web ACL to associate with this CloudFront distribution. |
originConfigs
Type:
Source
[]
The origin configurations for this distribution.
Behaviors are a part of the origin.
comment?
Type:
string
(optional, default: No comment is added to distribution.)
A comment for this distribution in the CloudFront console.
defaultRootObject?
Type:
string
(optional, default: "index.html" is served.)
The default object to serve.
enableIpV6?
Type:
boolean
(optional, default: true)
If your distribution should have IPv6 enabled.
enabled?
Type:
boolean
(optional, default: true)
Enable or disable the distribution.
errorConfigurations?
Type:
Custom
[]
(optional, default: No custom error configuration.)
How CloudFront should handle requests that are not successful (eg PageNotFound).
By default, CloudFront does not replace HTTP status codes in the 4xx and 5xx range with custom error messages. CloudFront does not cache HTTP status codes.
geoRestriction?
Type:
Geo
(optional, default: No geo restriction)
Controls the countries in which your content is distributed.
httpVersion?
Type:
Http
(optional, default: HttpVersion.HTTP2)
The max supported HTTP Versions.
loggingConfig?
Type:
Logging
(optional, default: no logging is enabled by default.)
Optional - if we should enable logging.
You can pass an empty object ({}) to have us auto create a bucket for logging. Omission of this property indicates no logging is to be enabled.
priceClass?
Type:
Price
(optional, default: PriceClass.PRICE_CLASS_100 the cheapest option for CloudFront is picked by default.)
The price class for the distribution (this impacts how many locations CloudFront uses for your distribution, and billing).
viewerCertificate?
Type:
Viewer
(optional, default: ViewerCertificate.fromCloudFrontDefaultCertificate())
Specifies whether you want viewers to use HTTP or HTTPS to request your objects, whether you're using an alternate domain name with HTTPS, and if so, if you're using AWS Certificate Manager (ACM) or a third-party certificate authority.
viewerProtocolPolicy?
Type:
Viewer
(optional, default: RedirectToHTTPs)
The default viewer policy for incoming clients.
webACLId?
Type:
string
(optional, default: No AWS Web Application Firewall web access control list (web ACL).)
Unique identifier that specifies the AWS WAF web ACL to associate with this CloudFront distribution.
To specify a web ACL created using the latest version of AWS WAF, use the ACL ARN, for example
arn:aws:wafv2:us-east-1:123456789012:global/webacl/ExampleWebACL/473e64fd-f30b-4765-81a0-62ad96dd167a
.
To specify a web ACL created using AWS WAF Classic, use the ACL ID, for example 473e64fd-f30b-4765-81a0-62ad96dd167a
.