DistributionProps

class aws_cdk.aws_cloudfront.DistributionProps(*, default_behavior, additional_behaviors=None, certificate=None, comment=None, default_root_object=None, domain_names=None, enabled=None, enable_ipv6=None, enable_logging=None, error_responses=None, geo_restriction=None, http_version=None, log_bucket=None, log_file_prefix=None, log_includes_cookies=None, price_class=None, web_acl_id=None)

Bases: object

(experimental) Properties for a Distribution.

Parameters
  • default_behavior (BehaviorOptions) – (experimental) The default behavior for the distribution.

  • additional_behaviors (Optional[Mapping[str, BehaviorOptions]]) – (experimental) Additional behaviors for the distribution, mapped by the pathPattern that specifies which requests to apply the behavior to. Default: - no additional behaviors are added.

  • certificate (Optional[ICertificate]) – (experimental) A certificate to associate with the distribution. The certificate must be located in N. Virginia (us-east-1). Default: - the CloudFront wildcard certificate (*.cloudfront.net) will be used.

  • comment (Optional[str]) – (experimental) Any comments you want to include about the distribution. Default: - no comment

  • default_root_object (Optional[str]) – (experimental) The object that you want CloudFront to request from your origin (for example, index.html) when a viewer requests the root URL for your distribution. If no default object is set, the request goes to the origin’s root (e.g., example.com/). Default: - no default root object

  • domain_names (Optional[List[str]]) – (experimental) Alternative domain names for this distribution. If you want to use your own domain name, such as www.example.com, instead of the cloudfront.net domain name, you can add an alternate domain name to your distribution. If you attach a certificate to the distribution, you must add (at least one of) the domain names of the certificate to this list. Default: - The distribution will only support the default generated name (e.g., d111111abcdef8.cloudfront.net)

  • enabled (Optional[bool]) – (experimental) Enable or disable the distribution. Default: true

  • enable_ipv6 (Optional[bool]) – (experimental) Whether CloudFront will respond to IPv6 DNS requests with an IPv6 address. If you specify false, CloudFront responds to IPv6 DNS requests with the DNS response code NOERROR and with no IP addresses. This allows viewers to submit a second request, for an IPv4 address for your distribution. Default: true

  • enable_logging (Optional[bool]) – (experimental) Enable access logging for the distribution. Default: - false, unless logBucket is specified.

  • error_responses (Optional[List[ErrorResponse]]) – (experimental) How CloudFront should handle requests that are not successful (e.g., PageNotFound). Default: - No custom error responses.

  • geo_restriction (Optional[GeoRestriction]) – (experimental) Controls the countries in which your content is distributed. Default: - No geographic restrictions

  • http_version (Optional[HttpVersion]) – (experimental) Specify the maximum HTTP version that you want viewers to use to communicate with CloudFront. For viewers and CloudFront to use HTTP/2, viewers must support TLS 1.2 or later, and must support server name identification (SNI). Default: HttpVersion.HTTP2

  • log_bucket (Optional[IBucket]) – (experimental) The Amazon S3 bucket to store the access logs in. Default: - A bucket is created if enableLogging is true

  • log_file_prefix (Optional[str]) – (experimental) An optional string that you want CloudFront to prefix to the access log filenames for this distribution. Default: - no prefix

  • log_includes_cookies (Optional[bool]) – (experimental) Specifies whether you want CloudFront to include cookies in access logs. Default: false

  • price_class (Optional[PriceClass]) – (experimental) The price class that corresponds with the maximum price that you want to pay for CloudFront service. If you specify PriceClass_All, CloudFront responds to requests for your objects from all CloudFront edge locations. If you specify a price class other than PriceClass_All, CloudFront serves your objects from the CloudFront edge location that has the lowest latency among the edge locations in your price class. Default: PriceClass.PRICE_CLASS_ALL

  • web_acl_id (Optional[str]) – (experimental) 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. Default: - No AWS Web Application Firewall web access control list (web ACL).

Stability

