Skip to content
v2.274.0

CloudFrontWebDistributionProps Struct ​

Example ​

ts
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 ​

commentstringcommentstrcommentStringCommentstringComment*string= No comment is added to distribut…#
A comment for this distribution in the CloudFront console.
default

Default: No comment is added to distribution.

defaultRootObjectstringdefault_root_objectstrdefaultRootObjectStringDefaultRootObjectstringDefaultRootObject*string= "index.html" is served.#
The default object to serve.
enabledbooleanenabledboolenabledBooleanEnabledboolEnabled*bool= true#
Enable or disable the distribution.
enableIpV6booleanenable_ip_v6boolenableIpV6BooleanEnableIpV6boolEnableIpV6*bool= true#
If your distribution should have IPv6 enabled.
errorConfigurationsCfnDistribution.CustomErrorResponseProperty[]error_configurationstyping.List[CustomErrorResponseProperty]errorConfigurationsList<CustomErrorResponseProperty>ErrorConfigurationsCustomErrorResponseProperty[]ErrorConfigurations*[]CustomErrorResponseProperty= 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.

geoRestrictionGeoRestrictiongeo_restrictionGeoRestrictiongeoRestrictionGeoRestrictionGeoRestrictionGeoRestrictionGeoRestrictionGeoRestriction= No geo restriction#
Controls the countries in which your content is distributed.
httpVersionHttpVersionhttp_versionHttpVersionhttpVersionHttpVersionHttpVersionHttpVersionHttpVersionHttpVersion= HttpVersion.HTTP2#
The HTTP version(s) to enable for viewers communicating with CloudFront.
loggingConfigLoggingConfigurationlogging_configLoggingConfigurationloggingConfigLoggingConfigurationLoggingConfigLoggingConfigurationLoggingConfigLoggingConfiguration= 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.

default

Default: no logging is enabled by default.

originConfigsSourceConfiguration[]origin_configstyping.List[SourceConfiguration]originConfigsList<SourceConfiguration>OriginConfigsSourceConfiguration[]OriginConfigs*[]SourceConfigurationrequired#
The origin configurations for this distribution.

Behaviors are a part of the origin.

priceClassPriceClassprice_classPriceClasspriceClassPriceClassPriceClassPriceClassPriceClassPriceClass= PriceClass.PRICE_CLASS_100 the c…#
The price class for the distribution (this impacts how many locations CloudFront uses for your distribution, and billing).
default

Default: PriceClass.PRICE_CLASS_100 the cheapest option for CloudFront is picked by default.

viewerCertificateViewerCertificateviewer_certificateViewerCertificateviewerCertificateViewerCertificateViewerCertificateViewerCertificateViewerCertificateViewerCertificate= ViewerCertificate.fromCloudFront…#
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.
default

Default: ViewerCertificate.fromCloudFrontDefaultCertificate()

viewerProtocolPolicyViewerProtocolPolicyviewer_protocol_policyViewerProtocolPolicyviewerProtocolPolicyViewerProtocolPolicyViewerProtocolPolicyViewerProtocolPolicyViewerProtocolPolicyViewerProtocolPolicy= RedirectToHTTPs#
The default viewer policy for incoming clients.
webACLIdstringweb_acl_idstrwebACLIdStringWebACLIdstringWebACLId*string= No AWS Web Application Firewall …#
Unique identifier that specifies the AWS WAF web ACL to associate with this CloudFront distribution.
notes · default

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.

Default: No AWS Web Application Firewall web access control list (web ACL).