| « PreviousNext » | |
![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
The DistributionConfig complex type describes a distribution's configuration information. For more information
about distributions, go to Working with Distributions in the
Amazon CloudFront Developer Guide.
Important
When you update the DistributionConfig, you replace the entire configuration with
a new one, you don't add to the existing configuration. For example, if you want to add a CNAME alias
to a distribution that already has one, you must specify both the original CNAME alias and the new one. Otherwise,
the updated configuration will contain only the new CNAME alias, not the original one. This requirement is enforced by
the Quantity element. For example, if you specify 3 for the Quantity element under
Aliases but you don't specify any CNAME elements, CloudFront returns an error.
The DistributionConfig complex type is used in the following CloudFront API actions:
POST Distribution (see request parameter)
PUT Distribution Config (see request parameter)
GET Distribution (see response element)
GET Distribution Config (see response element)
<DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2013-05-12/"> <CallerReference>unique description for this distribution config</CallerReference> <Aliases> <Quantity>number of CNAME aliases</Quantity> <!-- Optional. Omit when Quantity = 0. --> <Items> <CNAME>CNAME alias</CNAME> </Items> </Aliases> <DefaultRootObject>URL for default root object</DefaultRootObject> <Origins> <Quantity>number of origins</Quantity> <Items> <Origin> <Id>unique identifier for this origin</Id> <DomainName>domain name of origin</DomainName> <!-- In a request, include the S3OriginConfig element only if you use an Amazon S3 origin for your distribution. In a response, this element appears only if you use an Amazon S3 origin. --> <S3OriginConfig> <OriginAccessIdentity>origin-access-identity/ cloudfront/ID</OriginAccessIdentity> </S3OriginConfig> <!-- In a request, include the CustomOriginConfig element only if you use an custom origin for your distribution. In a response, this element appears only if you use a custom origin. --> <CustomOriginConfig> <HTTPPort>HTTP port that the custom origin listens on</HTTPPort> <HTTPSPort>HTTPS port that the custom origin listens on</HTTPSPort> <OriginProtocolPolicy>http-only | match-viewer</OriginProtocolPolicy> </CustomOriginConfig> </Origin> </Items> </Origins> <DefaultCacheBehavior> <TargetOriginId>ID of the origin that the default cache behavior applies to</TargetOriginId> <ForwardedValues> <QueryString>true | false</QueryString> <Cookies> <Forward>all | whitelist | none</Forward> <!-- Required when Forward = whitelist, omitted otherwise. --> <WhitelistedNames> <Quantity>number of cookie names to forward to origin</Quantity> <Items> <Name>name of a cookie to forward to the origin</Name> </Items> </WhitelistedNames> </Cookies> </ForwardedValues> <TrustedSigners> <Enabled>true | false</Enabled> <Quantity>number of trusted signers</Quantity> <!-- Optional. Omit when Quantity = 0. --> <Items> <AwsAccountNumber>self |AWS account that can create signed URLs</AwsAccountNumber> </Items> </TrustedSigners> <ViewerProtocolPolicy>allow-all | https-only</ViewerProtocolPolicy> <MinTTL>minimum TTL in seconds</MinTTL> </DefaultCacheBehavior> <CacheBehaviors> <Quantity>number of cache behaviors</Quantity> <!-- Optional. Omit when Quantity = 0. --> <Items> <CacheBehavior> <PathPattern>pattern that specifies files that this cache behavior applies to</PathPattern> <TargetOriginId>ID of the origin that this cache behavior applies to</TargetOriginId> <ForwardedValues> <QueryString>true | false</QueryString> <Cookies> <Forward>all | whitelist | none</Forward> <!-- Required when Forward = whitelist, omitted otherwise. --> <WhitelistedNames> <Quantity>number of cookie names to forward to origin</Quantity> <Items> <Name>name of a cookie to forward to the origin</Name> </Items> </WhitelistedNames> </Cookies> </ForwardedValues> <TrustedSigners> <Enabled>true | false</Enabled> <Quantity>number of trusted signers</Quantity> <!-- Optional. Omit when Quantity = 0. --> <Items> <AwsAccountNumber>self |AWS account that can create signed URLs</AwsAccountNumber> </Items> </TrustedSigners> <ViewerProtocolPolicy>allow-all | https-only</ViewerProtocolPolicy> <MinTTL>minimum TTL in seconds for files specified by PathPattern</MinTTL> </CacheBehavior> </Items> </CacheBehaviors> <Comment>comment about the distribution</Comment> <Logging> <Enabled>true | false</Enabled> <IncludeCookies>true | false</IncludeCookies> <Bucket>Amazon S3 bucket to save logs in</Bucket> <Prefix>prefix for log filenames</Prefix> </Logging> <ViewerCertificate> <IAMCertificateId>IAM certificate ID</IAMCertificateId> | <CloudFrontDefaultCertificate>true</CloudFrontDefaultCertificate> </ViewerCertificate> <PriceClass>maximum price class for the distribution</PriceClass> <Enabled>true | false</Enabled> </DistributionConfig>
The following table describes the child elements in the DistributionConfig
datatype. They're presented in the order they appear in the configuration. All values are required except
where specified.
| Name | Description |
|---|---|
|
|
A unique value (for example, a date-time stamp) that ensures that the request can't be replayed. If the value of If If Type: String Default: None Constraints: Allowable characters are any Unicode code points that are legal in an XML 1.0 document. The UTF-8 encoding of the value must be less than 128 bytes. Parent: |
|
|
A complex type that contains information about CNAMEs (alternate domain names), if any, for this distribution. Type: Complex Default: None Children: Parent: |
|
|
The number of CNAMEs, if any, for this distribution. Type: Integer Default: None Parent: |
|
|
Optional: A complex type that contains Type: Complex Default: None Children: Parent: |
|
|
A CNAME (alternate domain name) that you want to associate with this distribution. For more information about CNAMEs, go to Using CNAMEs in the Amazon CloudFront Developer Guide. By default, you can create a maximum of 10 CNAMEs per distribution. To request a higher limit, fill out the form at http://aws.amazon.com/cloudfront-request/. When you're creating a distribution, if you don't want to specify any CNAMEs, specify 0 for When you're updating a distribution:
Type: String Default: None Valid Value: A CNAME alias Parent: |
|
|
The object that you want CloudFront to request from your origin (for example, If you don't want to specify a default root object when you create a distribution, include an empty
To delete the default root object from an existing distribution, update the distribution configuration and
include an empty To replace the default root object, update the distribution configuration and specify the new object. For more information about the default root object, go to Creating a Default Root Object in the Amazon CloudFront Developer Guide. Type: String Default: None Valid Value: The name of the object, for example, Constraints: Maximum 255 characters. The name of the object can contain any of the following characters:
Parent: |
|
|
A complex type that contains information about origins for this distribution. Type: Complex Default: None Parent: Child: |
|
|
The number of origins for this distribution. Type: Integer Default: None Parent: |
|
|
A complex type that contains origins for this distribution. Type: Complex Default: None Children: Parent: |
|
|
A complex type that describes the Amazon S3 bucket or the HTTP server (for example, a web server) from which CloudFront gets your files. You must create at least one origin. By default, you can create a maximum of 10 origins. To request a higher limit, fill out the form at http://aws.amazon.com/cloudfront-request/. Type: Complex Default: None Parent: Children: |
|
|
A unique identifier for the origin. The value of When you specify the value of Type: String Default: None Parent: |
|
|
Amazon S3 origins: The DNS name of the Amazon S3 bucket from which you want CloudFront
to get objects for this origin, for example, Constraints for Amazon S3 origins:
Custom origins: The DNS domain name for the HTTP server from which you want CloudFront
to get objects for this origin, for example, Constraints for custom origins:
Type: String Default: None Parent: |
|
|
A complex type that contains information about the Amazon S3 origin. If the origin is a custom origin,
use the Type: Complex Default: None Parent: Child: |
|
|
The CloudFront origin access identity to associate with the origin. Use an origin access identity to configure the origin so that end users can only access objects in an Amazon S3 bucket through CloudFront. If you want end users to be able to access objects using either the CloudFront URL or the Amazon S3 URL, specify an empty
To delete the origin access identity from an existing distribution, update the distribution configuration and
include an empty 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, go to Serving Private Content through CloudFront in the Amazon CloudFront Developer Guide. For more information about updating the distribution configuration, see PUT Distribution Config. Type: String Default: None Constraints: Must be in format Parent: |
|
|
A complex type that contains information about a custom origin. If the origin is an Amazon S3 bucket, use the
Type: Complex Default: None Constraints: You cannot use Parent: Children: |
|
|
The HTTP port that the custom origin listens on. Type: Integer Default: 80 Valid Values: 80, 443, or 1024-65535 (inclusive) Parent: |
|
|
The HTTPS port that the custom origin listens on. Type: Integer Default: 443 Valid Values: 80, 443, or 1024-65535 (inclusive) Parent: |
|
|
The protocol policy that you want CloudFront to use when fetching objects from your origin server. If you specify
Type: Valid Values: Default: none Parent: |
|
|
A complex type that describes the default cache behavior if you do not specify a Type: Complex Default: None Parent: Children: |
|
|
A complex type that contains zero or more Type: Complex Default: None Parent: Child: |
|
|
The number of cache behaviors for this distribution. Type: Integer Default: None Parent: |
|
|
Optional: A complex type that contains cache behaviors for this distribution.
If Type: Complex Default: None Children: Parent: |
|
|
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 distribute 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 will never be used. By default, you can create a maximum of nine cache behaviors in addition to the default cache behavior. To request a higher limit, fill out the form at http://aws.amazon.com/cloudfront-request/. If you don't want to specify any cache behaviors, include only an empty To delete all cache behaviors in an existing distribution, update the distribution configuration and
include only an empty 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 Behaviors in the Amazon CloudFront Developer Guide. Type: Complex Default: None Parent: Children: |
|
|
The pattern (for example, The path pattern for the default cache behavior is For more information, see Path Pattern in the Amazon CloudFront Developer Guide. Type: String Constraints: Maximum 255 characters. The name of the object can contain any of the following characters:
Default: None Parent: |
|
|
The value of Type: String Default: None Parent: |
|
|
A complex type that specifies how CloudFront handles query strings and cookies. Type: Complex Default: None Parent: Child: |
|
|
Indicates whether you want CloudFront to forward query strings to the origin that is associated with this
cache behavior. If so, specify Type: String Default: None Valid Values: Parent: |
|
|
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, go to How CloudFront Forwards, Caches, and Logs Cookies in the Amazon CloudFront Developer Guide. Type: Complex Default: None Parent: Child: |
|
|
Specifies which cookies to forward to the origin for this cache behavior: all, none, or the list
of cookies specified in the Amazon S3 doesn't process cookies. When the cache behavior is forwarding requests to an Amazon S3 origin,
specify Type: String Valid Values: Default: no default Parent: |
|
|
Required if you specify If you specify By default, you can whitelist a maximum of 10 cookie names per distribution. (If you specify Type: Complex Default: None Parent: Child: |
|
|
The number of different cookies that you want CloudFront to forward to the origin for this cache behavior. Type: Integer Default: None Parent: |
|
|
A complex type that contains one Type: Complex Default: None Children: Parent: |
|
|
The name of a cookie that you want CloudFront to forward to the origin for this cache behavior. Type: String Default: None Parent: |
|
|
A complex type that specifies the AWS accounts, if any, that you want to allow to create signed URLs for private content. If you want to require signed URLs in requests for objects in the target origin that match the
If you don't want to require signed URLs in requests for objects that match To add, change, or remove one or more trusted signers, change For more information about updating the distribution configuration, see PUT Distribution Config. Type: Complex type Default: None Parent: Children: |
|
|
Specifies whether you want to require end users to use signed URLs to access the files specified by
Type: String Default: None Valid Values: Parent: |
|
|
The number of trusted signers for this cache behavior. Type: Integer Default: None Parent: |
|
|
Optional: A complex type that contains trusted signers for this cache behavior.
If Type: Complex Default: None Children: Parent: |
|
|
Specifies an AWS account that can create signed URLs. Valid values include:
You can specify up to five accounts (including Type: String Default: None Parent: |
|
|
Use this element to specify the protocol that users can use to access the files in the origin
specified by For more information about requiring the HTTPS protocol, go to Creating Secure HTTPS Connections in the Amazon CloudFront Developer Guide. Type: String Default: None Valid Values: Parent: Caution The only way to guarantee that your end users 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 Specifying How Long Objects Stay in a CloudFront Edge Cache (Object Expiration) in the Amazon CloudFront Developer Guide. |
|
|
The minimum amount of time that you want objects to stay in CloudFront caches before CloudFront queries your origin to see whether the object has been updated. For more information, see Specifying How Long Objects Stay in a CloudFront Edge Cache (Object Expiration) in the Amazon CloudFront Developer Guide. Type: Long Default: 0 Valid Values: 0 to ~3,153,600,000 (100 years) Parent: |
|
|
Any comments you want to include about the distribution. If you don't want to specify a comment, include an empty To delete an existing comment, update the distribution configuration and
include an empty To add or change a comment, update the distribution configuration and specify the new comment. For more information about updating the distribution configuration, see PUT Distribution Config. Type: String Default: None Constraints: Maximum 128 characters Parent: |
|
|
A complex type that controls whether access logs are written for the distribution. For more information about logging, go to Access Logs in the Amazon CloudFront Developer Guide. Type: Complex type Default: None Parent: Children: |
|
|
Specifies whether you want CloudFront to save access logs to an Amazon S3 bucket. If you do not want to enable logging when you create a distribution or if you want to disable logging
for an existing distribution, specify If you specify Type: String Default: None Valid Values: Parent: |
|
|
If you want CloudFront to include cookies in access logs, specify Type: String Default: None Valid Values: Parent: |
|
|
The Amazon S3 bucket to store the access logs in, for example, For more information, see the Type: String Default: None Constraints: Maximum 128 characters Parent: |
|
|
An optional string that you want CloudFront to prefix to the access log filenames for this distribution,
for example, If you want to enable logging, but you do not want to specify a prefix, you still must include an empty
For more information, see the Type: String Default: None Constraints: Maximum 256 characters; the string must not start with a slash ( / ). Parent: |
|
|
A complex type that specifies which certificate to use when viewers request objects using HTTPS:
For more information, go to Using Alternate Domain Names and HTTPS in the Amazon CloudFront Developer Guide. Type: Complex type Default: None Parent: Children: |
|
|
If you want viewers to use HTTPS to request your objects and you want the URL for your objects to use:
Specify only one value or the other, not both. Do not specify In addition, you must also specify the following values:
For more information, go to Using Alternate Domain Names and HTTPS in the Amazon CloudFront Developer Guide. Type:
Default: None Parent: |
|
|
The price class that corresponds with the maximum price that you want to pay for CloudFront service. If you
specify If you specify a price class other than For more information about price classes, go to Choosing the Price Class for a CloudFront Distribution in the Amazon CloudFront Developer Guide. For information about CloudFront pricing, including how price classes map to CloudFront regions, go to Amazon CloudFront Pricing. Type: String Default: None Valid Values:
Parent: |
|
|
Whether the distribution is enabled to accept end user requests for content. Type: String Default: None Valid Values: Parent: |
Example of a distribution configuration with Amazon S3 and custom origins
The following example configuration is for a distribution that has both an Amazon S3 origin and a custom origin.
<DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2013-05-12/">
<CallerReference>example.com2012-04-11-5:09pm</CallerReference>
<Aliases>
<Quantity>1</Quantity>
<Items>
<CNAME>www.example.com</CNAME>
</Items>
</Aliases>
<DefaultRootObject>index.html</DefaultRootObject>
<Origins>
<Quantity>2</Quantity>
<Items>
<Origin>
<Id>example-Amazon S3-origin</Id>
<DomainName>myawsbucket.s3.amazonaws.com</DomainName>
<S3OriginConfig>
<OriginAccessIdentity>origin-access-identity/cloudfront/E74FTE3AEXAMPLE</OriginAccessIdentity>
</S3OriginConfig>
</Origin>
<Origin>
<Id>example-custom-origin</Id>
<DomainName>example.com</DomainName>
<CustomOriginConfig>
<HTTPPort>80</HTTPPort>
<HTTPSPort>443</HTTPSPort>
<OriginProtocolPolicy>match-viewer</OriginProtocolPolicy>
</CustomOriginConfig>
</Origin>
</Items>
</Origins>
<DefaultCacheBehavior>
<TargetOriginId>example-Amazon S3-origin</TargetOriginId>
<ForwardedValues>
<QueryString>true</QueryString>
<Cookies>
<Forward>whitelist</Forward>
<WhitelistedNames>
<Quantity>1</Quantity>
<Items>
<Name>example-cookie</Name>
</Items>
</WhitelistedNames>
</Cookies>
</ForwardedValues>
<TrustedSigners>
<Enabled>true</Enabled>
<Quantity>3</Quantity>
<Items>
<AwsAccountNumber>self</AwsAccountNumber>
<AwsAccountNumber>111122223333</AwsAccountNumber>
<AwsAccountNumber>444455556666</AwsAccountNumber>
</Items>
</TrustedSigners>
<ViewerProtocolPolicy>https-only</ViewerProtocolPolicy>
<MinTTL>0</MinTTL>
</DefaultCacheBehavior>
<CacheBehaviors>
<Quantity>1</Quantity>
<Items>
<CacheBehavior>
<PathPattern>*.jpg</PathPattern>
<TargetOriginId>example-custom-origin</TargetOriginId>
<ForwardedValues>
<QueryString>false</QueryString>
<Cookies>
<Forward>all</Forward>
</Cookies>
</ForwardedValues>
<TrustedSigners>
<Enabled>true</Enabled>
<Quantity>2</Quantity>
<Items>
<AwsAccountNumber>self</AwsAccountNumber>
<AwsAccountNumber>111122223333</AwsAccountNumber>
</Items>
</TrustedSigners>
<ViewerProtocolPolicy>allow-all</ViewerProtocolPolicy>
<MinTTL>86400</MinTTL>
</CacheBehavior>
</Items>
</CacheBehaviors>
<Comment>example comment</Comment>
<Logging>
<Enabled>true</Enabled>
<IncludeCookies>true</IncludeCookies>
<Bucket>myawslogbucket.s3.amazonaws.com</Bucket>
<Prefix>example.com.</Prefix>
</Logging>
<ViewerCertificate>
<IAMCertificateId>AS1A2M3P4L5E67SIIXR3J</IAMCertificateId>
</ViewerCertificate>
<PriceClass>PriceClass_All</PriceClass>
<Enabled>true</Enabled>
</DistributionConfig>Example of a distribution that includes no optional elements
The following example configuration is for a distribution for which all optional elements have been omitted.
<DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2013-05-12/">
<CallerReference>example.com2012-04-11-5:09pm</CallerReference>
<Aliases>
<Quantity>0</Quantity>
</Aliases>
<DefaultRootObject/>
<Origins>
<Quantity>1</Quantity>
<Items>
<Origin>
<Id>example-Amazon-S3-origin</Id>
<DomainName>myawsbucket.s3.amazonaws.com</DomainName>
<S3OriginConfig/>
</Origin>
</Items>
</Origins>
<DefaultCacheBehavior>
<TargetOriginId>example-Amazon-S3-origin</TargetOriginId>
<ForwardedValues>
<QueryString>true</QueryString>
<Cookies>
<Forward>none</Forward>
</Cookies>
</ForwardedValues>
<TrustedSigners>
<Enabled>false</Enabled>
<Quantity>0</Quantity>
</TrustedSigners>
<ViewerProtocolPolicy>allow-all</ViewerProtocolPolicy>
<MinTTL>3600</MinTTL>
</DefaultCacheBehavior>
<CacheBehaviors>
<Quantity>0</Quantity>
</CacheBehaviors>
<Comment/>
<Logging>
<Enabled>false</Enabled>
<IncludeCookies>true</IncludeCookies>
<Bucket/>
<Prefix/>
</Logging>
<PriceClass>PriceClass_All</PriceClass>
<Enabled>true</Enabled>
</DistributionConfig>