experimental

Attributes

additional_behaviors

(experimental) Additional behaviors for the distribution, mapped by the pathPattern that specifies which requests to apply the behavior to.

Default
  • no additional behaviors are added.

Stability

experimental

Return type

Optional[Mapping[str, BehaviorOptions]]

certificate

(experimental) A certificate to associate with the distribution.

The certificate must be located in N. Virginia (us-east-1).

Default
  • the CloudFront wildcard certificate (*.cloudfront.net) will be used.

Stability

experimental

Return type

Optional[ICertificate]

comment

(experimental) Any comments you want to include about the distribution.

Default
  • no comment

Stability

experimental

Return type

Optional[str]

default_behavior

(experimental) The default behavior for the distribution.

Stability

experimental

Return type

BehaviorOptions

default_root_object

(experimental) The object that you want CloudFront to request from your origin (for example, index.html) when a viewer requests the root URL for your distribution. If no default object is set, the request goes to the origin’s root (e.g., example.com/).

Default
  • no default root object

Stability

experimental

Return type

Optional[str]

domain_names

(experimental) Alternative domain names for this distribution.

If you want to use your own domain name, such as www.example.com, instead of the cloudfront.net domain name, you can add an alternate domain name to your distribution. If you attach a certificate to the distribution, you must add (at least one of) the domain names of the certificate to this list.

Default
  • The distribution will only support the default generated name (e.g., d111111abcdef8.cloudfront.net)

Stability

experimental

Return type

Optional[List[str]]

enable_ipv6

(experimental) Whether CloudFront will respond to IPv6 DNS requests with an IPv6 address.

If you specify false, CloudFront responds to IPv6 DNS requests with the DNS response code NOERROR and with no IP addresses. This allows viewers to submit a second request, for an IPv4 address for your distribution.

Default

true

Stability

experimental

Return type

Optional[bool]

enable_logging

(experimental) Enable access logging for the distribution.

Default
  • false, unless logBucket is specified.

Stability

experimental

Return type

Optional[bool]

enabled

(experimental) Enable or disable the distribution.

Default

true

Stability

experimental

Return type

Optional[bool]

error_responses

(experimental) How CloudFront should handle requests that are not successful (e.g., PageNotFound).

Default
  • No custom error responses.

Stability

experimental

Return type

Optional[List[ErrorResponse]]

geo_restriction

(experimental) Controls the countries in which your content is distributed.

Default
  • No geographic restrictions

Stability

experimental

Return type

Optional[GeoRestriction]

http_version

(experimental) Specify the maximum HTTP version that you want viewers to use to communicate with CloudFront.

For viewers and CloudFront to use HTTP/2, viewers must support TLS 1.2 or later, and must support server name identification (SNI).

Default

HttpVersion.HTTP2

Stability

experimental

Return type

Optional[HttpVersion]

log_bucket

(experimental) The Amazon S3 bucket to store the access logs in.

Default
  • A bucket is created if enableLogging is true

Stability

experimental

Return type

Optional[IBucket]

log_file_prefix

(experimental) An optional string that you want CloudFront to prefix to the access log filenames for this distribution.

Default
  • no prefix

Stability

experimental

Return type

Optional[str]

log_includes_cookies

(experimental) Specifies whether you want CloudFront to include cookies in access logs.

Default

false

Stability

experimental

Return type

Optional[bool]

price_class

(experimental) The price class that corresponds with the maximum price that you want to pay for CloudFront service.

If you specify PriceClass_All, CloudFront responds to requests for your objects from all CloudFront edge locations. If you specify a price class other than PriceClass_All, CloudFront serves your objects from the CloudFront edge location that has the lowest latency among the edge locations in your price class.

Default

PriceClass.PRICE_CLASS_ALL

Stability

experimental

Return type

Optional[PriceClass]

web_acl_id

(experimental) 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.

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

See

https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_CreateDistribution.html#API_CreateDistribution_RequestParameters.

Stability

experimental

Return type

Optional[str]