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 distribution's configuration.
Required: Yes
Type: DistributionConfig
Update requires: No interruption
-
A complex type that contains zero or more
Tag
elements.Required: No
Type: Array 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
d111111abcdef8.cloudfront.net
. Id
-
The distribution's identifier. For example:
E1U5RQF7T870K0
.
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
-
CreateDistribution in the Amazon CloudFront API Reference