| 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.
Usage:
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/2010-11-01/"> <S3Origin><DNSName>mybucket.s3.amazonaws.com</DNSName> <OriginAccessIdentity> origin-access-identity/cloudfront/E127EXAMPLE51Z </OriginAccessIdentity> </S3Origin> <CustomOrigin>
<DNSName>www.example.com</DNSName> <HTTPPort>80</HTTPPort> <HTTPSPort>443</HTTPSPort> <OriginProtocolPolicy>http-only</OriginProtocolPolicy> </CustomOrigin> <CallerReference>your unique caller reference</CallerReference> <CNAME>mysite.example.com</CNAME> <Comment>My comments</Comment> <Enabled>true</Enabled> <DefaultRootObject>index.html</DefaultRootObject> <Logging> <Bucket>mylogs.s3.amazonaws.com</Bucket> <Prefix>myprefix/</Prefix> </Logging> <TrustedSigners> <Self/> <AwsAccountNumber>111122223333</AwsAccountNumber> <AwsAccountNumber>444455556666</AwsAccountNumber> </TrustedSigners> <RequiredProtocols> <Protocol>https</Protocol> </RequiredProtocols> </DistributionConfig>
The following table describes the child elements in the DistributionConfig
datatype. They're presented in the order they appear in the configuration.
| Name | Description | Required |
|---|---|---|
|
|
Origin information to associate with the distribution. If your distribution will use an
Amazon S3 origin, then you use the Type: Complex Default: None Constraints: You cannot use S3Origin Children: see S3Origin Child Elements |
Conditional |
|
|
Origin information to associate with the distribution. If your distribution will use a custom origin
(non Amazon S3), then you use the Type: Complex Default: None Constraints: You cannot use CustomOrigin Children: see CustomOrigin Child Elements |
Conditional |
|
|
A unique number that ensures the request can't be replayed. If the CallerReference is new (no matter the content of the
If the CallerReference is a value you already sent in a previous request
to create a distribution, and the content of the
If the CallerReference is a value you already sent in a previous request
to create a distribution but the content of the
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. |
Yes |
|
|
A CNAME alias you want to associate with this distribution. You can have up to 10 CNAME aliases per distribution. For more information, go to Using CNAMEs in the Amazon CloudFront Developer Guide. Only include a Type: String Default: None Valid Value: The CNAME alias |
No |
|
|
Any comments you want to include about the distribution. Type: String Default: None Constraints: Maximum 128 characters |
No |
|
|
Whether the distribution is enabled to accept end user requests for content. Type: Boolean Default: None Valid Values: |
Yes |
|
|
Designates a default root object. Only include a For more information, 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:
|
No |
|
|
A complex type that controls whether access logs are written for the distribution. If you want to turn on access logs, include this element; if you want to turn off access logs, remove this element. For more information, go to Access Logs in the Amazon CloudFront Developer Guide. Type: Complex type Default: None Children: |
No |
|
|
A complex type that specifies any AWS accounts you want to permit to create signed URLs for private content. If you want the distribution to use signed URLs, include this element; if you want the distribution to use basic URLs, remove this element. For more information, go to Serving Private Content in the Amazon CloudFront Developer Guide. Type: Complex type Default: None Children: |
No |
|
|
Defines the protocols required for your distribution. Use this element to restrict access to your distribution solely to HTTPS requests. Without this element, CloudFront can use any available protocol to serve the request. For more information, go to Creating Secure HTTPS Connections in the Amazon CloudFront Developer Guide. Type: String Default: None Children: |
No |
The following table describes the child elements of the S3Origin element.
| Name | Description | Required |
|---|---|---|
|
|
The DNS name of your Amazon S3 bucket to associate with the distribution. For example:
Type: String Default: None Constraints: The name of the Amazon S3 bucket:
|
Yes |
|
|
The CloudFront origin access identity to associate with the distribution. If you want the distribution to serve private content, include this element; if you want the distribution to serve public content, remove this element. For more information, go to Serving Private Content in the Amazon CloudFront Developer Guide. Type: String Default: None Constraints: Must be in format |
Optional |
The following table describes the child elements of the CustomOrigin element.
| Name | Description | Required |
|---|---|---|
|
|
The origin to associate with the distribution. For example:
Type: String Default: None Constraints: |
Yes |
|
|
The HTTP port the custom origin listens on. Type: Integer Default: 80 Valid Values: 80, 443, or 1024-65535 (inclusive) |
Optional |
|
|
The HTTPS port the custom origin listens on. Type: Integer Default: 443 Valid Values: 80, 443, or 1024-65535 (inclusive) |
Optional |
|
|
The origin protocol policy to apply to your origin. If you specify Type: Valid Values: Default: none |
Yes |
The following table describes the child elements of the Logging element.
| Name | Description | Required |
|---|---|---|
|
|
The Amazon S3 bucket to store the access logs in. For example:
Type: String Default: None Constraints: Maximum 128 characters |
Yes |
|
|
An optional string of your choice to prefix to the access log
filenames for this distribution. For example:
If you decide not to use a prefix, you must still include the empty
Type: String Default: None Constraints: Maximum 256 characters; the string must not start with a slash ( / ). |
No |
The following table describes the child elements of the TrustedSigners
element.
| Name | Description | Required |
|---|---|---|
|
|
Include this empty element if you want to give your own AWS account permission to create signed URLs. Type: String Default: None |
No |
|
|
Specifies an AWS account that can create signed URLs. Remove the dashes. You can specify up to five accounts, each with
its own Type: String Default: None |
No |
The following table describes the child element of the RequiredProtocols
element.
| Name | Description | Required |
|---|---|---|
|
|
Specifies the protocol. Type: String Default: None Valid Value: |
Yes |
![]() | Caution |
|---|---|
The only way to guarantee that your end users retrieve an object 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 irrespective of whether the current request protocol matches the protocol used previously. For information about expiring cached objects see Object Expiration in the Amazon CloudFront Developer Guide. |
Example of a public content distribution configuration
The following example configuration is for a public content distribution with an Amazon S3 origin, no CNAME aliases, with logging turned off, and with the distribution restricted to HTTPS protocol.
<DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2010-11-01/">
<S3Origin>
<DNSName>mybucket.s3.amazonaws.com</DNSName>
</S3Origin>
<CallerReference>20091130090000</CallerReference>
<Comment>My comments</Comment>
<Enabled>true</Enabled>
<RequiredProtocols>
<Protocol>https</Protocol>
</RequiredProtocols>
</DistributionConfig>Example of a private content distribution configuration
The following example configuration is for a distribution that serves private content with
signed URLs and with two CNAME aliases. The presence of the Logging element means
that logging is turned on for this distribution. This distribution also has a default root object, index.html.
<DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2010-11-01/">
<S3Origin>
<DNSName>mybucket.s3.amazonaws.com</DNSName>
<OriginAccessIdentity>
origin-access-identity/cloudfront/E74FTE3AJFJ256A
</OriginAccessIdentity>
</S3Origin>
</CustomOrigin>
<CallerReference>20091130090000</CallerReference>
<CNAME>beagles.com</CNAME>
<CNAME>beagles.dogs.com</CNAME>
<Comment>My comments</Comment>
<Enabled>true</Enabled>
<DefaultRootObject>index.html</DefaultRootObject>
<Logging>
<Bucket>mylogs.s3.amazonaws.com</Bucket>
<Prefix/>
</Logging>
<TrustedSigners>
<Self/>
<AwsAccountNumber>111122223333</AwsAccountNumber>
<AwsAccountNumber>444455556666</AwsAccountNumber>
</TrustedSigners>
</DistributionConfig>