CfnDistribution

class aws_cdk.aws_cloudfront.CfnDistribution(scope, id, *, distribution_config, tags=None)

Bases: CfnResource

A CloudFormation AWS::CloudFront::Distribution.

A distribution tells CloudFront where you want content to be delivered from, and the details about how to track and manage content delivery.

CloudformationResource:

AWS::CloudFront::Distribution

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distribution.html

ExampleMetadata:

infused

Example:

# source_bucket: s3.Bucket


my_distribution = cloudfront.Distribution(self, "MyCfWebDistribution",
    default_behavior=cloudfront.BehaviorOptions(
        origin=origins.S3Origin(source_bucket)
    )
)
cfn_distribution = my_distribution.node.default_child
cfn_distribution.override_logical_id("MyDistributionCFDistribution3H55TI9Q")

Create a new AWS::CloudFront::Distribution.

Parameters:
  • scope (Construct) –

    • scope in which this resource is defined.

  • id (str) –

    • scoped id of the resource.

  • distribution_config (Union[IResolvable, DistributionConfigProperty, Dict[str, Any]]) – The distribution’s configuration.

  • tags (Optional[Sequence[Union[CfnTag, Dict[str, Any]]]]) – A complex type that contains zero or more Tag elements.

Methods

add_deletion_override(path)

Syntactic sugar for addOverride(path, undefined).

Parameters:

path (str) – The path of the value to delete.

Return type:

None

add_depends_on(target)

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

Parameters:

target (CfnResource) –

Return type:

None

add_metadata(key, value)

Add a value to the CloudFormation Resource Metadata.

Parameters:
  • key (str) –

  • value (Any) –

See:

Return type:

None

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

add_override(path, value)

Adds an override to the synthesized CloudFormation resource.

To add a property override, either use addPropertyOverride or prefix path with “Properties.” (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example:

cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"])
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")

would add the overrides Example:

"Properties": {
   "GlobalSecondaryIndexes": [
     {
       "Projection": {
         "NonKeyAttributes": [ "myattribute" ]
         ...
       }
       ...
     },
     {
       "ProjectionType": "INCLUDE"
       ...
     },
   ]
   ...
}

The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.

Parameters:
  • path (str) –

    • The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.

  • value (Any) –

    • The value. Could be primitive or complex.

Return type:

None

add_property_deletion_override(property_path)

Adds an override that deletes the value of a property from the resource definition.

Parameters:

property_path (str) – The path to the property.

Return type:

None

add_property_override(property_path, value)

Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

Parameters:
  • property_path (str) – The path of the property.

  • value (Any) – The value.

Return type:

None

apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)

