AWS CloudFormation
User Guide (Version )

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.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::CloudFront::Distribution", "Properties" : { "DistributionConfig" : DistributionConfig, "Tags" : [ Tag, ... ] } }

YAML

Type: AWS::CloudFront::Distribution Properties: DistributionConfig: DistributionConfig Tags: - Tag

Properties

DistributionConfig

The current configuration information for the distribution. Send a GET request to the /CloudFront API version/distribution ID/config resource.

Required: Yes

Type: DistributionConfig

Update requires: No interruption

Tags

A complex type that contains zero or more Tag elements.

Required: No

Type: List of Tag

Update requires: No interruption

Return Values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the CloudFront distribution ID. For example: E27LVI50CSW06W.

For more information about using the Ref function, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

DomainName

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

Examples

Create a distribution

The following example specifies a distribution and assigns it a single tag.

JSON

{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "cloudfrontdistribution": { "Type": "AWS::CloudFront::Distribution", "Properties": { "DistributionConfig": { "CacheBehaviors": [ { "LambdaFunctionAssociations": [ { "EventType": "string-value", "LambdaFunctionARN": "string-value" } ] } ], "DefaultCacheBehavior": { "LambdaFunctionAssociations": [ { "EventType": "string-value", "LambdaFunctionARN": "string-value" } ] }, "IPV6Enabled": "boolean-value", "Origins": [ { "CustomOriginConfig": { "OriginKeepaliveTimeout": "integer-value", "OriginReadTimeout": "integer-value" } } ] }, "Tags": [ { "Key": "string-value", "Value": "string-value" } ] } } } }

YAML

AWSTemplateFormatVersion: 2010-09-09 Resources: cloudfrontdistribution: Type: AWS::CloudFront::Distribution Properties: DistributionConfig: CacheBehaviors: - LambdaFunctionAssociations: - EventType: string-value LambdaFunctionARN: string-value DefaultCacheBehavior: LambdaFunctionAssociations: - EventType: string-value LambdaFunctionARN: string-value IPV6Enabled: boolean-value Origins: - CustomOriginConfig: OriginKeepaliveTimeout: integer-value OriginReadTimeout: integer-value Tags: - Key: string-value Value: string-value

See Also