AWS::Lightsail::Distribution
The AWS::Lightsail::Distribution
resource specifies a content delivery
network (CDN) distribution. You can create distributions only in the us-east-1
AWS Region.
A distribution is a globally distributed network of caching servers that improve the performance of your website or web application hosted on a Lightsail instance, static content hosted on a Lightsail bucket, or through a Lightsail load balancer.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::Lightsail::Distribution", "Properties" : { "BundleId" :
String
, "CacheBehaviors" :[ CacheBehaviorPerPath, ... ]
, "CacheBehaviorSettings" :CacheSettings
, "CertificateName" :String
, "DefaultCacheBehavior" :CacheBehavior
, "DistributionName" :String
, "IpAddressType" :String
, "IsEnabled" :Boolean
, "Origin" :InputOrigin
, "Tags" :[ Tag, ... ]
} }
YAML
Type: AWS::Lightsail::Distribution Properties: BundleId:
String
CacheBehaviors:- CacheBehaviorPerPath
CacheBehaviorSettings:CacheSettings
CertificateName:String
DefaultCacheBehavior:CacheBehavior
DistributionName:String
IpAddressType:String
IsEnabled:Boolean
Origin:InputOrigin
Tags:- Tag
Properties
BundleId
-
The ID of the bundle applied to the distribution.
Required: Yes
Type: String
Update requires: No interruption
CacheBehaviors
-
An array of objects that describe the per-path cache behavior of the distribution.
Required: No
Type: Array of CacheBehaviorPerPath
Update requires: No interruption
CacheBehaviorSettings
-
An object that describes the cache behavior settings of the distribution.
Required: No
Type: CacheSettings
Update requires: No interruption
CertificateName
-
The name of the SSL/TLS certificate attached to the distribution.
Required: No
Type: String
Pattern:
\w[\w\-]*\w
Update requires: No interruption
DefaultCacheBehavior
-
An object that describes the default cache behavior of the distribution.
Required: Yes
Type: CacheBehavior
Update requires: No interruption
DistributionName
-
The name of the distribution
Required: Yes
Type: String
Pattern:
\w[\w\-]*\w
Update requires: Replacement
IpAddressType
-
The IP address type of the distribution.
The possible values are
ipv4
for IPv4 only, anddualstack
for IPv4 and IPv6.Required: No
Type: String
Allowed values:
dualstack | ipv4 | ipv6
Update requires: Updates are not supported.
IsEnabled
-
A Boolean value indicating whether the distribution is enabled.
Required: No
Type: Boolean
Update requires: No interruption
Origin
-
An object that describes the origin resource of the distribution, such as a Lightsail instance, bucket, or load balancer.
The distribution pulls, caches, and serves content from the origin.
Required: Yes
Type: InputOrigin
Update requires: No interruption
-
An array of key-value pairs to apply to this resource.
For more information, see Tag in the AWS CloudFormation User Guide.
Note
The
Value
ofTags
is optional for Lightsail resources.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 a unique identifier for this resource.
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
.
AbleToUpdateBundle
-
Indicates whether you can update the distribution’s current bundle to another bundle.
DistributionArn
-
The Amazon Resource Name (ARN) of the distribution.
Status
-
The status of the distribution.
Remarks
Configuring cache behavior settings
The CacheBehaviorSettings
parameter can be set only if the DefaultCacheBehavior
parameter is
set to cache
, or if the CacheBehaviors
parameter has a path with a cache
behavior.
If neither of those conditions are true, the CacheBehaviorSettings
will not be set for the distribution
and the stack will drift.