Sets the deletion policy of the resource based on the removal policy specified.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:
  • policy (Optional[RemovalPolicy]) –

  • apply_to_update_replace_policy (Optional[bool]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: true

  • default (Optional[RemovalPolicy]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.

Return type:

None

get_att(attribute_name)

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.

Parameters:

attribute_name (str) – The name of the attribute.

Return type:

Reference

get_metadata(key)

Retrieve a value value from the CloudFormation Resource Metadata.

Parameters:

key (str) –

See:

Return type:

Any

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

inspect(inspector)

Examines the CloudFormation resource and discloses attributes.

Parameters:

inspector (TreeInspector) –

  • tree inspector to collect and process attributes.

Return type:

None

override_logical_id(new_logical_id)

Overrides the auto-generated logical ID with a specific ID.

Parameters:

new_logical_id (str) – The new logical ID to use for this stack element.

Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Returns:

a string representation of this resource

Attributes

CFN_RESOURCE_TYPE_NAME = 'AWS::CloudFront::Distribution'
attr_domain_name

The domain name of the resource, such as d111111abcdef8.cloudfront.net .

CloudformationAttribute:

DomainName

attr_id

The identifier for the distribution, for example EDFDVBD632BHDS5 .

CloudformationAttribute:

Id

cfn_options

Options for this resource, such as condition, update policy etc.

cfn_resource_type

AWS resource type.

creation_stack

return:

the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.

distribution_config

The distribution’s configuration.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distribution.html#cfn-cloudfront-distribution-distributionconfig

logical_id

The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Returns:

the logical ID as a stringified token. This value will only get resolved during synthesis.

node

The construct tree node associated with this construct.

ref

Return a string that will be resolved to a CloudFormation { Ref } for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).

stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

tags

A complex type that contains zero or more Tag elements.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distribution.html#cfn-cloudfront-distribution-tags

Static Methods

classmethod is_cfn_element(x)

Returns true if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.

Parameters:

x (Any) –

Return type:

bool

Returns:

The construct as a stack element or undefined if it is not a stack element.

classmethod is_cfn_resource(construct)

Check whether the given construct is a CfnResource.

Parameters:

construct (IConstruct) –

Return type:

bool

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters:

x (Any) –

Return type:

bool

CacheBehaviorProperty

class CfnDistribution.CacheBehaviorProperty(*, path_pattern, target_origin_id, viewer_protocol_policy, allowed_methods=None, cached_methods=None, cache_policy_id=None, compress=None, default_ttl=None, field_level_encryption_id=None, forwarded_values=None, function_associations=None, lambda_function_associations=None, max_ttl=None, min_ttl=None, origin_request_policy_id=None, realtime_log_config_arn=None, response_headers_policy_id=None, smooth_streaming=None, trusted_key_groups=None, trusted_signers=None)

Bases: object

A complex type that describes how CloudFront processes requests.

You must create at least as many cache behaviors (including the default cache behavior) as you have origins if you want CloudFront to serve objects from all of the origins. Each cache behavior specifies the one origin from which you want CloudFront to get objects. If you have two origins and only the default cache behavior, the default cache behavior will cause CloudFront to get objects from one of the origins, but the other origin is never used.

For the current quota (formerly known as limit) on the number of cache behaviors that you can add to a distribution, see Quotas in the Amazon CloudFront Developer Guide .

If you don’t want to specify any cache behaviors, include only an empty CacheBehaviors element. Don’t include an empty CacheBehavior element because this is invalid.

To delete all cache behaviors in an existing distribution, update the distribution configuration and include only an empty CacheBehaviors element.

To add, change, or remove one or more cache behaviors, update the distribution configuration and specify all of the cache behaviors that you want to include in the updated distribution.

For more information about cache behaviors, see Cache Behavior Settings in the Amazon CloudFront Developer Guide .

Parameters:
  • path_pattern (str) – The pattern (for example, images/*.jpg ) that specifies which requests to apply the behavior to. When CloudFront receives a viewer request, the requested path is compared with path patterns in the order in which cache behaviors are listed in the distribution. .. epigraph:: You can optionally include a slash ( / ) at the beginning of the path pattern. For example, /images/*.jpg . CloudFront behavior is the same with or without the leading / . The path pattern for the default cache behavior is * and cannot be changed. If the request for an object does not match the path pattern for any cache behaviors, CloudFront applies the behavior in the default cache behavior. For more information, see Path Pattern in the Amazon CloudFront Developer Guide .

  • target_origin_id (str) – The value of ID for the origin that you want CloudFront to route requests to when they match this cache behavior.

  • viewer_protocol_policy (str) – The protocol that viewers can use to access the files in the origin specified by TargetOriginId when a request matches the path pattern in PathPattern . You can specify the following options: - allow-all : Viewers can use HTTP or HTTPS. - redirect-to-https : If a viewer submits an HTTP request, CloudFront returns an HTTP status code of 301 (Moved Permanently) to the viewer along with the HTTPS URL. The viewer then resubmits the request using the new URL. - https-only : If a viewer sends an HTTP request, CloudFront returns an HTTP status code of 403 (Forbidden). For more information about requiring the HTTPS protocol, see Requiring HTTPS Between Viewers and CloudFront in the Amazon CloudFront Developer Guide . .. epigraph:: The only way to guarantee that viewers retrieve an object that was fetched from the origin using HTTPS is never to use any other protocol to fetch the object. If you have recently changed from HTTP to HTTPS, we recommend that you clear your objects’ cache because cached objects are protocol agnostic. That means that an edge location will return an object from the cache regardless of whether the current request protocol matches the protocol used previously. For more information, see Managing Cache Expiration in the Amazon CloudFront Developer Guide .

  • allowed_methods (Optional[Sequence[str]]) – A complex type that controls which HTTP methods CloudFront processes and forwards to your Amazon S3 bucket or your custom origin. There are three choices: - CloudFront forwards only GET and HEAD requests. - CloudFront forwards only GET , HEAD , and OPTIONS requests. - CloudFront forwards GET, HEAD, OPTIONS, PUT, PATCH, POST , and DELETE requests. If you pick the third choice, you may need to restrict access to your Amazon S3 bucket or to your custom origin so users can’t perform operations that you don’t want them to. For example, you might not want users to have permissions to delete objects from your origin.

  • cached_methods (Optional[Sequence[str]]) – A complex type that controls whether CloudFront caches the response to requests using the specified HTTP methods. There are two choices: - CloudFront caches responses to GET and HEAD requests. - CloudFront caches responses to GET , HEAD , and OPTIONS requests. If you pick the second choice for your Amazon S3 Origin, you may need to forward Access-Control-Request-Method, Access-Control-Request-Headers, and Origin headers for the responses to be cached correctly.

  • cache_policy_id (Optional[str]) – The unique identifier of the cache policy that is attached to this cache behavior. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide . A CacheBehavior must include either a CachePolicyId or ForwardedValues . We recommend that you use a CachePolicyId .

  • compress (Union[bool, IResolvable, None]) – Whether you want CloudFront to automatically compress certain files for this cache behavior. If so, specify true; if not, specify false. For more information, see Serving Compressed Files in the Amazon CloudFront Developer Guide .

  • default_ttl (Union[int, float, None]) –

    This field is deprecated. We recommend that you use the DefaultTTL field in a cache policy instead of this field. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide . The default amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin does not add HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide .

  • field_level_encryption_id (Optional[str]) – The value of ID for the field-level encryption configuration that you want CloudFront to use for encrypting specific fields of data for this cache behavior.

  • forwarded_values (Union[ForwardedValuesProperty, Dict[str, Any], IResolvable, None]) –

    This field is deprecated. We recommend that you use a cache policy or an origin request policy instead of this field. For more information, see Working with policies in the Amazon CloudFront Developer Guide . If you want to include values in the cache key, use a cache policy. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide . If you want to send values to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies or Using the managed origin request policies in the Amazon CloudFront Developer Guide . A CacheBehavior must include either a CachePolicyId or ForwardedValues . We recommend that you use a CachePolicyId . A complex type that specifies how CloudFront handles query strings, cookies, and HTTP headers.

  • function_associations (Union[IResolvable, Sequence[Union[IResolvable, FunctionAssociationProperty, Dict[str, Any]]], None]) – A list of CloudFront functions that are associated with this cache behavior. CloudFront functions must be published to the LIVE stage to associate them with a cache behavior.

  • lambda_function_associations (Union[IResolvable, Sequence[Union[IResolvable, LambdaFunctionAssociationProperty, Dict[str, Any]]], None]) – A complex type that contains zero or more Lambda@Edge function associations for a cache behavior.

  • max_ttl (Union[int, float, None]) –

    This field is deprecated. We recommend that you use the MaxTTL field in a cache policy instead of this field. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide . The maximum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin adds HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide .

  • min_ttl (Union[int, float, None]) –

    This field is deprecated. We recommend that you use the MinTTL field in a cache policy instead of this field. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide . The minimum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide . You must specify 0 for MinTTL if you configure CloudFront to forward all headers to your origin (under Headers , if you specify 1 for Quantity and * for Name ).

  • origin_request_policy_id (Optional[str]) –

    The unique identifier of the origin request policy that is attached to this cache behavior. For more information, see Creating origin request policies or Using the managed origin request policies in the Amazon CloudFront Developer Guide .

  • realtime_log_config_arn (Optional[str]) – The Amazon Resource Name (ARN) of the real-time log configuration that is attached to this cache behavior. For more information, see Real-time logs in the Amazon CloudFront Developer Guide .

  • response_headers_policy_id (Optional[str]) – The identifier for a response headers policy.

  • smooth_streaming (Union[bool, IResolvable, None]) – Indicates whether you want to distribute media files in the Microsoft Smooth Streaming format using the origin that is associated with this cache behavior. If so, specify true ; if not, specify false . If you specify true for SmoothStreaming , you can still distribute other content using this cache behavior if the content matches the value of PathPattern .

  • trusted_key_groups (Optional[Sequence[str]]) – A list of key groups that CloudFront can use to validate signed URLs or signed cookies. When a cache behavior contains trusted key groups, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with a private key whose corresponding public key is in the key group. The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see Serving private content in the Amazon CloudFront Developer Guide .

  • trusted_signers (Optional[Sequence[str]]) –

    We recommend using TrustedKeyGroups instead of TrustedSigners . A list of AWS account IDs whose public keys CloudFront can use to validate signed URLs or signed cookies. When a cache behavior contains trusted signers, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with the private key of a CloudFront key pair in the trusted signer’s AWS account . The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see Serving private content in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

cache_behavior_property = cloudfront.CfnDistribution.CacheBehaviorProperty(
    path_pattern="pathPattern",
    target_origin_id="targetOriginId",
    viewer_protocol_policy="viewerProtocolPolicy",

    # the properties below are optional
    allowed_methods=["allowedMethods"],
    cached_methods=["cachedMethods"],
    cache_policy_id="cachePolicyId",
    compress=False,
    default_ttl=123,
    field_level_encryption_id="fieldLevelEncryptionId",
    forwarded_values=cloudfront.CfnDistribution.ForwardedValuesProperty(
        query_string=False,

        # the properties below are optional
        cookies=cloudfront.CfnDistribution.CookiesProperty(
            forward="forward",

            # the properties below are optional
            whitelisted_names=["whitelistedNames"]
        ),
        headers=["headers"],
        query_string_cache_keys=["queryStringCacheKeys"]
    ),
    function_associations=[cloudfront.CfnDistribution.FunctionAssociationProperty(
        event_type="eventType",
        function_arn="functionArn"
    )],
    lambda_function_associations=[cloudfront.CfnDistribution.LambdaFunctionAssociationProperty(
        event_type="eventType",
        include_body=False,
        lambda_function_arn="lambdaFunctionArn"
    )],
    max_ttl=123,
    min_ttl=123,
    origin_request_policy_id="originRequestPolicyId",
    realtime_log_config_arn="realtimeLogConfigArn",
    response_headers_policy_id="responseHeadersPolicyId",
    smooth_streaming=False,
    trusted_key_groups=["trustedKeyGroups"],
    trusted_signers=["trustedSigners"]
)

Attributes

allowed_methods

A complex type that controls which HTTP methods CloudFront processes and forwards to your Amazon S3 bucket or your custom origin.

There are three choices:

  • CloudFront forwards only GET and HEAD requests.

  • CloudFront forwards only GET , HEAD , and OPTIONS requests.

  • CloudFront forwards GET, HEAD, OPTIONS, PUT, PATCH, POST , and DELETE requests.

If you pick the third choice, you may need to restrict access to your Amazon S3 bucket or to your custom origin so users can’t perform operations that you don’t want them to. For example, you might not want users to have permissions to delete objects from your origin.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-allowedmethods

cache_policy_id

The unique identifier of the cache policy that is attached to this cache behavior.

For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide .

A CacheBehavior must include either a CachePolicyId or ForwardedValues . We recommend that you use a CachePolicyId .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-cachepolicyid

cached_methods

A complex type that controls whether CloudFront caches the response to requests using the specified HTTP methods.

There are two choices:

  • CloudFront caches responses to GET and HEAD requests.

  • CloudFront caches responses to GET , HEAD , and OPTIONS requests.

If you pick the second choice for your Amazon S3 Origin, you may need to forward Access-Control-Request-Method, Access-Control-Request-Headers, and Origin headers for the responses to be cached correctly.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-cachedmethods

compress

Whether you want CloudFront to automatically compress certain files for this cache behavior.

If so, specify true; if not, specify false. For more information, see Serving Compressed Files in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-compress

default_ttl

This field is deprecated.

We recommend that you use the DefaultTTL field in a cache policy instead of this field. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide .

The default amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin does not add HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-defaultttl

field_level_encryption_id

The value of ID for the field-level encryption configuration that you want CloudFront to use for encrypting specific fields of data for this cache behavior.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-fieldlevelencryptionid

forwarded_values

This field is deprecated.

We recommend that you use a cache policy or an origin request policy instead of this field. For more information, see Working with policies in the Amazon CloudFront Developer Guide .

If you want to include values in the cache key, use a cache policy. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide .

If you want to send values to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies or Using the managed origin request policies in the Amazon CloudFront Developer Guide .

A CacheBehavior must include either a CachePolicyId or ForwardedValues . We recommend that you use a CachePolicyId .

A complex type that specifies how CloudFront handles query strings, cookies, and HTTP headers.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-forwardedvalues

function_associations

A list of CloudFront functions that are associated with this cache behavior.

CloudFront functions must be published to the LIVE stage to associate them with a cache behavior.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-functionassociations

lambda_function_associations

A complex type that contains zero or more Lambda@Edge function associations for a cache behavior.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-lambdafunctionassociations

max_ttl

This field is deprecated.

We recommend that you use the MaxTTL field in a cache policy instead of this field. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide .

The maximum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin adds HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-maxttl

min_ttl

This field is deprecated.

We recommend that you use the MinTTL field in a cache policy instead of this field. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide .

The minimum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide .

You must specify 0 for MinTTL if you configure CloudFront to forward all headers to your origin (under Headers , if you specify 1 for Quantity and * for Name ).

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-minttl

origin_request_policy_id

The unique identifier of the origin request policy that is attached to this cache behavior.

For more information, see Creating origin request policies or Using the managed origin request policies in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-originrequestpolicyid

path_pattern

The pattern (for example, images/*.jpg ) that specifies which requests to apply the behavior to. When CloudFront receives a viewer request, the requested path is compared with path patterns in the order in which cache behaviors are listed in the distribution.

You can optionally include a slash ( / ) at the beginning of the path pattern. For example, /images/*.jpg . CloudFront behavior is the same with or without the leading / .

The path pattern for the default cache behavior is * and cannot be changed. If the request for an object does not match the path pattern for any cache behaviors, CloudFront applies the behavior in the default cache behavior.

For more information, see Path Pattern in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-pathpattern

realtime_log_config_arn

The Amazon Resource Name (ARN) of the real-time log configuration that is attached to this cache behavior.

For more information, see Real-time logs in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-realtimelogconfigarn

response_headers_policy_id

The identifier for a response headers policy.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-responseheaderspolicyid

smooth_streaming

Indicates whether you want to distribute media files in the Microsoft Smooth Streaming format using the origin that is associated with this cache behavior.

If so, specify true ; if not, specify false . If you specify true for SmoothStreaming , you can still distribute other content using this cache behavior if the content matches the value of PathPattern .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-smoothstreaming

target_origin_id

The value of ID for the origin that you want CloudFront to route requests to when they match this cache behavior.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-targetoriginid

trusted_key_groups

A list of key groups that CloudFront can use to validate signed URLs or signed cookies.

When a cache behavior contains trusted key groups, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with a private key whose corresponding public key is in the key group. The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see Serving private content in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-trustedkeygroups

trusted_signers

We recommend using TrustedKeyGroups instead of TrustedSigners .

A list of AWS account IDs whose public keys CloudFront can use to validate signed URLs or signed cookies.

When a cache behavior contains trusted signers, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with the private key of a CloudFront key pair in the trusted signer’s AWS account . The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see Serving private content in the Amazon CloudFront Developer Guide .

link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-trustedsigners

viewer_protocol_policy

The protocol that viewers can use to access the files in the origin specified by TargetOriginId when a request matches the path pattern in PathPattern .

You can specify the following options:

  • allow-all : Viewers can use HTTP or HTTPS.

  • redirect-to-https : If a viewer submits an HTTP request, CloudFront returns an HTTP status code of 301 (Moved Permanently) to the viewer along with the HTTPS URL. The viewer then resubmits the request using the new URL.

  • https-only : If a viewer sends an HTTP request, CloudFront returns an HTTP status code of 403 (Forbidden).

For more information about requiring the HTTPS protocol, see Requiring HTTPS Between Viewers and CloudFront in the Amazon CloudFront Developer Guide . .. epigraph:

The only way to guarantee that viewers retrieve an object that was fetched from the origin using HTTPS is never to use any other protocol to fetch the object. If you have recently changed from HTTP to HTTPS, we recommend that you clear your objects' cache because cached objects are protocol agnostic. That means that an edge location will return an object from the cache regardless of whether the current request protocol matches the protocol used previously. For more information, see `Managing Cache Expiration <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* .
Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-viewerprotocolpolicy

CookiesProperty

class CfnDistribution.CookiesProperty(*, forward, whitelisted_names=None)

Bases: object

This field is deprecated.

We recommend that you use a cache policy or an origin request policy instead of this field.

If you want to include cookies in the cache key, use a cache policy. For more information, see Creating cache policies in the Amazon CloudFront Developer Guide .

If you want to send cookies to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies in the Amazon CloudFront Developer Guide .

A complex type that specifies whether you want CloudFront to forward cookies to the origin and, if so, which ones. For more information about forwarding cookies to the origin, see How CloudFront Forwards, Caches, and Logs Cookies in the Amazon CloudFront Developer Guide .

Parameters:
  • forward (str) –

    This field is deprecated. We recommend that you use a cache policy or an origin request policy instead of this field. If you want to include cookies in the cache key, use a cache policy. For more information, see Creating cache policies in the Amazon CloudFront Developer Guide . If you want to send cookies to the origin but not include them in the cache key, use origin request policy. For more information, see Creating origin request policies in the Amazon CloudFront Developer Guide . Specifies which cookies to forward to the origin for this cache behavior: all, none, or the list of cookies specified in the WhitelistedNames complex type. Amazon S3 doesn’t process cookies. When the cache behavior is forwarding requests to an Amazon S3 origin, specify none for the Forward element.

  • whitelisted_names (Optional[Sequence[str]]) –

    This field is deprecated. We recommend that you use a cache policy or an origin request policy instead of this field. If you want to include cookies in the cache key, use a cache policy. For more information, see Creating cache policies in the Amazon CloudFront Developer Guide . If you want to send cookies to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies in the Amazon CloudFront Developer Guide . Required if you specify whitelist for the value of Forward . A complex type that specifies how many different cookies you want CloudFront to forward to the origin for this cache behavior and, if you want to forward selected cookies, the names of those cookies. If you specify all or none for the value of Forward , omit WhitelistedNames . If you change the value of Forward from whitelist to all or none and you don’t delete the WhitelistedNames element and its child elements, CloudFront deletes them automatically. For the current limit on the number of cookie names that you can whitelist for each cache behavior, see CloudFront Limits in the AWS General Reference .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cookies.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

cookies_property = cloudfront.CfnDistribution.CookiesProperty(
    forward="forward",

    # the properties below are optional
    whitelisted_names=["whitelistedNames"]
)

Attributes

forward

This field is deprecated.

We recommend that you use a cache policy or an origin request policy instead of this field.

If you want to include cookies in the cache key, use a cache policy. For more information, see Creating cache policies in the Amazon CloudFront Developer Guide .

If you want to send cookies to the origin but not include them in the cache key, use origin request policy. For more information, see Creating origin request policies in the Amazon CloudFront Developer Guide .

Specifies which cookies to forward to the origin for this cache behavior: all, none, or the list of cookies specified in the WhitelistedNames complex type.

Amazon S3 doesn’t process cookies. When the cache behavior is forwarding requests to an Amazon S3 origin, specify none for the Forward element.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cookies.html#cfn-cloudfront-distribution-cookies-forward

whitelisted_names

This field is deprecated.

We recommend that you use a cache policy or an origin request policy instead of this field.

If you want to include cookies in the cache key, use a cache policy. For more information, see Creating cache policies in the Amazon CloudFront Developer Guide .

If you want to send cookies to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies in the Amazon CloudFront Developer Guide .

Required if you specify whitelist for the value of Forward . A complex type that specifies how many different cookies you want CloudFront to forward to the origin for this cache behavior and, if you want to forward selected cookies, the names of those cookies.

If you specify all or none for the value of Forward , omit WhitelistedNames . If you change the value of Forward from whitelist to all or none and you don’t delete the WhitelistedNames element and its child elements, CloudFront deletes them automatically.

For the current limit on the number of cookie names that you can whitelist for each cache behavior, see CloudFront Limits in the AWS General Reference .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cookies.html#cfn-cloudfront-distribution-cookies-whitelistednames

CustomErrorResponseProperty

class CfnDistribution.CustomErrorResponseProperty(*, error_code, error_caching_min_ttl=None, response_code=None, response_page_path=None)

Bases: object

A complex type that controls:.

  • Whether CloudFront replaces HTTP status codes in the 4xx and 5xx range with custom error messages before returning the response to the viewer.

  • How long CloudFront caches HTTP status codes in the 4xx and 5xx range.

For more information about custom error pages, see Customizing Error Responses in the Amazon CloudFront Developer Guide .

Parameters:
  • error_code (Union[int, float]) – The HTTP status code for which you want to specify a custom error page and/or a caching duration.

  • error_caching_min_ttl (Union[int, float, None]) –

    The minimum amount of time, in seconds, that you want CloudFront to cache the HTTP status code specified in ErrorCode . When this time period has elapsed, CloudFront queries your origin to see whether the problem that caused the error has been resolved and the requested object is now available. For more information, see Customizing Error Responses in the Amazon CloudFront Developer Guide .

  • response_code (Union[int, float, None]) – The HTTP status code that you want CloudFront to return to the viewer along with the custom error page. There are a variety of reasons that you might want CloudFront to return a status code different from the status code that your origin returned to CloudFront, for example: - Some Internet devices (some firewalls and corporate proxies, for example) intercept HTTP 4xx and 5xx and prevent the response from being returned to the viewer. If you substitute 200 , the response typically won’t be intercepted. - If you don’t care about distinguishing among different client errors or server errors, you can specify 400 or 500 as the ResponseCode for all 4xx or 5xx errors. - You might want to return a 200 status code (OK) and static website so your customers don’t know that your website is down. If you specify a value for ResponseCode , you must also specify a value for ResponsePagePath .

  • response_page_path (Optional[str]) – The path to the custom error page that you want CloudFront to return to a viewer when your origin returns the HTTP status code specified by ErrorCode , for example, /4xx-errors/403-forbidden.html . If you want to store your objects and your custom error pages in different locations, your distribution must include a cache behavior for which the following is true:. - The value of PathPattern matches the path to your custom error messages. For example, suppose you saved custom error pages for 4xx errors in an Amazon S3 bucket in a directory named /4xx-errors . Your distribution must include a cache behavior for which the path pattern routes requests for your custom error pages to that location, for example, /4xx-errors/* . - The value of TargetOriginId specifies the value of the ID element for the origin that contains your custom error pages. If you specify a value for ResponsePagePath , you must also specify a value for ResponseCode . We recommend that you store custom error pages in an Amazon S3 bucket. If you store custom error pages on an HTTP server and the server starts to return 5xx errors, CloudFront can’t get the files that you want to return to viewers because the origin server is unavailable.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customerrorresponse.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

custom_error_response_property = cloudfront.CfnDistribution.CustomErrorResponseProperty(
    error_code=123,

    # the properties below are optional
    error_caching_min_ttl=123,
    response_code=123,
    response_page_path="responsePagePath"
)

Attributes

error_caching_min_ttl

The minimum amount of time, in seconds, that you want CloudFront to cache the HTTP status code specified in ErrorCode .

When this time period has elapsed, CloudFront queries your origin to see whether the problem that caused the error has been resolved and the requested object is now available.

For more information, see Customizing Error Responses in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customerrorresponse.html#cfn-cloudfront-distribution-customerrorresponse-errorcachingminttl

error_code

The HTTP status code for which you want to specify a custom error page and/or a caching duration.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customerrorresponse.html#cfn-cloudfront-distribution-customerrorresponse-errorcode

response_code

The HTTP status code that you want CloudFront to return to the viewer along with the custom error page.

There are a variety of reasons that you might want CloudFront to return a status code different from the status code that your origin returned to CloudFront, for example:

  • Some Internet devices (some firewalls and corporate proxies, for example) intercept HTTP 4xx and 5xx and prevent the response from being returned to the viewer. If you substitute 200 , the response typically won’t be intercepted.

  • If you don’t care about distinguishing among different client errors or server errors, you can specify 400 or 500 as the ResponseCode for all 4xx or 5xx errors.

  • You might want to return a 200 status code (OK) and static website so your customers don’t know that your website is down.

If you specify a value for ResponseCode , you must also specify a value for ResponsePagePath .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customerrorresponse.html#cfn-cloudfront-distribution-customerrorresponse-responsecode

response_page_path

.

  • The value of PathPattern matches the path to your custom error messages. For example, suppose you saved custom error pages for 4xx errors in an Amazon S3 bucket in a directory named /4xx-errors . Your distribution must include a cache behavior for which the path pattern routes requests for your custom error pages to that location, for example, /4xx-errors/* .

  • The value of TargetOriginId specifies the value of the ID element for the origin that contains your custom error pages.

If you specify a value for ResponsePagePath , you must also specify a value for ResponseCode .

We recommend that you store custom error pages in an Amazon S3 bucket. If you store custom error pages on an HTTP server and the server starts to return 5xx errors, CloudFront can’t get the files that you want to return to viewers because the origin server is unavailable.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customerrorresponse.html#cfn-cloudfront-distribution-customerrorresponse-responsepagepath

Type:

The path to the custom error page that you want CloudFront to return to a viewer when your origin returns the HTTP status code specified by ErrorCode , for example, /4xx-errors/403-forbidden.html . If you want to store your objects and your custom error pages in different locations, your distribution must include a cache behavior for which the following is true

CustomOriginConfigProperty

class CfnDistribution.CustomOriginConfigProperty(*, origin_protocol_policy, http_port=None, https_port=None, origin_keepalive_timeout=None, origin_read_timeout=None, origin_ssl_protocols=None)

Bases: object

A custom origin.

A custom origin is any origin that is not an Amazon S3 bucket, with one exception. An Amazon S3 bucket that is configured with static website hosting is a custom origin.

Parameters:
  • origin_protocol_policy (str) – Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. Valid values are:. - http-only – CloudFront always uses HTTP to connect to the origin. - match-viewer – CloudFront connects to the origin using the same protocol that the viewer used to connect to CloudFront. - https-only – CloudFront always uses HTTPS to connect to the origin.

  • http_port (Union[int, float, None]) – The HTTP port that CloudFront uses to connect to the origin. Specify the HTTP port that the origin listens on.

  • https_port (Union[int, float, None]) – The HTTPS port that CloudFront uses to connect to the origin. Specify the HTTPS port that the origin listens on.

  • origin_keepalive_timeout (Union[int, float, None]) – Specifies how long, in seconds, CloudFront persists its connection to the origin. The minimum timeout is 1 second, the maximum is 60 seconds, and the default (if you don’t specify otherwise) is 5 seconds. For more information, see Origin Keep-alive Timeout in the Amazon CloudFront Developer Guide .

  • origin_read_timeout (Union[int, float, None]) – Specifies how long, in seconds, CloudFront waits for a response from the origin. This is also known as the origin response timeout . The minimum timeout is 1 second, the maximum is 60 seconds, and the default (if you don’t specify otherwise) is 30 seconds. For more information, see Origin Response Timeout in the Amazon CloudFront Developer Guide .

  • origin_ssl_protocols (Optional[Sequence[str]]) – Specifies the minimum SSL/TLS protocol that CloudFront uses when connecting to your origin over HTTPS. Valid values include SSLv3 , TLSv1 , TLSv1.1 , and TLSv1.2 . For more information, see Minimum Origin SSL Protocol in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customoriginconfig.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

custom_origin_config_property = cloudfront.CfnDistribution.CustomOriginConfigProperty(
    origin_protocol_policy="originProtocolPolicy",

    # the properties below are optional
    http_port=123,
    https_port=123,
    origin_keepalive_timeout=123,
    origin_read_timeout=123,
    origin_ssl_protocols=["originSslProtocols"]
)

Attributes

http_port

The HTTP port that CloudFront uses to connect to the origin.

Specify the HTTP port that the origin listens on.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customoriginconfig.html#cfn-cloudfront-distribution-customoriginconfig-httpport

https_port

The HTTPS port that CloudFront uses to connect to the origin.

Specify the HTTPS port that the origin listens on.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customoriginconfig.html#cfn-cloudfront-distribution-customoriginconfig-httpsport

origin_keepalive_timeout

Specifies how long, in seconds, CloudFront persists its connection to the origin.

The minimum timeout is 1 second, the maximum is 60 seconds, and the default (if you don’t specify otherwise) is 5 seconds.

For more information, see Origin Keep-alive Timeout in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customoriginconfig.html#cfn-cloudfront-distribution-customoriginconfig-originkeepalivetimeout

origin_protocol_policy

.

  • http-only – CloudFront always uses HTTP to connect to the origin.

  • match-viewer – CloudFront connects to the origin using the same protocol that the viewer used to connect to CloudFront.

  • https-only – CloudFront always uses HTTPS to connect to the origin.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customoriginconfig.html#cfn-cloudfront-distribution-customoriginconfig-originprotocolpolicy

Type:

Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. Valid values are

origin_read_timeout

Specifies how long, in seconds, CloudFront waits for a response from the origin.

This is also known as the origin response timeout . The minimum timeout is 1 second, the maximum is 60 seconds, and the default (if you don’t specify otherwise) is 30 seconds.

For more information, see Origin Response Timeout in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customoriginconfig.html#cfn-cloudfront-distribution-customoriginconfig-originreadtimeout

origin_ssl_protocols

Specifies the minimum SSL/TLS protocol that CloudFront uses when connecting to your origin over HTTPS.

Valid values include SSLv3 , TLSv1 , TLSv1.1 , and TLSv1.2 .

For more information, see Minimum Origin SSL Protocol in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customoriginconfig.html#cfn-cloudfront-distribution-customoriginconfig-originsslprotocols

DefaultCacheBehaviorProperty

class CfnDistribution.DefaultCacheBehaviorProperty(*, target_origin_id, viewer_protocol_policy, allowed_methods=None, cached_methods=None, cache_policy_id=None, compress=None, default_ttl=None, field_level_encryption_id=None, forwarded_values=None, function_associations=None, lambda_function_associations=None, max_ttl=None, min_ttl=None, origin_request_policy_id=None, realtime_log_config_arn=None, response_headers_policy_id=None, smooth_streaming=None, trusted_key_groups=None, trusted_signers=None)

Bases: object

A complex type that describes the default cache behavior if you don’t specify a CacheBehavior element or if request URLs don’t match any of the values of PathPattern in CacheBehavior elements.

You must create exactly one default cache behavior.

Parameters:
  • target_origin_id (str) – The value of ID for the origin that you want CloudFront to route requests to when they use the default cache behavior.

  • viewer_protocol_policy (str) –

    The protocol that viewers can use to access the files in the origin specified by TargetOriginId when a request matches the path pattern in PathPattern . You can specify the following options: - allow-all : Viewers can use HTTP or HTTPS. - redirect-to-https : If a viewer submits an HTTP request, CloudFront returns an HTTP status code of 301 (Moved Permanently) to the viewer along with the HTTPS URL. The viewer then resubmits the request using the new URL. - https-only : If a viewer sends an HTTP request, CloudFront returns an HTTP status code of 403 (Forbidden). For more information about requiring the HTTPS protocol, see Requiring HTTPS Between Viewers and CloudFront in the Amazon CloudFront Developer Guide . .. epigraph:: The only way to guarantee that viewers retrieve an object that was fetched from the origin using HTTPS is never to use any other protocol to fetch the object. If you have recently changed from HTTP to HTTPS, we recommend that you clear your objects’ cache because cached objects are protocol agnostic. That means that an edge location will return an object from the cache regardless of whether the current request protocol matches the protocol used previously. For more information, see Managing Cache Expiration in the Amazon CloudFront Developer Guide .

  • allowed_methods (Optional[Sequence[str]]) – A complex type that controls which HTTP methods CloudFront processes and forwards to your Amazon S3 bucket or your custom origin. There are three choices: - CloudFront forwards only GET and HEAD requests. - CloudFront forwards only GET , HEAD , and OPTIONS requests. - CloudFront forwards GET, HEAD, OPTIONS, PUT, PATCH, POST , and DELETE requests. If you pick the third choice, you may need to restrict access to your Amazon S3 bucket or to your custom origin so users can’t perform operations that you don’t want them to. For example, you might not want users to have permissions to delete objects from your origin.

  • cached_methods (Optional[Sequence[str]]) – A complex type that controls whether CloudFront caches the response to requests using the specified HTTP methods. There are two choices: - CloudFront caches responses to GET and HEAD requests. - CloudFront caches responses to GET , HEAD , and OPTIONS requests. If you pick the second choice for your Amazon S3 Origin, you may need to forward Access-Control-Request-Method, Access-Control-Request-Headers, and Origin headers for the responses to be cached correctly.

  • cache_policy_id (Optional[str]) –

    The unique identifier of the cache policy that is attached to the default cache behavior. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide . A DefaultCacheBehavior must include either a CachePolicyId or ForwardedValues . We recommend that you use a CachePolicyId .

  • compress (Union[bool, IResolvable, None]) –

    Whether you want CloudFront to automatically compress certain files for this cache behavior. If so, specify true ; if not, specify false . For more information, see Serving Compressed Files in the Amazon CloudFront Developer Guide .

  • default_ttl (Union[int, float, None]) –

    This field is deprecated. We recommend that you use the DefaultTTL field in a cache policy instead of this field. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide . The default amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin does not add HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide .

  • field_level_encryption_id (Optional[str]) – The value of ID for the field-level encryption configuration that you want CloudFront to use for encrypting specific fields of data for the default cache behavior.

  • forwarded_values (Union[ForwardedValuesProperty, Dict[str, Any], IResolvable, None]) –

    This field is deprecated. We recommend that you use a cache policy or an origin request policy instead of this field. For more information, see Working with policies in the Amazon CloudFront Developer Guide . If you want to include values in the cache key, use a cache policy. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide . If you want to send values to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies or Using the managed origin request policies in the Amazon CloudFront Developer Guide . A DefaultCacheBehavior must include either a CachePolicyId or ForwardedValues . We recommend that you use a CachePolicyId . A complex type that specifies how CloudFront handles query strings, cookies, and HTTP headers.

  • function_associations (Union[IResolvable, Sequence[Union[IResolvable, FunctionAssociationProperty, Dict[str, Any]]], None]) – A list of CloudFront functions that are associated with this cache behavior. CloudFront functions must be published to the LIVE stage to associate them with a cache behavior.

  • lambda_function_associations (Union[IResolvable, Sequence[Union[IResolvable, LambdaFunctionAssociationProperty, Dict[str, Any]]], None]) – A complex type that contains zero or more Lambda@Edge function associations for a cache behavior.

  • max_ttl (Union[int, float, None]) –

    This field is deprecated. We recommend that you use the MaxTTL field in a cache policy instead of this field. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide . The maximum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin adds HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide .

  • min_ttl (Union[int, float, None]) –

    This field is deprecated. We recommend that you use the MinTTL field in a cache policy instead of this field. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide . The minimum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide . You must specify 0 for MinTTL if you configure CloudFront to forward all headers to your origin (under Headers , if you specify 1 for Quantity and * for Name ).

  • origin_request_policy_id (Optional[str]) –

    The unique identifier of the origin request policy that is attached to the default cache behavior. For more information, see Creating origin request policies or Using the managed origin request policies in the Amazon CloudFront Developer Guide .

  • realtime_log_config_arn (Optional[str]) –

    The Amazon Resource Name (ARN) of the real-time log configuration that is attached to this cache behavior. For more information, see Real-time logs in the Amazon CloudFront Developer Guide .

  • response_headers_policy_id (Optional[str]) – The identifier for a response headers policy.

  • smooth_streaming (Union[bool, IResolvable, None]) – Indicates whether you want to distribute media files in the Microsoft Smooth Streaming format using the origin that is associated with this cache behavior. If so, specify true ; if not, specify false . If you specify true for SmoothStreaming , you can still distribute other content using this cache behavior if the content matches the value of PathPattern .

  • trusted_key_groups (Optional[Sequence[str]]) –

    A list of key groups that CloudFront can use to validate signed URLs or signed cookies. When a cache behavior contains trusted key groups, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with a private key whose corresponding public key is in the key group. The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see Serving private content in the Amazon CloudFront Developer Guide .

  • trusted_signers (Optional[Sequence[str]]) –

    We recommend using TrustedKeyGroups instead of TrustedSigners . A list of AWS account IDs whose public keys CloudFront can use to validate signed URLs or signed cookies. When a cache behavior contains trusted signers, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with the private key of a CloudFront key pair in a trusted signer’s AWS account . The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see Serving private content in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

default_cache_behavior_property = cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
    target_origin_id="targetOriginId",
    viewer_protocol_policy="viewerProtocolPolicy",

    # the properties below are optional
    allowed_methods=["allowedMethods"],
    cached_methods=["cachedMethods"],
    cache_policy_id="cachePolicyId",
    compress=False,
    default_ttl=123,
    field_level_encryption_id="fieldLevelEncryptionId",
    forwarded_values=cloudfront.CfnDistribution.ForwardedValuesProperty(
        query_string=False,

        # the properties below are optional
        cookies=cloudfront.CfnDistribution.CookiesProperty(
            forward="forward",

            # the properties below are optional
            whitelisted_names=["whitelistedNames"]
        ),
        headers=["headers"],
        query_string_cache_keys=["queryStringCacheKeys"]
    ),
    function_associations=[cloudfront.CfnDistribution.FunctionAssociationProperty(
        event_type="eventType",
        function_arn="functionArn"
    )],
    lambda_function_associations=[cloudfront.CfnDistribution.LambdaFunctionAssociationProperty(
        event_type="eventType",
        include_body=False,
        lambda_function_arn="lambdaFunctionArn"
    )],
    max_ttl=123,
    min_ttl=123,
    origin_request_policy_id="originRequestPolicyId",
    realtime_log_config_arn="realtimeLogConfigArn",
    response_headers_policy_id="responseHeadersPolicyId",
    smooth_streaming=False,
    trusted_key_groups=["trustedKeyGroups"],
    trusted_signers=["trustedSigners"]
)

Attributes

allowed_methods

A complex type that controls which HTTP methods CloudFront processes and forwards to your Amazon S3 bucket or your custom origin.

There are three choices:

  • CloudFront forwards only GET and HEAD requests.

  • CloudFront forwards only GET , HEAD , and OPTIONS requests.

  • CloudFront forwards GET, HEAD, OPTIONS, PUT, PATCH, POST , and DELETE requests.

If you pick the third choice, you may need to restrict access to your Amazon S3 bucket or to your custom origin so users can’t perform operations that you don’t want them to. For example, you might not want users to have permissions to delete objects from your origin.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-allowedmethods

cache_policy_id

The unique identifier of the cache policy that is attached to the default cache behavior.

For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide .

A DefaultCacheBehavior must include either a CachePolicyId or ForwardedValues . We recommend that you use a CachePolicyId .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-cachepolicyid

cached_methods

A complex type that controls whether CloudFront caches the response to requests using the specified HTTP methods.

There are two choices:

  • CloudFront caches responses to GET and HEAD requests.

  • CloudFront caches responses to GET , HEAD , and OPTIONS requests.

If you pick the second choice for your Amazon S3 Origin, you may need to forward Access-Control-Request-Method, Access-Control-Request-Headers, and Origin headers for the responses to be cached correctly.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-cachedmethods

compress

Whether you want CloudFront to automatically compress certain files for this cache behavior.

If so, specify true ; if not, specify false . For more information, see Serving Compressed Files in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-compress

default_ttl

This field is deprecated.

We recommend that you use the DefaultTTL field in a cache policy instead of this field. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide .

The default amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin does not add HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-defaultttl

field_level_encryption_id

The value of ID for the field-level encryption configuration that you want CloudFront to use for encrypting specific fields of data for the default cache behavior.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-fieldlevelencryptionid

forwarded_values

This field is deprecated.

We recommend that you use a cache policy or an origin request policy instead of this field. For more information, see Working with policies in the Amazon CloudFront Developer Guide .

If you want to include values in the cache key, use a cache policy. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide .

If you want to send values to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies or Using the managed origin request policies in the Amazon CloudFront Developer Guide .

A DefaultCacheBehavior must include either a CachePolicyId or ForwardedValues . We recommend that you use a CachePolicyId .

A complex type that specifies how CloudFront handles query strings, cookies, and HTTP headers.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-forwardedvalues

function_associations

A list of CloudFront functions that are associated with this cache behavior.

CloudFront functions must be published to the LIVE stage to associate them with a cache behavior.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-functionassociations

lambda_function_associations

A complex type that contains zero or more Lambda@Edge function associations for a cache behavior.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-lambdafunctionassociations

max_ttl

This field is deprecated.

We recommend that you use the MaxTTL field in a cache policy instead of this field. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide .

The maximum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. The value that you specify applies only when your origin adds HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-maxttl

min_ttl

This field is deprecated.

We recommend that you use the MinTTL field in a cache policy instead of this field. For more information, see Creating cache policies or Using the managed cache policies in the Amazon CloudFront Developer Guide .

The minimum amount of time that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide .

You must specify 0 for MinTTL if you configure CloudFront to forward all headers to your origin (under Headers , if you specify 1 for Quantity and * for Name ).

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-minttl

origin_request_policy_id

The unique identifier of the origin request policy that is attached to the default cache behavior.

For more information, see Creating origin request policies or Using the managed origin request policies in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-originrequestpolicyid

realtime_log_config_arn

The Amazon Resource Name (ARN) of the real-time log configuration that is attached to this cache behavior.

For more information, see Real-time logs in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-realtimelogconfigarn

response_headers_policy_id

The identifier for a response headers policy.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-responseheaderspolicyid

smooth_streaming

Indicates whether you want to distribute media files in the Microsoft Smooth Streaming format using the origin that is associated with this cache behavior.

If so, specify true ; if not, specify false . If you specify true for SmoothStreaming , you can still distribute other content using this cache behavior if the content matches the value of PathPattern .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-smoothstreaming

target_origin_id

The value of ID for the origin that you want CloudFront to route requests to when they use the default cache behavior.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-targetoriginid

trusted_key_groups

A list of key groups that CloudFront can use to validate signed URLs or signed cookies.

When a cache behavior contains trusted key groups, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with a private key whose corresponding public key is in the key group. The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see Serving private content in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-trustedkeygroups

trusted_signers

We recommend using TrustedKeyGroups instead of TrustedSigners .

A list of AWS account IDs whose public keys CloudFront can use to validate signed URLs or signed cookies.

When a cache behavior contains trusted signers, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with the private key of a CloudFront key pair in a trusted signer’s AWS account . The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see Serving private content in the Amazon CloudFront Developer Guide .

link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-trustedsigners

viewer_protocol_policy

The protocol that viewers can use to access the files in the origin specified by TargetOriginId when a request matches the path pattern in PathPattern .

You can specify the following options:

  • allow-all : Viewers can use HTTP or HTTPS.

  • redirect-to-https : If a viewer submits an HTTP request, CloudFront returns an HTTP status code of 301 (Moved Permanently) to the viewer along with the HTTPS URL. The viewer then resubmits the request using the new URL.

  • https-only : If a viewer sends an HTTP request, CloudFront returns an HTTP status code of 403 (Forbidden).

For more information about requiring the HTTPS protocol, see Requiring HTTPS Between Viewers and CloudFront in the Amazon CloudFront Developer Guide . .. epigraph:

The only way to guarantee that viewers retrieve an object that was fetched from the origin using HTTPS is never to use any other protocol to fetch the object. If you have recently changed from HTTP to HTTPS, we recommend that you clear your objects' cache because cached objects are protocol agnostic. That means that an edge location will return an object from the cache regardless of whether the current request protocol matches the protocol used previously. For more information, see `Managing Cache Expiration <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html>`_ in the *Amazon CloudFront Developer Guide* .
Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-viewerprotocolpolicy

DistributionConfigProperty

class CfnDistribution.DistributionConfigProperty(*, default_cache_behavior, enabled, aliases=None, cache_behaviors=None, cnam_es=None, comment=None, continuous_deployment_policy_id=None, custom_error_responses=None, custom_origin=None, default_root_object=None, http_version=None, ipv6_enabled=None, logging=None, origin_groups=None, origins=None, price_class=None, restrictions=None, s3_origin=None, staging=None, viewer_certificate=None, web_acl_id=None)

Bases: object

A distribution configuration.

Parameters:
  • default_cache_behavior (Union[IResolvable, DefaultCacheBehaviorProperty, Dict[str, Any]]) – A complex type that describes the default cache behavior if you don’t specify a CacheBehavior element or if files don’t match any of the values of PathPattern in CacheBehavior elements. You must create exactly one default cache behavior.

  • enabled (Union[bool, IResolvable]) – From this field, you can enable or disable the selected distribution.

  • aliases (Optional[Sequence[str]]) – A complex type that contains information about CNAMEs (alternate domain names), if any, for this distribution.

  • cache_behaviors (Union[IResolvable, Sequence[Union[IResolvable, CacheBehaviorProperty, Dict[str, Any]]], None]) – A complex type that contains zero or more CacheBehavior elements.

  • cnam_es (Optional[Sequence[str]]) – CfnDistribution.DistributionConfigProperty.CNAMEs.

  • comment (Optional[str]) – A comment to describe the distribution. The comment cannot be longer than 128 characters.

  • continuous_deployment_policy_id (Optional[str]) – The identifier of a continuous deployment policy. For more information, see CreateContinuousDeploymentPolicy .

  • custom_error_responses (Union[IResolvable, Sequence[Union[IResolvable, CustomErrorResponseProperty, Dict[str, Any]]], None]) –

    A complex type that controls the following:. - Whether CloudFront replaces HTTP status codes in the 4xx and 5xx range with custom error messages before returning the response to the viewer. - How long CloudFront caches HTTP status codes in the 4xx and 5xx range. For more information about custom error pages, see Customizing Error Responses in the Amazon CloudFront Developer Guide .

  • custom_origin (Union[IResolvable, LegacyCustomOriginProperty, Dict[str, Any], None]) – CfnDistribution.DistributionConfigProperty.CustomOrigin.

  • default_root_object (Optional[str]) – 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 ( https://www.example.com ) instead of an object in your distribution ( https://www.example.com/product-description.html ). Specifying a default root object avoids exposing the contents of your distribution. Specify only the object name, for example, index.html . Don’t add a / before the object name. If you don’t want to specify a default root object when you create a distribution, include an empty DefaultRootObject element. To delete the default root object from an existing distribution, update the distribution configuration and include an empty DefaultRootObject element. To replace the default root object, update the distribution configuration and specify the new object. For more information about the default root object, see Creating a Default Root Object in the Amazon CloudFront Developer Guide .

  • http_version (Optional[str]) – (Optional) Specify the maximum HTTP version(s) that you want viewers to use to communicate with CloudFront . The default value for new distributions is http1.1 . For viewers and CloudFront to use HTTP/2, viewers must support TLSv1.2 or later, and must support Server Name Indication (SNI). For viewers and CloudFront to use HTTP/3, viewers must support TLSv1.3 and Server Name Indication (SNI). CloudFront supports HTTP/3 connection migration to allow the viewer to switch networks without losing connection. For more information about connection migration, see Connection Migration at RFC 9000. For more information about supported TLSv1.3 ciphers, see Supported protocols and ciphers between viewers and CloudFront .

  • ipv6_enabled (Union[bool, IResolvable, None]) – If you want CloudFront to respond to IPv6 DNS requests with an IPv6 address for your distribution, specify true . 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. In general, you should enable IPv6 if you have users on IPv6 networks who want to access your content. However, if you’re using signed URLs or signed cookies to restrict access to your content, and if you’re using a custom policy that includes the IpAddress parameter to restrict the IP addresses that can access your content, don’t enable IPv6. If you want to restrict access to some content by IP address and not restrict access to other content (or restrict access but not by IP address), you can create two distributions. For more information, see Creating a Signed URL Using a Custom Policy in the Amazon CloudFront Developer Guide . If you’re using an Amazon Route 53 AWS Integration alias resource record set to route traffic to your CloudFront distribution, you need to create a second alias resource record set when both of the following are true: - You enable IPv6 for the distribution - You’re using alternate domain names in the URLs for your objects For more information, see Routing Traffic to an Amazon CloudFront Web Distribution by Using Your Domain Name in the Amazon Route 53 AWS Integration Developer Guide . If you created a CNAME resource record set, either with Amazon Route 53 AWS Integration or with another DNS service, you don’t need to make any changes. A CNAME record will route traffic to your distribution regardless of the IP address format of the viewer request.

  • logging (Union[IResolvable, LoggingProperty, Dict[str, Any], None]) – A complex type that controls whether access logs are written for the distribution. For more information about logging, see Access Logs in the Amazon CloudFront Developer Guide .

  • origin_groups (Union[IResolvable, OriginGroupsProperty, Dict[str, Any], None]) – A complex type that contains information about origin groups for this distribution.

  • origins (Union[IResolvable, Sequence[Union[OriginProperty, Dict[str, Any], IResolvable]], None]) – A complex type that contains information about origins for this distribution.

  • price_class (Optional[str]) – 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. Viewers who are in or near regions that are excluded from your specified price class may encounter slower performance. For more information about price classes, see Choosing the Price Class for a CloudFront Distribution in the Amazon CloudFront Developer Guide . For information about CloudFront pricing, including how price classes (such as Price Class 100) map to CloudFront regions, see Amazon CloudFront Pricing .

  • restrictions (Union[IResolvable, RestrictionsProperty, Dict[str, Any], None]) – A complex type that identifies ways in which you want to restrict distribution of your content.

  • s3_origin (Union[IResolvable, LegacyS3OriginProperty, Dict[str, Any], None]) – CfnDistribution.DistributionConfigProperty.S3Origin.

  • staging (Union[bool, IResolvable, None]) – A Boolean that indicates whether this is a staging distribution. When this value is true , this is a staging distribution. When this value is false , this is not a staging distribution.

  • viewer_certificate (Union[ViewerCertificateProperty, Dict[str, Any], IResolvable, None]) – A complex type that determines the distribution’s SSL/TLS configuration for communicating with viewers.

  • web_acl_id (Optional[str]) – A unique identifier that specifies the AWS WAF web ACL, if any, to associate with this 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 . AWS WAF is a web application firewall that lets you monitor the HTTP and HTTPS requests that are forwarded to CloudFront, and lets you control access to your content. Based on conditions that you specify, such as the IP addresses that requests originate from or the values of query strings, CloudFront responds to requests either with the requested content or with an HTTP 403 status code (Forbidden). You can also configure CloudFront to return a custom error page when a request is blocked. For more information about AWS WAF , see the AWS WAF Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

distribution_config_property = cloudfront.CfnDistribution.DistributionConfigProperty(
    default_cache_behavior=cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
        target_origin_id="targetOriginId",
        viewer_protocol_policy="viewerProtocolPolicy",

        # the properties below are optional
        allowed_methods=["allowedMethods"],
        cached_methods=["cachedMethods"],
        cache_policy_id="cachePolicyId",
        compress=False,
        default_ttl=123,
        field_level_encryption_id="fieldLevelEncryptionId",
        forwarded_values=cloudfront.CfnDistribution.ForwardedValuesProperty(
            query_string=False,

            # the properties below are optional
            cookies=cloudfront.CfnDistribution.CookiesProperty(
                forward="forward",

                # the properties below are optional
                whitelisted_names=["whitelistedNames"]
            ),
            headers=["headers"],
            query_string_cache_keys=["queryStringCacheKeys"]
        ),
        function_associations=[cloudfront.CfnDistribution.FunctionAssociationProperty(
            event_type="eventType",
            function_arn="functionArn"
        )],
        lambda_function_associations=[cloudfront.CfnDistribution.LambdaFunctionAssociationProperty(
            event_type="eventType",
            include_body=False,
            lambda_function_arn="lambdaFunctionArn"
        )],
        max_ttl=123,
        min_ttl=123,
        origin_request_policy_id="originRequestPolicyId",
        realtime_log_config_arn="realtimeLogConfigArn",
        response_headers_policy_id="responseHeadersPolicyId",
        smooth_streaming=False,
        trusted_key_groups=["trustedKeyGroups"],
        trusted_signers=["trustedSigners"]
    ),
    enabled=False,

    # the properties below are optional
    aliases=["aliases"],
    cache_behaviors=[cloudfront.CfnDistribution.CacheBehaviorProperty(
        path_pattern="pathPattern",
        target_origin_id="targetOriginId",
        viewer_protocol_policy="viewerProtocolPolicy",

        # the properties below are optional
        allowed_methods=["allowedMethods"],
        cached_methods=["cachedMethods"],
        cache_policy_id="cachePolicyId",
        compress=False,
        default_ttl=123,
        field_level_encryption_id="fieldLevelEncryptionId",
        forwarded_values=cloudfront.CfnDistribution.ForwardedValuesProperty(
            query_string=False,

            # the properties below are optional
            cookies=cloudfront.CfnDistribution.CookiesProperty(
                forward="forward",

                # the properties below are optional
                whitelisted_names=["whitelistedNames"]
            ),
            headers=["headers"],
            query_string_cache_keys=["queryStringCacheKeys"]
        ),
        function_associations=[cloudfront.CfnDistribution.FunctionAssociationProperty(
            event_type="eventType",
            function_arn="functionArn"
        )],
        lambda_function_associations=[cloudfront.CfnDistribution.LambdaFunctionAssociationProperty(
            event_type="eventType",
            include_body=False,
            lambda_function_arn="lambdaFunctionArn"
        )],
        max_ttl=123,
        min_ttl=123,
        origin_request_policy_id="originRequestPolicyId",
        realtime_log_config_arn="realtimeLogConfigArn",
        response_headers_policy_id="responseHeadersPolicyId",
        smooth_streaming=False,
        trusted_key_groups=["trustedKeyGroups"],
        trusted_signers=["trustedSigners"]
    )],
    cnam_es=["cnamEs"],
    comment="comment",
    continuous_deployment_policy_id="continuousDeploymentPolicyId",
    custom_error_responses=[cloudfront.CfnDistribution.CustomErrorResponseProperty(
        error_code=123,

        # the properties below are optional
        error_caching_min_ttl=123,
        response_code=123,
        response_page_path="responsePagePath"
    )],
    custom_origin=cloudfront.CfnDistribution.LegacyCustomOriginProperty(
        dns_name="dnsName",
        origin_protocol_policy="originProtocolPolicy",
        origin_ssl_protocols=["originSslProtocols"],

        # the properties below are optional
        http_port=123,
        https_port=123
    ),
    default_root_object="defaultRootObject",
    http_version="httpVersion",
    ipv6_enabled=False,
    logging=cloudfront.CfnDistribution.LoggingProperty(
        bucket="bucket",

        # the properties below are optional
        include_cookies=False,
        prefix="prefix"
    ),
    origin_groups=cloudfront.CfnDistribution.OriginGroupsProperty(
        quantity=123,

        # the properties below are optional
        items=[cloudfront.CfnDistribution.OriginGroupProperty(
            failover_criteria=cloudfront.CfnDistribution.OriginGroupFailoverCriteriaProperty(
                status_codes=cloudfront.CfnDistribution.StatusCodesProperty(
                    items=[123],
                    quantity=123
                )
            ),
            id="id",
            members=cloudfront.CfnDistribution.OriginGroupMembersProperty(
                items=[cloudfront.CfnDistribution.OriginGroupMemberProperty(
                    origin_id="originId"
                )],
                quantity=123
            )
        )]
    ),
    origins=[cloudfront.CfnDistribution.OriginProperty(
        domain_name="domainName",
        id="id",

        # the properties below are optional
        connection_attempts=123,
        connection_timeout=123,
        custom_origin_config=cloudfront.CfnDistribution.CustomOriginConfigProperty(
            origin_protocol_policy="originProtocolPolicy",

            # the properties below are optional
            http_port=123,
            https_port=123,
            origin_keepalive_timeout=123,
            origin_read_timeout=123,
            origin_ssl_protocols=["originSslProtocols"]
        ),
        origin_access_control_id="originAccessControlId",
        origin_custom_headers=[cloudfront.CfnDistribution.OriginCustomHeaderProperty(
            header_name="headerName",
            header_value="headerValue"
        )],
        origin_path="originPath",
        origin_shield=cloudfront.CfnDistribution.OriginShieldProperty(
            enabled=False,
            origin_shield_region="originShieldRegion"
        ),
        s3_origin_config=cloudfront.CfnDistribution.S3OriginConfigProperty(
            origin_access_identity="originAccessIdentity"
        )
    )],
    price_class="priceClass",
    restrictions=cloudfront.CfnDistribution.RestrictionsProperty(
        geo_restriction=cloudfront.CfnDistribution.GeoRestrictionProperty(
            restriction_type="restrictionType",

            # the properties below are optional
            locations=["locations"]
        )
    ),
    s3_origin=cloudfront.CfnDistribution.LegacyS3OriginProperty(
        dns_name="dnsName",

        # the properties below are optional
        origin_access_identity="originAccessIdentity"
    ),
    staging=False,
    viewer_certificate=cloudfront.CfnDistribution.ViewerCertificateProperty(
        acm_certificate_arn="acmCertificateArn",
        cloud_front_default_certificate=False,
        iam_certificate_id="iamCertificateId",
        minimum_protocol_version="minimumProtocolVersion",
        ssl_support_method="sslSupportMethod"
    ),
    web_acl_id="webAclId"
)

Attributes

aliases

A complex type that contains information about CNAMEs (alternate domain names), if any, for this distribution.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-aliases

cache_behaviors

A complex type that contains zero or more CacheBehavior elements.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-cachebehaviors

cnam_es

CfnDistribution.DistributionConfigProperty.CNAMEs.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-cnames

comment

A comment to describe the distribution.

The comment cannot be longer than 128 characters.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-comment

continuous_deployment_policy_id

The identifier of a continuous deployment policy.

For more information, see CreateContinuousDeploymentPolicy .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-continuousdeploymentpolicyid

custom_error_responses

.

  • Whether CloudFront replaces HTTP status codes in the 4xx and 5xx range with custom error messages before returning the response to the viewer.

  • How long CloudFront caches HTTP status codes in the 4xx and 5xx range.

For more information about custom error pages, see Customizing Error Responses in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-customerrorresponses

Type:

A complex type that controls the following

custom_origin

CfnDistribution.DistributionConfigProperty.CustomOrigin.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-customorigin

default_cache_behavior

A complex type that describes the default cache behavior if you don’t specify a CacheBehavior element or if files don’t match any of the values of PathPattern in CacheBehavior elements.

You must create exactly one default cache behavior.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-defaultcachebehavior

default_root_object

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 ( https://www.example.com ) instead of an object in your distribution ( https://www.example.com/product-description.html ). Specifying a default root object avoids exposing the contents of your distribution.

Specify only the object name, for example, index.html . Don’t add a / before the object name.

If you don’t want to specify a default root object when you create a distribution, include an empty DefaultRootObject element.

To delete the default root object from an existing distribution, update the distribution configuration and include an empty DefaultRootObject element.

To replace the default root object, update the distribution configuration and specify the new object.

For more information about the default root object, see Creating a Default Root Object in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-defaultrootobject

enabled

From this field, you can enable or disable the selected distribution.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-enabled

http_version

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

The default value for new distributions is http1.1 .

For viewers and CloudFront to use HTTP/2, viewers must support TLSv1.2 or later, and must support Server Name Indication (SNI).

For viewers and CloudFront to use HTTP/3, viewers must support TLSv1.3 and Server Name Indication (SNI). CloudFront supports HTTP/3 connection migration to allow the viewer to switch networks without losing connection. For more information about connection migration, see Connection Migration at RFC 9000. For more information about supported TLSv1.3 ciphers, see Supported protocols and ciphers between viewers and CloudFront .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-httpversion

ipv6_enabled

If you want CloudFront to respond to IPv6 DNS requests with an IPv6 address for your distribution, specify true .

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.

In general, you should enable IPv6 if you have users on IPv6 networks who want to access your content. However, if you’re using signed URLs or signed cookies to restrict access to your content, and if you’re using a custom policy that includes the IpAddress parameter to restrict the IP addresses that can access your content, don’t enable IPv6. If you want to restrict access to some content by IP address and not restrict access to other content (or restrict access but not by IP address), you can create two distributions. For more information, see Creating a Signed URL Using a Custom Policy in the Amazon CloudFront Developer Guide .

If you’re using an Amazon Route 53 AWS Integration alias resource record set to route traffic to your CloudFront distribution, you need to create a second alias resource record set when both of the following are true:

  • You enable IPv6 for the distribution

  • You’re using alternate domain names in the URLs for your objects

For more information, see Routing Traffic to an Amazon CloudFront Web Distribution by Using Your Domain Name in the Amazon Route 53 AWS Integration Developer Guide .

If you created a CNAME resource record set, either with Amazon Route 53 AWS Integration or with another DNS service, you don’t need to make any changes. A CNAME record will route traffic to your distribution regardless of the IP address format of the viewer request.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-ipv6enabled

logging

A complex type that controls whether access logs are written for the distribution.

For more information about logging, see Access Logs in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-logging

origin_groups

A complex type that contains information about origin groups for this distribution.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-origingroups

origins

A complex type that contains information about origins for this distribution.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-origins

price_class

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. Viewers who are in or near regions that are excluded from your specified price class may encounter slower performance.

For more information about price classes, see Choosing the Price Class for a CloudFront Distribution in the Amazon CloudFront Developer Guide . For information about CloudFront pricing, including how price classes (such as Price Class 100) map to CloudFront regions, see Amazon CloudFront Pricing .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-priceclass

restrictions

A complex type that identifies ways in which you want to restrict distribution of your content.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-restrictions

s3_origin

CfnDistribution.DistributionConfigProperty.S3Origin.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-s3origin

staging

A Boolean that indicates whether this is a staging distribution.

When this value is true , this is a staging distribution. When this value is false , this is not a staging distribution.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-staging

viewer_certificate

A complex type that determines the distribution’s SSL/TLS configuration for communicating with viewers.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-viewercertificate

web_acl_id

A unique identifier that specifies the AWS WAF web ACL, if any, to associate with this 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 .

AWS WAF is a web application firewall that lets you monitor the HTTP and HTTPS requests that are forwarded to CloudFront, and lets you control access to your content. Based on conditions that you specify, such as the IP addresses that requests originate from or the values of query strings, CloudFront responds to requests either with the requested content or with an HTTP 403 status code (Forbidden). You can also configure CloudFront to return a custom error page when a request is blocked. For more information about AWS WAF , see the AWS WAF Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-webaclid

ForwardedValuesProperty

class CfnDistribution.ForwardedValuesProperty(*, query_string, cookies=None, headers=None, query_string_cache_keys=None)

Bases: object

This field is deprecated.

We recommend that you use a cache policy or an origin request policy instead of this field.

If you want to include values in the cache key, use a cache policy. For more information, see Creating cache policies in the Amazon CloudFront Developer Guide .

If you want to send values to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies in the Amazon CloudFront Developer Guide .

A complex type that specifies how CloudFront handles query strings, cookies, and HTTP headers.

Parameters:
  • query_string (Union[bool, IResolvable]) –

    This field is deprecated. We recommend that you use a cache policy or an origin request policy instead of this field. If you want to include query strings in the cache key, use a cache policy. For more information, see Creating cache policies in the Amazon CloudFront Developer Guide . If you want to send query strings to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies in the Amazon CloudFront Developer Guide . Indicates whether you want CloudFront to forward query strings to the origin that is associated with this cache behavior and cache based on the query string parameters. CloudFront behavior depends on the value of QueryString and on the values that you specify for QueryStringCacheKeys , if any: If you specify true for QueryString and you don’t specify any values for QueryStringCacheKeys , CloudFront forwards all query string parameters to the origin and caches based on all query string parameters. Depending on how many query string parameters and values you have, this can adversely affect performance because CloudFront must forward more requests to the origin. If you specify true for QueryString and you specify one or more values for QueryStringCacheKeys , CloudFront forwards all query string parameters to the origin, but it only caches based on the query string parameters that you specify. If you specify false for QueryString , CloudFront doesn’t forward any query string parameters to the origin, and doesn’t cache based on query string parameters. For more information, see Configuring CloudFront to Cache Based on Query String Parameters in the Amazon CloudFront Developer Guide .

  • cookies (Union[IResolvable, CookiesProperty, Dict[str, Any], None]) –

    This field is deprecated. We recommend that you use a cache policy or an origin request policy instead of this field. If you want to include cookies in the cache key, use a cache policy. For more information, see Creating cache policies in the Amazon CloudFront Developer Guide . If you want to send cookies to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies in the Amazon CloudFront Developer Guide . A complex type that specifies whether you want CloudFront to forward cookies to the origin and, if so, which ones. For more information about forwarding cookies to the origin, see How CloudFront Forwards, Caches, and Logs Cookies in the Amazon CloudFront Developer Guide .

  • headers (Optional[Sequence[str]]) –

    This field is deprecated. We recommend that you use a cache policy or an origin request policy instead of this field. If you want to include headers in the cache key, use a cache policy. For more information, see Creating cache policies in the Amazon CloudFront Developer Guide . If you want to send headers to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies in the Amazon CloudFront Developer Guide . A complex type that specifies the Headers , if any, that you want CloudFront to forward to the origin for this cache behavior (whitelisted headers). For the headers that you specify, CloudFront also caches separate versions of a specified object that is based on the header values in viewer requests. For more information, see Caching Content Based on Request Headers in the Amazon CloudFront Developer Guide .

  • query_string_cache_keys (Optional[Sequence[str]]) –

    This field is deprecated. We recommend that you use a cache policy or an origin request policy instead of this field. If you want to include query strings in the cache key, use a cache policy. For more information, see Creating cache policies in the Amazon CloudFront Developer Guide . If you want to send query strings to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies in the Amazon CloudFront Developer Guide . A complex type that contains information about the query string parameters that you want CloudFront to use for caching for this cache behavior.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-forwardedvalues.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

forwarded_values_property = cloudfront.CfnDistribution.ForwardedValuesProperty(
    query_string=False,

    # the properties below are optional
    cookies=cloudfront.CfnDistribution.CookiesProperty(
        forward="forward",

        # the properties below are optional
        whitelisted_names=["whitelistedNames"]
    ),
    headers=["headers"],
    query_string_cache_keys=["queryStringCacheKeys"]
)

Attributes

cookies

This field is deprecated.

We recommend that you use a cache policy or an origin request policy instead of this field.

If you want to include cookies in the cache key, use a cache policy. For more information, see Creating cache policies in the Amazon CloudFront Developer Guide .

If you want to send cookies to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies in the Amazon CloudFront Developer Guide .

A complex type that specifies whether you want CloudFront to forward cookies to the origin and, if so, which ones. For more information about forwarding cookies to the origin, see How CloudFront Forwards, Caches, and Logs Cookies in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-forwardedvalues.html#cfn-cloudfront-distribution-forwardedvalues-cookies

headers

This field is deprecated.

We recommend that you use a cache policy or an origin request policy instead of this field.

If you want to include headers in the cache key, use a cache policy. For more information, see Creating cache policies in the Amazon CloudFront Developer Guide .

If you want to send headers to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies in the Amazon CloudFront Developer Guide .

A complex type that specifies the Headers , if any, that you want CloudFront to forward to the origin for this cache behavior (whitelisted headers). For the headers that you specify, CloudFront also caches separate versions of a specified object that is based on the header values in viewer requests.

For more information, see Caching Content Based on Request Headers in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-forwardedvalues.html#cfn-cloudfront-distribution-forwardedvalues-headers

query_string

This field is deprecated.

We recommend that you use a cache policy or an origin request policy instead of this field.

If you want to include query strings in the cache key, use a cache policy. For more information, see Creating cache policies in the Amazon CloudFront Developer Guide .

If you want to send query strings to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies in the Amazon CloudFront Developer Guide .

Indicates whether you want CloudFront to forward query strings to the origin that is associated with this cache behavior and cache based on the query string parameters. CloudFront behavior depends on the value of QueryString and on the values that you specify for QueryStringCacheKeys , if any:

If you specify true for QueryString and you don’t specify any values for QueryStringCacheKeys , CloudFront forwards all query string parameters to the origin and caches based on all query string parameters. Depending on how many query string parameters and values you have, this can adversely affect performance because CloudFront must forward more requests to the origin.

If you specify true for QueryString and you specify one or more values for QueryStringCacheKeys , CloudFront forwards all query string parameters to the origin, but it only caches based on the query string parameters that you specify.

If you specify false for QueryString , CloudFront doesn’t forward any query string parameters to the origin, and doesn’t cache based on query string parameters.

For more information, see Configuring CloudFront to Cache Based on Query String Parameters in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-forwardedvalues.html#cfn-cloudfront-distribution-forwardedvalues-querystring

query_string_cache_keys

This field is deprecated.

We recommend that you use a cache policy or an origin request policy instead of this field.

If you want to include query strings in the cache key, use a cache policy. For more information, see Creating cache policies in the Amazon CloudFront Developer Guide .

If you want to send query strings to the origin but not include them in the cache key, use an origin request policy. For more information, see Creating origin request policies in the Amazon CloudFront Developer Guide .

A complex type that contains information about the query string parameters that you want CloudFront to use for caching for this cache behavior.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-forwardedvalues.html#cfn-cloudfront-distribution-forwardedvalues-querystringcachekeys

FunctionAssociationProperty

class CfnDistribution.FunctionAssociationProperty(*, event_type=None, function_arn=None)

Bases: object

A CloudFront function that is associated with a cache behavior in a CloudFront distribution.

Parameters:
  • event_type (Optional[str]) – The event type of the function, either viewer-request or viewer-response . You cannot use origin-facing event types ( origin-request and origin-response ) with a CloudFront function.

  • function_arn (Optional[str]) – The Amazon Resource Name (ARN) of the function.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-functionassociation.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

function_association_property = cloudfront.CfnDistribution.FunctionAssociationProperty(
    event_type="eventType",
    function_arn="functionArn"
)

Attributes

event_type

The event type of the function, either viewer-request or viewer-response .

You cannot use origin-facing event types ( origin-request and origin-response ) with a CloudFront function.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-functionassociation.html#cfn-cloudfront-distribution-functionassociation-eventtype

function_arn

The Amazon Resource Name (ARN) of the function.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-functionassociation.html#cfn-cloudfront-distribution-functionassociation-functionarn

GeoRestrictionProperty

class CfnDistribution.GeoRestrictionProperty(*, restriction_type, locations=None)

Bases: object

A complex type that controls the countries in which your content is distributed.

CloudFront determines the location of your users using MaxMind GeoIP databases. To disable geo restriction, remove the Restrictions property from your stack template.

Parameters:
  • restriction_type (str) – The method that you want to use to restrict distribution of your content by country:. - none : No geo restriction is enabled, meaning access to content is not restricted by client geo location. - blacklist : The Location elements specify the countries in which you don’t want CloudFront to distribute your content. - whitelist : The Location elements specify the countries in which you want CloudFront to distribute your content.

  • locations (Optional[Sequence[str]]) – A complex type that contains a Location element for each country in which you want CloudFront either to distribute your content ( whitelist ) or not distribute your content ( blacklist ). The Location element is a two-letter, uppercase country code for a country that you want to include in your blacklist or whitelist . Include one Location element for each country. CloudFront and MaxMind both use ISO 3166 country codes. For the current list of countries and the corresponding codes, see ISO 3166-1-alpha-2 code on the International Organization for Standardization website. You can also refer to the country list on the CloudFront console, which includes both country names and codes.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-georestriction.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

geo_restriction_property = cloudfront.CfnDistribution.GeoRestrictionProperty(
    restriction_type="restrictionType",

    # the properties below are optional
    locations=["locations"]
)

Attributes

locations

A complex type that contains a Location element for each country in which you want CloudFront either to distribute your content ( whitelist ) or not distribute your content ( blacklist ).

The Location element is a two-letter, uppercase country code for a country that you want to include in your blacklist or whitelist . Include one Location element for each country.

CloudFront and MaxMind both use ISO 3166 country codes. For the current list of countries and the corresponding codes, see ISO 3166-1-alpha-2 code on the International Organization for Standardization website. You can also refer to the country list on the CloudFront console, which includes both country names and codes.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-georestriction.html#cfn-cloudfront-distribution-georestriction-locations

restriction_type

.

  • none : No geo restriction is enabled, meaning access to content is not restricted by client geo location.

  • blacklist : The Location elements specify the countries in which you don’t want CloudFront to distribute your content.

  • whitelist : The Location elements specify the countries in which you want CloudFront to distribute your content.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-georestriction.html#cfn-cloudfront-distribution-georestriction-restrictiontype

Type:

The method that you want to use to restrict distribution of your content by country

LambdaFunctionAssociationProperty

class CfnDistribution.LambdaFunctionAssociationProperty(*, event_type=None, include_body=None, lambda_function_arn=None)

Bases: object

A complex type that contains a Lambda@Edge function association.

Parameters:
  • event_type (Optional[str]) – Specifies the event type that triggers a Lambda@Edge function invocation. You can specify the following values:. - viewer-request : The function executes when CloudFront receives a request from a viewer and before it checks to see whether the requested object is in the edge cache. - origin-request : The function executes only when CloudFront sends a request to your origin. When the requested object is in the edge cache, the function doesn’t execute. - origin-response : The function executes after CloudFront receives a response from the origin and before it caches the object in the response. When the requested object is in the edge cache, the function doesn’t execute. - viewer-response : The function executes before CloudFront returns the requested object to the viewer. The function executes regardless of whether the object was already in the edge cache. If the origin returns an HTTP status code other than HTTP 200 (OK), the function doesn’t execute.

  • include_body (Union[bool, IResolvable, None]) – A flag that allows a Lambda@Edge function to have read access to the body content. For more information, see Accessing the Request Body by Choosing the Include Body Option in the Amazon CloudFront Developer Guide.

  • lambda_function_arn (Optional[str]) – The ARN of the Lambda@Edge function. You must specify the ARN of a function version; you can’t specify an alias or $LATEST.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-lambdafunctionassociation.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

lambda_function_association_property = cloudfront.CfnDistribution.LambdaFunctionAssociationProperty(
    event_type="eventType",
    include_body=False,
    lambda_function_arn="lambdaFunctionArn"
)

Attributes

event_type

.

  • viewer-request : The function executes when CloudFront receives a request from a viewer and before it checks to see whether the requested object is in the edge cache.

  • origin-request : The function executes only when CloudFront sends a request to your origin. When the requested object is in the edge cache, the function doesn’t execute.

  • origin-response : The function executes after CloudFront receives a response from the origin and before it caches the object in the response. When the requested object is in the edge cache, the function doesn’t execute.

  • viewer-response : The function executes before CloudFront returns the requested object to the viewer. The function executes regardless of whether the object was already in the edge cache.

If the origin returns an HTTP status code other than HTTP 200 (OK), the function doesn’t execute.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-lambdafunctionassociation.html#cfn-cloudfront-distribution-lambdafunctionassociation-eventtype

Type:

Specifies the event type that triggers a Lambda@Edge function invocation. You can specify the following values

include_body

A flag that allows a Lambda@Edge function to have read access to the body content.

For more information, see Accessing the Request Body by Choosing the Include Body Option in the Amazon CloudFront Developer Guide.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-lambdafunctionassociation.html#cfn-cloudfront-distribution-lambdafunctionassociation-includebody

lambda_function_arn

The ARN of the Lambda@Edge function.

You must specify the ARN of a function version; you can’t specify an alias or $LATEST.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-lambdafunctionassociation.html#cfn-cloudfront-distribution-lambdafunctionassociation-lambdafunctionarn

LegacyCustomOriginProperty

class CfnDistribution.LegacyCustomOriginProperty(*, dns_name, origin_protocol_policy, origin_ssl_protocols, http_port=None, https_port=None)

Bases: object

Parameters:
  • dns_name (str) – CfnDistribution.LegacyCustomOriginProperty.DNSName.

  • origin_protocol_policy (str) – CfnDistribution.LegacyCustomOriginProperty.OriginProtocolPolicy.

  • origin_ssl_protocols (Sequence[str]) – CfnDistribution.LegacyCustomOriginProperty.OriginSSLProtocols.

  • http_port (Union[int, float, None]) – CfnDistribution.LegacyCustomOriginProperty.HTTPPort.

  • https_port (Union[int, float, None]) – CfnDistribution.LegacyCustomOriginProperty.HTTPSPort.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacycustomorigin.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

legacy_custom_origin_property = cloudfront.CfnDistribution.LegacyCustomOriginProperty(
    dns_name="dnsName",
    origin_protocol_policy="originProtocolPolicy",
    origin_ssl_protocols=["originSslProtocols"],

    # the properties below are optional
    http_port=123,
    https_port=123
)

Attributes

dns_name

CfnDistribution.LegacyCustomOriginProperty.DNSName.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacycustomorigin.html#cfn-cloudfront-distribution-legacycustomorigin-dnsname

http_port

CfnDistribution.LegacyCustomOriginProperty.HTTPPort.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacycustomorigin.html#cfn-cloudfront-distribution-legacycustomorigin-httpport

https_port

CfnDistribution.LegacyCustomOriginProperty.HTTPSPort.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacycustomorigin.html#cfn-cloudfront-distribution-legacycustomorigin-httpsport

origin_protocol_policy

CfnDistribution.LegacyCustomOriginProperty.OriginProtocolPolicy.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacycustomorigin.html#cfn-cloudfront-distribution-legacycustomorigin-originprotocolpolicy

origin_ssl_protocols

CfnDistribution.LegacyCustomOriginProperty.OriginSSLProtocols.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacycustomorigin.html#cfn-cloudfront-distribution-legacycustomorigin-originsslprotocols

LegacyS3OriginProperty

class CfnDistribution.LegacyS3OriginProperty(*, dns_name, origin_access_identity=None)

Bases: object

Parameters:
  • dns_name (str) – CfnDistribution.LegacyS3OriginProperty.DNSName.

  • origin_access_identity (Optional[str]) – CfnDistribution.LegacyS3OriginProperty.OriginAccessIdentity.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacys3origin.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

legacy_s3_origin_property = cloudfront.CfnDistribution.LegacyS3OriginProperty(
    dns_name="dnsName",

    # the properties below are optional
    origin_access_identity="originAccessIdentity"
)

Attributes

dns_name

CfnDistribution.LegacyS3OriginProperty.DNSName.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacys3origin.html#cfn-cloudfront-distribution-legacys3origin-dnsname

origin_access_identity

CfnDistribution.LegacyS3OriginProperty.OriginAccessIdentity.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacys3origin.html#cfn-cloudfront-distribution-legacys3origin-originaccessidentity

LoggingProperty

class CfnDistribution.LoggingProperty(*, bucket, include_cookies=None, prefix=None)

Bases: object

A complex type that controls whether access logs are written for the distribution.

Parameters:
  • bucket (str) – The Amazon S3 bucket to store the access logs in, for example, myawslogbucket.s3.amazonaws.com .

  • include_cookies (Union[bool, IResolvable, None]) – Specifies whether you want CloudFront to include cookies in access logs, specify true for IncludeCookies . If you choose to include cookies in logs, CloudFront logs all cookies regardless of how you configure the cache behaviors for this distribution. If you don’t want to include cookies when you create a distribution or if you want to disable include cookies for an existing distribution, specify false for IncludeCookies .

  • prefix (Optional[str]) – An optional string that you want CloudFront to prefix to the access log filenames for this distribution, for example, myprefix/ . If you want to enable logging, but you don’t want to specify a prefix, you still must include an empty Prefix element in the Logging element.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-logging.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

logging_property = cloudfront.CfnDistribution.LoggingProperty(
    bucket="bucket",

    # the properties below are optional
    include_cookies=False,
    prefix="prefix"
)

Attributes

bucket

The Amazon S3 bucket to store the access logs in, for example, myawslogbucket.s3.amazonaws.com .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-logging.html#cfn-cloudfront-distribution-logging-bucket

include_cookies

Specifies whether you want CloudFront to include cookies in access logs, specify true for IncludeCookies .

If you choose to include cookies in logs, CloudFront logs all cookies regardless of how you configure the cache behaviors for this distribution. If you don’t want to include cookies when you create a distribution or if you want to disable include cookies for an existing distribution, specify false for IncludeCookies .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-logging.html#cfn-cloudfront-distribution-logging-includecookies

prefix

An optional string that you want CloudFront to prefix to the access log filenames for this distribution, for example, myprefix/ .

If you want to enable logging, but you don’t want to specify a prefix, you still must include an empty Prefix element in the Logging element.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-logging.html#cfn-cloudfront-distribution-logging-prefix

OriginCustomHeaderProperty

class CfnDistribution.OriginCustomHeaderProperty(*, header_name, header_value)

Bases: object

A complex type that contains HeaderName and HeaderValue elements, if any, for this distribution.

Parameters:
  • header_name (str) – The name of a header that you want CloudFront to send to your origin. For more information, see Adding Custom Headers to Origin Requests in the Amazon CloudFront Developer Guide .

  • header_value (str) – The value for the header that you specified in the HeaderName field.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origincustomheader.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

origin_custom_header_property = cloudfront.CfnDistribution.OriginCustomHeaderProperty(
    header_name="headerName",
    header_value="headerValue"
)

Attributes

header_name

The name of a header that you want CloudFront to send to your origin.

For more information, see Adding Custom Headers to Origin Requests in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origincustomheader.html#cfn-cloudfront-distribution-origincustomheader-headername

header_value

The value for the header that you specified in the HeaderName field.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origincustomheader.html#cfn-cloudfront-distribution-origincustomheader-headervalue

OriginGroupFailoverCriteriaProperty

class CfnDistribution.OriginGroupFailoverCriteriaProperty(*, status_codes)

Bases: object

A complex data type that includes information about the failover criteria for an origin group, including the status codes for which CloudFront will failover from the primary origin to the second origin.

Parameters:

status_codes (Union[IResolvable, StatusCodesProperty, Dict[str, Any]]) – The status codes that, when returned from the primary origin, will trigger CloudFront to failover to the second origin.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origingroupfailovercriteria.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

origin_group_failover_criteria_property = cloudfront.CfnDistribution.OriginGroupFailoverCriteriaProperty(
    status_codes=cloudfront.CfnDistribution.StatusCodesProperty(
        items=[123],
        quantity=123
    )
)

Attributes

status_codes

The status codes that, when returned from the primary origin, will trigger CloudFront to failover to the second origin.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origingroupfailovercriteria.html#cfn-cloudfront-distribution-origingroupfailovercriteria-statuscodes

OriginGroupMemberProperty

class CfnDistribution.OriginGroupMemberProperty(*, origin_id)

Bases: object

An origin in an origin group.

Parameters:

origin_id (str) – The ID for an origin in an origin group.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origingroupmember.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

origin_group_member_property = cloudfront.CfnDistribution.OriginGroupMemberProperty(
    origin_id="originId"
)

Attributes

origin_id

The ID for an origin in an origin group.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origingroupmember.html#cfn-cloudfront-distribution-origingroupmember-originid

OriginGroupMembersProperty

class CfnDistribution.OriginGroupMembersProperty(*, items, quantity)

Bases: object

A complex data type for the origins included in an origin group.

Parameters:
Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origingroupmembers.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

origin_group_members_property = cloudfront.CfnDistribution.OriginGroupMembersProperty(
    items=[cloudfront.CfnDistribution.OriginGroupMemberProperty(
        origin_id="originId"
    )],
    quantity=123
)

Attributes

items

Items (origins) in an origin group.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origingroupmembers.html#cfn-cloudfront-distribution-origingroupmembers-items

quantity

The number of origins in an origin group.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origingroupmembers.html#cfn-cloudfront-distribution-origingroupmembers-quantity

OriginGroupProperty

class CfnDistribution.OriginGroupProperty(*, failover_criteria, id, members)

Bases: object

An origin group includes two origins (a primary origin and a second origin to failover to) and a failover criteria that you specify.

You create an origin group to support origin failover in CloudFront. When you create or update a distribution, you can specifiy the origin group instead of a single origin, and CloudFront will failover from the primary origin to the second origin under the failover conditions that you’ve chosen.

Parameters:
Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origingroup.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

origin_group_property = cloudfront.CfnDistribution.OriginGroupProperty(
    failover_criteria=cloudfront.CfnDistribution.OriginGroupFailoverCriteriaProperty(
        status_codes=cloudfront.CfnDistribution.StatusCodesProperty(
            items=[123],
            quantity=123
        )
    ),
    id="id",
    members=cloudfront.CfnDistribution.OriginGroupMembersProperty(
        items=[cloudfront.CfnDistribution.OriginGroupMemberProperty(
            origin_id="originId"
        )],
        quantity=123
    )
)

Attributes

failover_criteria

A complex type that contains information about the failover criteria for an origin group.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origingroup.html#cfn-cloudfront-distribution-origingroup-failovercriteria

id

The origin group’s ID.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origingroup.html#cfn-cloudfront-distribution-origingroup-id

members

A complex type that contains information about the origins in an origin group.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origingroup.html#cfn-cloudfront-distribution-origingroup-members

OriginGroupsProperty

class CfnDistribution.OriginGroupsProperty(*, quantity, items=None)

Bases: object

A complex data type for the origin groups specified for a distribution.

Parameters:
  • quantity (Union[int, float]) – The number of origin groups.

  • items (Union[IResolvable, Sequence[Union[IResolvable, OriginGroupProperty, Dict[str, Any]]], None]) – The items (origin groups) in a distribution.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origingroups.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

origin_groups_property = cloudfront.CfnDistribution.OriginGroupsProperty(
    quantity=123,

    # the properties below are optional
    items=[cloudfront.CfnDistribution.OriginGroupProperty(
        failover_criteria=cloudfront.CfnDistribution.OriginGroupFailoverCriteriaProperty(
            status_codes=cloudfront.CfnDistribution.StatusCodesProperty(
                items=[123],
                quantity=123
            )
        ),
        id="id",
        members=cloudfront.CfnDistribution.OriginGroupMembersProperty(
            items=[cloudfront.CfnDistribution.OriginGroupMemberProperty(
                origin_id="originId"
            )],
            quantity=123
        )
    )]
)

Attributes

items

The items (origin groups) in a distribution.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origingroups.html#cfn-cloudfront-distribution-origingroups-items

quantity

The number of origin groups.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origingroups.html#cfn-cloudfront-distribution-origingroups-quantity

OriginProperty

class CfnDistribution.OriginProperty(*, domain_name, id, connection_attempts=None, connection_timeout=None, custom_origin_config=None, origin_access_control_id=None, origin_custom_headers=None, origin_path=None, origin_shield=None, s3_origin_config=None)

Bases: object

An origin.

An origin is the location where content is stored, and from which CloudFront gets content to serve to viewers. To specify an origin:

  • Use S3OriginConfig to specify an Amazon S3 bucket that is not configured with static website hosting.

  • Use CustomOriginConfig to specify all other kinds of origins, including:

  • An Amazon S3 bucket that is configured with static website hosting

  • An Elastic Load Balancing load balancer

  • An AWS Elemental MediaPackage endpoint

  • An AWS Elemental MediaStore container

  • Any other HTTP server, running on an Amazon EC2 instance or any other kind of host

For the current maximum number of origins that you can specify per distribution, see General Quotas on Web Distributions in the Amazon CloudFront Developer Guide (quotas were formerly referred to as limits).

Parameters:
  • domain_name (str) – The domain name for the origin. For more information, see Origin Domain Name in the Amazon CloudFront Developer Guide .

  • id (str) – A unique identifier for the origin. This value must be unique within the distribution. Use this value to specify the TargetOriginId in a CacheBehavior or DefaultCacheBehavior .

  • connection_attempts (Union[int, float, None]) –

    The number of times that CloudFront attempts to connect to the origin. The minimum number is 1, the maximum is 3, and the default (if you don’t specify otherwise) is 3. For a custom origin (including an Amazon S3 bucket that’s configured with static website hosting), this value also specifies the number of times that CloudFront attempts to get a response from the origin, in the case of an Origin Response Timeout . For more information, see Origin Connection Attempts in the Amazon CloudFront Developer Guide .

  • connection_timeout (Union[int, float, None]) – The number of seconds that CloudFront waits when trying to establish a connection to the origin. The minimum timeout is 1 second, the maximum is 10 seconds, and the default (if you don’t specify otherwise) is 10 seconds. For more information, see Origin Connection Timeout in the Amazon CloudFront Developer Guide .

  • custom_origin_config (Union[CustomOriginConfigProperty, Dict[str, Any], IResolvable, None]) – Use this type to specify an origin that is not an Amazon S3 bucket, with one exception. If the Amazon S3 bucket is configured with static website hosting, use this type. If the Amazon S3 bucket is not configured with static website hosting, use the S3OriginConfig type instead.

  • origin_access_control_id (Optional[str]) – The unique identifier of an origin access control for this origin. For more information, see Restricting access to an Amazon S3 origin in the Amazon CloudFront Developer Guide .

  • origin_custom_headers (Union[IResolvable, Sequence[Union[IResolvable, OriginCustomHeaderProperty, Dict[str, Any]]], None]) –

    A list of HTTP header names and values that CloudFront adds to the requests that it sends to the origin. For more information, see Adding Custom Headers to Origin Requests in the Amazon CloudFront Developer Guide .

  • origin_path (Optional[str]) – An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin. For more information, see Origin Path in the Amazon CloudFront Developer Guide .

  • origin_shield (Union[IResolvable, OriginShieldProperty, Dict[str, Any], None]) – CloudFront Origin Shield. Using Origin Shield can help reduce the load on your origin. For more information, see Using Origin Shield in the Amazon CloudFront Developer Guide .

  • s3_origin_config (Union[S3OriginConfigProperty, Dict[str, Any], IResolvable, None]) – Use this type to specify an origin that is an Amazon S3 bucket that is not configured with static website hosting. To specify any other type of origin, including an Amazon S3 bucket that is configured with static website hosting, use the CustomOriginConfig type instead.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

origin_property = cloudfront.CfnDistribution.OriginProperty(
    domain_name="domainName",
    id="id",

    # the properties below are optional
    connection_attempts=123,
    connection_timeout=123,
    custom_origin_config=cloudfront.CfnDistribution.CustomOriginConfigProperty(
        origin_protocol_policy="originProtocolPolicy",

        # the properties below are optional
        http_port=123,
        https_port=123,
        origin_keepalive_timeout=123,
        origin_read_timeout=123,
        origin_ssl_protocols=["originSslProtocols"]
    ),
    origin_access_control_id="originAccessControlId",
    origin_custom_headers=[cloudfront.CfnDistribution.OriginCustomHeaderProperty(
        header_name="headerName",
        header_value="headerValue"
    )],
    origin_path="originPath",
    origin_shield=cloudfront.CfnDistribution.OriginShieldProperty(
        enabled=False,
        origin_shield_region="originShieldRegion"
    ),
    s3_origin_config=cloudfront.CfnDistribution.S3OriginConfigProperty(
        origin_access_identity="originAccessIdentity"
    )
)

Attributes

connection_attempts

The number of times that CloudFront attempts to connect to the origin.

The minimum number is 1, the maximum is 3, and the default (if you don’t specify otherwise) is 3.

For a custom origin (including an Amazon S3 bucket that’s configured with static website hosting), this value also specifies the number of times that CloudFront attempts to get a response from the origin, in the case of an Origin Response Timeout .

For more information, see Origin Connection Attempts in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html#cfn-cloudfront-distribution-origin-connectionattempts

connection_timeout

The number of seconds that CloudFront waits when trying to establish a connection to the origin.

The minimum timeout is 1 second, the maximum is 10 seconds, and the default (if you don’t specify otherwise) is 10 seconds.

For more information, see Origin Connection Timeout in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html#cfn-cloudfront-distribution-origin-connectiontimeout

custom_origin_config

Use this type to specify an origin that is not an Amazon S3 bucket, with one exception.

If the Amazon S3 bucket is configured with static website hosting, use this type. If the Amazon S3 bucket is not configured with static website hosting, use the S3OriginConfig type instead.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html#cfn-cloudfront-distribution-origin-customoriginconfig

domain_name

The domain name for the origin.

For more information, see Origin Domain Name in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html#cfn-cloudfront-distribution-origin-domainname

id

A unique identifier for the origin. This value must be unique within the distribution.

Use this value to specify the TargetOriginId in a CacheBehavior or DefaultCacheBehavior .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html#cfn-cloudfront-distribution-origin-id

origin_access_control_id

The unique identifier of an origin access control for this origin.

For more information, see Restricting access to an Amazon S3 origin in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html#cfn-cloudfront-distribution-origin-originaccesscontrolid

origin_custom_headers

A list of HTTP header names and values that CloudFront adds to the requests that it sends to the origin.

For more information, see Adding Custom Headers to Origin Requests in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html#cfn-cloudfront-distribution-origin-origincustomheaders

origin_path

An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin.

For more information, see Origin Path in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html#cfn-cloudfront-distribution-origin-originpath

origin_shield

CloudFront Origin Shield. Using Origin Shield can help reduce the load on your origin.

For more information, see Using Origin Shield in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html#cfn-cloudfront-distribution-origin-originshield

s3_origin_config

Use this type to specify an origin that is an Amazon S3 bucket that is not configured with static website hosting.

To specify any other type of origin, including an Amazon S3 bucket that is configured with static website hosting, use the CustomOriginConfig type instead.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html#cfn-cloudfront-distribution-origin-s3originconfig

OriginShieldProperty

class CfnDistribution.OriginShieldProperty(*, enabled=None, origin_shield_region=None)

Bases: object

CloudFront Origin Shield.

Using Origin Shield can help reduce the load on your origin. For more information, see Using Origin Shield in the Amazon CloudFront Developer Guide .

Parameters:
  • enabled (Union[bool, IResolvable, None]) – A flag that specifies whether Origin Shield is enabled. When it’s enabled, CloudFront routes all requests through Origin Shield, which can help protect your origin. When it’s disabled, CloudFront might send requests directly to your origin from multiple edge locations or regional edge caches.

  • origin_shield_region (Optional[str]) – The AWS Region for Origin Shield. Specify the AWS Region that has the lowest latency to your origin. To specify a region, use the region code, not the region name. For example, specify the US East (Ohio) region as us-east-2 . When you enable CloudFront Origin Shield, you must specify the AWS Region for Origin Shield. For the list of AWS Regions that you can specify, and for help choosing the best Region for your origin, see Choosing the AWS Region for Origin Shield in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-originshield.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

origin_shield_property = cloudfront.CfnDistribution.OriginShieldProperty(
    enabled=False,
    origin_shield_region="originShieldRegion"
)

Attributes

enabled

A flag that specifies whether Origin Shield is enabled.

When it’s enabled, CloudFront routes all requests through Origin Shield, which can help protect your origin. When it’s disabled, CloudFront might send requests directly to your origin from multiple edge locations or regional edge caches.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-originshield.html#cfn-cloudfront-distribution-originshield-enabled

origin_shield_region

The AWS Region for Origin Shield.

Specify the AWS Region that has the lowest latency to your origin. To specify a region, use the region code, not the region name. For example, specify the US East (Ohio) region as us-east-2 .

When you enable CloudFront Origin Shield, you must specify the AWS Region for Origin Shield. For the list of AWS Regions that you can specify, and for help choosing the best Region for your origin, see Choosing the AWS Region for Origin Shield in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-originshield.html#cfn-cloudfront-distribution-originshield-originshieldregion

RestrictionsProperty

class CfnDistribution.RestrictionsProperty(*, geo_restriction)

Bases: object

A complex type that identifies ways in which you want to restrict distribution of your content.

Parameters:

geo_restriction (Union[IResolvable, GeoRestrictionProperty, Dict[str, Any]]) –

A complex type that controls the countries in which your content is distributed. CloudFront determines the location of your users using MaxMind GeoIP databases. To disable geo restriction, remove the Restrictions property from your stack template.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-restrictions.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

restrictions_property = cloudfront.CfnDistribution.RestrictionsProperty(
    geo_restriction=cloudfront.CfnDistribution.GeoRestrictionProperty(
        restriction_type="restrictionType",

        # the properties below are optional
        locations=["locations"]
    )
)

Attributes

geo_restriction

A complex type that controls the countries in which your content is distributed.

CloudFront determines the location of your users using MaxMind GeoIP databases. To disable geo restriction, remove the Restrictions property from your stack template.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-restrictions.html#cfn-cloudfront-distribution-restrictions-georestriction

S3OriginConfigProperty

class CfnDistribution.S3OriginConfigProperty(*, origin_access_identity=None)

Bases: object

A complex type that contains information about the Amazon S3 origin.

If the origin is a custom origin or an S3 bucket that is configured as a website endpoint, use the CustomOriginConfig element instead.

Parameters:

origin_access_identity (Optional[str]) – The CloudFront origin access identity to associate with the origin. Use an origin access identity to configure the origin so that viewers can only access objects in an Amazon S3 bucket through CloudFront. The format of the value is: origin-access-identity/cloudfront/ ID-of-origin-access-identity where *ID-of-origin-access-identity* is the value that CloudFront returned in the ID element when you created the origin access identity. If you want viewers to be able to access objects using either the CloudFront URL or the Amazon S3 URL, specify an empty OriginAccessIdentity element. To delete the origin access identity from an existing distribution, update the distribution configuration and include an empty OriginAccessIdentity element. To replace the origin access identity, update the distribution configuration and specify the new origin access identity. For more information about the origin access identity, see Serving Private Content through CloudFront in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-s3originconfig.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

s3_origin_config_property = cloudfront.CfnDistribution.S3OriginConfigProperty(
    origin_access_identity="originAccessIdentity"
)

Attributes

origin_access_identity

The CloudFront origin access identity to associate with the origin.

Use an origin access identity to configure the origin so that viewers can only access objects in an Amazon S3 bucket through CloudFront. The format of the value is:

origin-access-identity/cloudfront/ ID-of-origin-access-identity

where *ID-of-origin-access-identity* is the value that CloudFront returned in the ID element when you created the origin access identity.

If you want viewers to be able to access objects using either the CloudFront URL or the Amazon S3 URL, specify an empty OriginAccessIdentity element.

To delete the origin access identity from an existing distribution, update the distribution configuration and include an empty OriginAccessIdentity element.

To replace the origin access identity, update the distribution configuration and specify the new origin access identity.

For more information about the origin access identity, see Serving Private Content through CloudFront in the Amazon CloudFront Developer Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-s3originconfig.html#cfn-cloudfront-distribution-s3originconfig-originaccessidentity

StatusCodesProperty

class CfnDistribution.StatusCodesProperty(*, items, quantity)

Bases: object

A complex data type for the status codes that you specify that, when returned by a primary origin, trigger CloudFront to failover to a second origin.

Parameters:
  • items (Union[Sequence[Union[int, float]], IResolvable]) – The items (status codes) for an origin group.

  • quantity (Union[int, float]) – The number of status codes.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-statuscodes.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

status_codes_property = cloudfront.CfnDistribution.StatusCodesProperty(
    items=[123],
    quantity=123
)

Attributes

items

The items (status codes) for an origin group.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-statuscodes.html#cfn-cloudfront-distribution-statuscodes-items

quantity

The number of status codes.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-statuscodes.html#cfn-cloudfront-distribution-statuscodes-quantity

ViewerCertificateProperty

class CfnDistribution.ViewerCertificateProperty(*, acm_certificate_arn=None, cloud_front_default_certificate=None, iam_certificate_id=None, minimum_protocol_version=None, ssl_support_method=None)

Bases: object

A complex type that determines the distribution’s SSL/TLS configuration for communicating with viewers.

If the distribution doesn’t use Aliases (also known as alternate domain names or CNAMEs)—that is, if the distribution uses the CloudFront domain name such as d111111abcdef8.cloudfront.net —set CloudFrontDefaultCertificate to true and leave all other fields empty.

If the distribution uses Aliases (alternate domain names or CNAMEs), use the fields in this type to specify the following settings:

  • Which viewers the distribution accepts HTTPS connections from: only viewers that support server name indication (SNI) (recommended), or all viewers including those that don’t support SNI.

  • To accept HTTPS connections from only viewers that support SNI, set SSLSupportMethod to sni-only . This is recommended. Most browsers and clients support SNI. (In CloudFormation, the field name is SslSupportMethod . Note the different capitalization.)

  • To accept HTTPS connections from all viewers, including those that don’t support SNI, set SSLSupportMethod to vip . This is not recommended, and results in additional monthly charges from CloudFront. (In CloudFormation, the field name is SslSupportMethod . Note the different capitalization.)

  • The minimum SSL/TLS protocol version that the distribution can use to communicate with viewers. To specify a minimum version, choose a value for MinimumProtocolVersion . For more information, see Security Policy in the Amazon CloudFront Developer Guide .

  • The location of the SSL/TLS certificate, AWS Certificate Manager (ACM) (recommended) or AWS Identity and Access Management (IAM) . You specify the location by setting a value in one of the following fields (not both):

  • ACMCertificateArn (In CloudFormation, this field name is AcmCertificateArn . Note the different capitalization.)

  • IAMCertificateId (In CloudFormation, this field name is IamCertificateId . Note the different capitalization.)

All distributions support HTTPS connections from viewers. To require viewers to use HTTPS only, or to redirect them from HTTP to HTTPS, use ViewerProtocolPolicy in the CacheBehavior or DefaultCacheBehavior . To specify how CloudFront should use SSL/TLS to communicate with your custom origin, use CustomOriginConfig .

For more information, see Using HTTPS with CloudFront and Using Alternate Domain Names and HTTPS in the Amazon CloudFront Developer Guide .

Parameters:
  • acm_certificate_arn (Optional[str]) –

    In CloudFormation, this field name is AcmCertificateArn . Note the different capitalization. If the distribution uses Aliases (alternate domain names or CNAMEs) and the SSL/TLS certificate is stored in AWS Certificate Manager (ACM) , provide the Amazon Resource Name (ARN) of the ACM certificate. CloudFront only supports ACM certificates in the US East (N. Virginia) Region ( us-east-1 ). If you specify an ACM certificate ARN, you must also specify values for MinimumProtocolVersion and SSLSupportMethod . (In CloudFormation, the field name is SslSupportMethod . Note the different capitalization.)

  • cloud_front_default_certificate (Union[bool, IResolvable, None]) – If the distribution uses the CloudFront domain name such as d111111abcdef8.cloudfront.net , set this field to true . If the distribution uses Aliases (alternate domain names or CNAMEs), set this field to false and specify values for the following fields: - ACMCertificateArn or IAMCertificateId (specify a value for one, not both) In CloudFormation, these field names are AcmCertificateArn and IamCertificateId . Note the different capitalization. - MinimumProtocolVersion - SSLSupportMethod (In CloudFormation, this field name is SslSupportMethod . Note the different capitalization.)

  • iam_certificate_id (Optional[str]) –

    In CloudFormation, this field name is IamCertificateId . Note the different capitalization. If the distribution uses Aliases (alternate domain names or CNAMEs) and the SSL/TLS certificate is stored in AWS Identity and Access Management (IAM) , provide the ID of the IAM certificate. If you specify an IAM certificate ID, you must also specify values for MinimumProtocolVersion and SSLSupportMethod . (In CloudFormation, the field name is SslSupportMethod . Note the different capitalization.)

  • minimum_protocol_version (Optional[str]) –

    If the distribution uses Aliases (alternate domain names or CNAMEs), specify the security policy that you want CloudFront to use for HTTPS connections with viewers. The security policy determines two settings: - The minimum SSL/TLS protocol that CloudFront can use to communicate with viewers. - The ciphers that CloudFront can use to encrypt the content that it returns to viewers. For more information, see Security Policy and Supported Protocols and Ciphers Between Viewers and CloudFront in the Amazon CloudFront Developer Guide . .. epigraph:: On the CloudFront console, this setting is called Security Policy . When you’re using SNI only (you set SSLSupportMethod to sni-only ), you must specify TLSv1 or higher. (In CloudFormation, the field name is SslSupportMethod . Note the different capitalization.) If the distribution uses the CloudFront domain name such as d111111abcdef8.cloudfront.net (you set CloudFrontDefaultCertificate to true ), CloudFront automatically sets the security policy to TLSv1 regardless of the value that you set here.

  • ssl_support_method (Optional[str]) –

    In CloudFormation, this field name is SslSupportMethod . Note the different capitalization. If the distribution uses Aliases (alternate domain names or CNAMEs), specify which viewers the distribution accepts HTTPS connections from. - sni-only – The distribution accepts HTTPS connections from only viewers that support server name indication (SNI) . This is recommended. Most browsers and clients support SNI. - vip – The distribution accepts HTTPS connections from all viewers including those that don’t support SNI. This is not recommended, and results in additional monthly charges from CloudFront. - static-ip - Do not specify this value unless your distribution has been enabled for this feature by the CloudFront team. If you have a use case that requires static IP addresses for a distribution, contact CloudFront through the AWS Support Center . If the distribution uses the CloudFront domain name such as d111111abcdef8.cloudfront.net , don’t set a value for this field.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-viewercertificate.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_cloudfront as cloudfront

viewer_certificate_property = cloudfront.CfnDistribution.ViewerCertificateProperty(
    acm_certificate_arn="acmCertificateArn",
    cloud_front_default_certificate=False,
    iam_certificate_id="iamCertificateId",
    minimum_protocol_version="minimumProtocolVersion",
    ssl_support_method="sslSupportMethod"
)

Attributes

acm_certificate_arn

In CloudFormation, this field name is AcmCertificateArn . Note the different capitalization.

If the distribution uses Aliases (alternate domain names or CNAMEs) and the SSL/TLS certificate is stored in AWS Certificate Manager (ACM) , provide the Amazon Resource Name (ARN) of the ACM certificate. CloudFront only supports ACM certificates in the US East (N. Virginia) Region ( us-east-1 ).

If you specify an ACM certificate ARN, you must also specify values for MinimumProtocolVersion and SSLSupportMethod . (In CloudFormation, the field name is SslSupportMethod . Note the different capitalization.)

link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-viewercertificate.html#cfn-cloudfront-distribution-viewercertificate-acmcertificatearn

cloud_front_default_certificate

If the distribution uses the CloudFront domain name such as d111111abcdef8.cloudfront.net , set this field to true .

If the distribution uses Aliases (alternate domain names or CNAMEs), set this field to false and specify values for the following fields:

  • ACMCertificateArn or IAMCertificateId (specify a value for one, not both)

In CloudFormation, these field names are AcmCertificateArn and IamCertificateId . Note the different capitalization.

  • MinimumProtocolVersion

  • SSLSupportMethod (In CloudFormation, this field name is SslSupportMethod . Note the different capitalization.)

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-viewercertificate.html#cfn-cloudfront-distribution-viewercertificate-cloudfrontdefaultcertificate

iam_certificate_id

In CloudFormation, this field name is IamCertificateId . Note the different capitalization.

If the distribution uses Aliases (alternate domain names or CNAMEs) and the SSL/TLS certificate is stored in AWS Identity and Access Management (IAM) , provide the ID of the IAM certificate.

If you specify an IAM certificate ID, you must also specify values for MinimumProtocolVersion and SSLSupportMethod . (In CloudFormation, the field name is SslSupportMethod . Note the different capitalization.)

link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-viewercertificate.html#cfn-cloudfront-distribution-viewercertificate-iamcertificateid

minimum_protocol_version

If the distribution uses Aliases (alternate domain names or CNAMEs), specify the security policy that you want CloudFront to use for HTTPS connections with viewers.

The security policy determines two settings:

  • The minimum SSL/TLS protocol that CloudFront can use to communicate with viewers.

  • The ciphers that CloudFront can use to encrypt the content that it returns to viewers.

For more information, see Security Policy and Supported Protocols and Ciphers Between Viewers and CloudFront in the Amazon CloudFront Developer Guide . .. epigraph:

On the CloudFront console, this setting is called *Security Policy* .

When you’re using SNI only (you set SSLSupportMethod to sni-only ), you must specify TLSv1 or higher. (In CloudFormation, the field name is SslSupportMethod . Note the different capitalization.)

If the distribution uses the CloudFront domain name such as d111111abcdef8.cloudfront.net (you set CloudFrontDefaultCertificate to true ), CloudFront automatically sets the security policy to TLSv1 regardless of the value that you set here.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-viewercertificate.html#cfn-cloudfront-distribution-viewercertificate-minimumprotocolversion

ssl_support_method

In CloudFormation, this field name is SslSupportMethod . Note the different capitalization.

If the distribution uses Aliases (alternate domain names or CNAMEs), specify which viewers the distribution accepts HTTPS connections from.

  • sni-only – The distribution accepts HTTPS connections from only viewers that support server name indication (SNI) . This is recommended. Most browsers and clients support SNI.

  • vip – The distribution accepts HTTPS connections from all viewers including those that don’t support SNI. This is not recommended, and results in additional monthly charges from CloudFront.

  • static-ip - Do not specify this value unless your distribution has been enabled for this feature by the CloudFront team. If you have a use case that requires static IP addresses for a distribution, contact CloudFront through the AWS Support Center .

If the distribution uses the CloudFront domain name such as d111111abcdef8.cloudfront.net , don’t set a value for this field.

link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-viewercertificate.html#cfn-cloudfront-distribution-viewercertificate-sslsupportmethod