Amazon CloudFront
API Reference (API Version 2014-08-31)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

DistributionConfig Complex Type

Description

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 an alternate domain name (a CNAME) to a distribution that already has one, you must specify both the original alternate domain name and the new one. Otherwise, the updated configuration will contain only the new alternate domain name, 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:

Syntax

<DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2014-08-31/">
   <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, 
               omit 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>
         <Headers>
            <Quantity>number of headers to forward to origin<Quantity>
            <!-- Optional. Omit when Quantity = 0. -->
            <Items>
               <Name>header</Name>
            <Items>
         </Headers>
      </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 | 
         redirect-to-https | https-only</ViewerProtocolPolicy>
      <MinTTL>minimum TTL in seconds</MinTTL>
      <AllowedMethods>
         <Quantity>2 | 3 | 7</Quantity>
         <Items>
            <!-- If you want to use CloudFront only to serve your content 
               from edge locations, specify only GET and HEAD. -->
            <Method>GET</Method>
            <Method>HEAD</Method>
            <!-- If you want to use CloudFront to serve your content 
               from edge locations and you want to cache the 
               response from OPTIONS requests, specify 
               GET, HEAD, and OPTIONS. -->
            <Method>GET</Method>
            <Method>HEAD</Method>
            <Method>OPTIONS</Method>
            <!-- If you want to use any methods in addition to 
               GET and HEAD, you must specify all methods. -->
            <Method>DELETE</Method>
            <Method>GET</Method>
            <Method>HEAD</Method>
            <Method>OPTIONS</Method>
            <Method>PATCH</Method>
            <Method>POST</Method>
            <Method>PUT</Method>
         </Items>
      </AllowedMethods>
      <CachedMethods>
         <Quantity>2 | 3 </Quantity>
         <Items>
            <!-- If you only want to cache responses to GET and HEAD 
               requests, specify only GET and HEAD. -->
            <Method>GET</Method>
            <Method>HEAD</Method>
            <!-- If you want cache responses to GET, HEAD, and OPTIONS 
               requests, specify those methods. -->
            <Method>GET</Method>
            <Method>HEAD</Method>
            <Method>OPTIONS</Method>
         </Items>
      </CachedMethods>
      <SmoothStreaming>true | false</SmoothStreaming>
   </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, 
                     omit 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>
               <Headers>
                  <Quantity>number of headers to forward to origin<Quantity>
                  <!-- Optional. Omit when Quantity = 0. -->
                  <Items>
                     <Name>header</Name>
                  <Items>
               </Headers>
            </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 | 
               redirect-to-https | https-only</ViewerProtocolPolicy>
            <MinTTL>minimum TTL in seconds for files 
               specified by PathPattern</MinTTL>
            <AllowedMethods>
               <Quantity>2 | 3 | 7</Quantity>
               <Items>
                  <!-- If you want to use CloudFront only to serve 
                     your content from edge locations, specify only 
                     GET and HEAD. -->
                  <Method>GET</Method>
                  <Method>HEAD</Method>
                  <!-- If you want to use CloudFront to serve your content 
                     from edge locations and you want to cache the 
                     response from OPTIONS requests, specify 
                     GET, HEAD, and OPTIONS. -->
                  <Method>GET</Method>
                  <Method>HEAD</Method>
                  <Method>OPTIONS</Method>
                  <!-- If you want to use any methods in addition to 
                     GET and HEAD, you must specify all methods. -->
                  <Method>DELETE</Method>
                  <Method>GET</Method>
                  <Method>HEAD</Method>
                  <Method>OPTIONS</Method>
                  <Method>PATCH</Method>
                  <Method>POST</Method>
                  <Method>PUT</Method>
               </Items>
            </AllowedMethods>
            <CachedMethods>
               <Quantity>2 | 3 </Quantity>
               <Items>
                  <!-- If you only want to cache responses to GET and HEAD 
                     requests, specify only GET and HEAD. -->
                  <Method>GET</Method>
                  <Method>HEAD</Method>
                  <!-- If you want cache responses to GET, HEAD, and OPTIONS 
                     requests, specify those methods. -->
                  <Method>GET</Method>
                  <Method>HEAD</Method>
                  <Method>OPTIONS</Method>
               </Items>
            </CachedMethods>
            <SmoothStreaming>true | false</SmoothStreaming>
         </CacheBehavior>
      </Items>
   </CacheBehaviors>
   <CustomErrorResponses>
      <Quantity>number of custom error responses</Quantity>
      <Items>
         <CustomErrorResponse>
            <ErrorCode>HTTP status code for which you want to 
               customize the response</ErrorCode>
            <ResponsePagePath>path to custom error page</ResponsePagePath>
            <ResponseCode>HTTP status code that you want CloudFront 
               to return along with the custom error page</ResponseCode>
            <ErrorCachingMinTTL>minimum TTL for this 
               ErrorCode</ErrorCachingMinTTL>
         </CustomErrorResponse>
      </Items>
   </CustomErrorResponses>
   <Restrictions>
      <GeoRestriction>
         <RestrictionType>blacklist | whitelist | none</RestrictionType>
         <Quantity>number of countries 
            in the blacklist or whitelist</Quantity>
         <!-- Optional. Omit when Quantity = 0. -->
         <Items>
            <Location>two-letter country code in upper case</Location>
         </Items>
      </GeoRestriction>
   </Restrictions>
   <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>
      <SSLSupportMethod>vip | sni-only</SSLSupportMethod>
   </ViewerCertificate>
   <PriceClass>maximum price class for the distribution</PriceClass>
   <Enabled>true | false</Enabled>
</DistributionConfig>

Elements

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.

NameDescription

CallerReference

A unique value (for example, a date-time stamp) that ensures that the request can't be replayed.

If the value of CallerReference is new (regardless of the content of the DistributionConfig object), CloudFront creates a new distribution.

If CallerReference is a value you already sent in a previous request to create a distribution, and if the content of the DistributionConfig is identical to the original request (ignoring white space), CloudFront returns the same the response that it returned to the original request.

If CallerReference is a value you already sent in a previous request to create a distribution but the content of the DistributionConfig is different from the original request, CloudFront returns a DistributionAlreadyExists error.

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: DistributionConfig

Aliases

A complex type that contains information about CNAMEs (alternate domain names), if any, for this distribution.

Type: Complex

Default: None

Children: Quantity, Items

Parent: DistributionConfig

Quantity (Aliases)

The number of alternate domain names, if any, for this distribution.

Type: Integer

Default: None

Parent: Aliases

Items (Aliases)

Optional: A complex type that contains CNAME elements, if any, for this distribution. If Quantity is 0, you can omit Items.

Type: Complex

Default: None

Children: CNAME

Parent: Aliases

CNAME

A CNAME (alternate domain name) that you want to associate with this distribution. For more information about alternate domain names, go to Using Alternate Domain Names (CNAMEs) in the Amazon CloudFront Developer Guide.

For the current limit on the number of alternate domain names that you can add to a distribution, see Amazon CloudFront Limits in the Amazon Web Services General Reference. To request a higher limit, go to https://aws.amazon.com/support/createCase?type=service_limit_increase&serviceLimitIncreaseType=cloudfront-distributions.

When you're creating a distribution, if you don't want to specify any alternate domain names, specify 0 for Quantity and omit Items.

When you're updating a distribution:

  • If you want to delete all alternate domain names, change Quantity to 0, and delete Items.

  • If you want to add, change, or remove one or more alternate domain names, change the value of Quantity and specify all of the alternate domain names that you want to include in the updated distribution.

Type: String

Default: None

Valid Value: An alternate domain name

Parent: Items

DefaultRootObject

The object that you want CloudFront to request from your origin (for example, index.html) when a viewer requests the root URL for your distribution (http://www.example.com) instead of an object in your distribution (http://www.example.com/product-description.html). Specifying a default root object avoids exposing the contents of your distribution.

Specify only the object name, for example, index.html. Do not add a / before the object name.

If you don't want to specify a default root object when you create a distribution, include an empty DefaultRootObject element.

To delete the default root object from an existing distribution, update the distribution configuration and include an empty DefaultRootObject element.

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, index.html

Constraints: Maximum 255 characters. The name of the object can contain any of the following characters:

  • A-Z, a-z

  • 0-9

  • _ - . * $ / ~ " '

  • & (passed and returned as &amp;)

Parent: DistributionConfig

Origins

A complex type that contains information about origins for this distribution.

Type: Complex

Default: None

Parent: DistributionConfig

Child: Quantity, Items

Quantity (Origins)

The number of origins for this distribution.

Type: Integer

Default: None

Parent: Origins

Items (Origins)

A complex type that contains origins for this distribution.

Type: Complex

Default: None

Children: Origin

Parent: Origins

Origin

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.

For the current limit on the number of origins that you can create for a distribution, see Amazon CloudFront Limits in the Amazon Web Services General Reference. To request a higher limit, go to https://aws.amazon.com/support/createCase?type=service_limit_increase&serviceLimitIncreaseType=cloudfront-distributions.

Type: Complex

Default: None

Parent: Items

Children: Id, DomainName, and either S3OriginConfig (when the origin is an Amazon S3 bucket) or CustomOriginConfig (when the origin is an HTTP server)

Id

A unique identifier for the origin. The value of Id must be unique within the distribution.

When you specify the value of TargetOriginId for the default cache behavior or for another cache behavior, you indicate the origin to which you want the cache behavior to route requests by specifying the value of the Id element for that origin. When a request matches the path pattern for that cache behavior, CloudFront routes the request to the specified origin. For more information, see Cache Behavior Settings in the Amazon CloudFront Developer Guide.

Type: String

Default: None

Parent: Origin

DomainName

Amazon S3 origins: The DNS name of the Amazon S3 bucket from which you want CloudFront to get objects for this origin, for example, myawsbucket.s3.amazonaws.com.

Constraints for Amazon S3 origins:

  • The bucket name must be between 3 and 63 characters long (inclusive).

  • The bucket name must contain only lowercase characters, numbers, periods, underscores, and dashes.

  • The bucket name must not contain adjacent periods.

Custom origins: The DNS domain name for the HTTP server from which you want CloudFront to get objects for this origin, for example, www.example.com.

Constraints for custom origins:

  • DomainName must be a valid DNS name that contains only a-z, A-Z, 0-9, dot (.), hyphen (-), or underscore (_) characters.

  • The name cannot exceed 128 characters.

Type: String

Default: None

Parent: Origin

S3OriginConfig

A complex type that contains information about the Amazon S3 origin. If the origin is a custom origin, use the CustomOriginConfig element instead.

Type: Complex

Default: None

Parent: Origin

Child: OriginAccessIdentity

OriginAccessIdentity

The CloudFront origin access identity to associate with the origin. Use an origin access identity to configure the origin so that viewers can only access objects in an Amazon S3 bucket through CloudFront. The format of the value is:

origin-access-identity/cloudfront/Id

where Id is the value that CloudFront returned in the Id element when you created the origin access identity.

If you want viewers to be able to access objects using either the CloudFront URL or the Amazon S3 URL, specify an empty OriginAccessIdentity element.

To delete the origin access identity from an existing distribution, update the distribution configuration and include an empty OriginAccessIdentity element.

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 origin-access-identity/cloudfront/Id

Parent: S3OriginConfig

CustomOriginConfig

A complex type that contains information about a custom origin. If the origin is an Amazon S3 bucket, use the S3OriginConfig element instead.

Type: Complex

Default: None

Constraints: You cannot use S3OriginConfig and CustomOriginConfig in the same origin.

Parent: Origin

Children: HTTPPort, HTTPSPort, OriginProtocolPolicy

HTTPPort

The HTTP port that the custom origin listens on.

Type: Integer

Default: 80

Valid Values: 80, 443, or 1024-65535 (inclusive)

Parent: CustomOriginConfig

HTTPSPort

The HTTPS port that the custom origin listens on.

Type: Integer

Default: 443

Valid Values: 80, 443, or 1024-65535 (inclusive)

Parent: CustomOriginConfig

OriginProtocolPolicy

The protocol policy that you want CloudFront to use when fetching objects from your origin server. Choose the applicable value:

  • http-only: CloudFront only uses HTTP to access the origin.

    Important

    If your Amazon S3 bucket is configured as a website endpoint, you must specify http-only. Amazon S3 doesn't support HTTPS connections in that configuration.

  • match-viewer: CloudFront fetches objects from your origin using HTTP or HTTPS, depending on the protocol of the viewer request. CloudFront caches the object only once even if viewers make requests using both HTTP and HTTPS protocols.

    Important

    For HTTPS viewer requests that CloudFront forwards to this origin, one of the domain names in the SSL certificate on your origin server must match the domain name that you specify for DomainName. Otherwise, CloudFront responds to the viewer requests with an HTTP status code 502 (bad gateway) instead of the requested object. For more information, see How to Require HTTPS for Communication Between Viewers, CloudFront, and Your Origin in the Amazon CloudFront Developer Guide.

Type: OriginProtocolPolicy

Valid Values: http-only | match-viewer

Default: None

Parent: CustomOriginConfig

DefaultCacheBehavior

A complex type that describes the default cache behavior if you do not specify a CacheBehavior element or if files don't match any of the values of PathPattern in CacheBehavior elements. You must create exactly one default cache behavior.

Type: Complex

Default: None

Parent: DistributionConfig

Children: TargetOriginId, ForwardedValues, TrustedSigners, ViewerProtocolPolicy, MinTTL

CacheBehaviors

A complex type that contains zero or more CacheBehavior elements.

Type: Complex

Default: None

Parent: DistributionConfig

Child: Quantity, Items

Quantity (CacheBehaviors)

The number of cache behaviors for this distribution.

Type: Integer

Default: None

Parent: CacheBehaviors

Items (CacheBehaviors)

Optional: A complex type that contains cache behaviors for this distribution. If Quantity is 0, you can omit Items.

Type: Complex

Default: None

Children: CacheBehavior

Parent: CacheBehaviors

CacheBehavior

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.

For the current limit on the number of cache behaviors that you can add to a distribution, see Amazon CloudFront Limits in the Amazon Web Services General Reference. To request a higher limit, go to https://aws.amazon.com/support/createCase?type=service_limit_increase&serviceLimitIncreaseType=cloudfront-distributions.

If you don't want to specify any cache behaviors, include only an empty CacheBehaviors element. Don't include an empty CacheBehavior element, or CloudFront returns a MalformedXML error.

To delete all cache behaviors in an existing distribution, update the distribution configuration and include only an empty CacheBehaviors element.

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: Items

Children: PathPattern, TargetOriginId, ForwardedValues, TrustedSigners, ViewerProtocolPolicy, MinTTL

PathPattern

The pattern (for example, /images/*.jpg) that specifies which requests you want this cache behavior to apply to. When CloudFront receives an viewer request, the requested path is compared with path patterns in the order in which cache behaviors are listed in the distribution.

The path pattern for the default cache behavior is * and cannot be changed. If the request for an object does not match the path pattern for any cache behaviors, CloudFront applies the behavior in the default cache behavior.

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:

  • A-Z, a-z

  • 0-9

  • _ - . * $ / ~ " ' @ : +

  • * as a character in the string, specified as \*

  • &, passed and returned as &amp;

Default: None

Parent: CacheBehavior

TargetOriginId

The value of ID for the origin that you want CloudFront to route requests to when a request matches the path pattern either for a cache behavior or for the default cache behavior.

Type: String

Default: None

Parent: DefaultCacheBehavior or CacheBehavior

ForwardedValues

A complex type that specifies how CloudFront handles query strings and cookies.

Type: Complex

Default: None

Parent: DefaultCacheBehavior or CacheBehavior

Children: QueryString, Cookies, Headers

QueryString

Indicates whether you want CloudFront to forward query strings to the origin that is associated with this cache behavior. If so, specify true; if not, specify false.

Type: String

Default: None

Valid Values: true | false

Parent: ForwardedValues

Cookies

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: ForwardedValues

Children: Forward, WhitelistedNames

Forward

Specifies which cookies to forward to the origin for this cache behavior: all, none, or the list of cookies specified in the WhitelistedNames complex type.

Amazon S3 doesn't process cookies. When the cache behavior is forwarding requests to an Amazon S3 origin, specify none for the Forward element.

Type: String

Valid Values: all | whitelist | none

Default: None

Parent: Cookies

WhitelistedNames

Required if you specify whitelist for the value of Forward: A complex type that specifies how many different cookies you want CloudFront to forward to the origin for this cache behavior and, if you want to forward selected cookies, the names of those cookies.

If you specify all or none for the value of Forward, omit WhitelistedNames. If you change the value of Forward from whitelist to all or none and you don't delete the WhitelistedNames element and its child elements, CloudFront deletes them automatically.

For the current limit on the number of cookie names that you can whitelist for each cache behavior, see Amazon CloudFront Limits in the Amazon Web Services General Reference. To request a higher limit, go to https://aws.amazon.com/support/createCase?type=service_limit_increase&serviceLimitIncreaseType=cloudfront-distributions.

Type: Complex

Default: None

Parent: Cookies

Child: Quantity, Items

Quantity (WhitelistedNames)

The number of different cookies that you want CloudFront to forward to the origin for this cache behavior.

Type: Integer

Default: None

Parent: WhitelistedNames

Items (WhitelistedNames)

A complex type that contains one Name element for each cookie that you want CloudFront to forward to the origin for this cache behavior.

Type: Complex

Default: None

Children: Name

Parent: WhitelistedNames

Name (WhiteListedNames)

The name of a cookie that you want CloudFront to forward to the origin for this cache behavior.

You can specify the following wildcards to specify cookie names:

  • * matches 0 or more characters in the cookie name

  • ? matches exactly one character in the cookie name

Type: String

Default: None

Parent: Items

Headers

A complex type that specifies the headers that you want CloudFront to forward to the origin for this cache behavior.

For the headers that you specify, CloudFront also caches separate versions of a specified object based on the header values in viewer requests. For example, suppose viewer requests for logo.jpg contain a custom Product header that has a value of either Acme or Apex, and you configure CloudFront to cache your content based on values in the Product header. CloudFront forwards the Product header to the origin and caches the response from the origin once for each header value. For more information about caching based on header values, see How CloudFront Forwards and Caches Headers in the Amazon CloudFront Developer Guide.

Type: Complex

Default: None

Parent: ForwardedValues

Children: Quantity, Items

Quantity (Headers)

The number of different headers that you want CloudFront to forward to the origin for this cache behavior. You can configure each cache behavior in a web distribution to do one of the following:

  • Forward all headers to your origin – Specify 1 for Quantity and * for Name.

    Important

    If you configure CloudFront to forward all headers to your origin, CloudFront doesn't cache the objects associated with this cache behavior. Instead, it sends every request to the origin.

  • Forward a whitelist of headers that you specify – Specify the number of headers that you want to forward, and specify the header names in Name elements. CloudFront caches your objects based on the values in all of the specified headers. CloudFront also forwards the headers that it forwards by default, but it caches your objects based only on the headers that you specify.

  • Forward only the default headers – Specify 0 for Quantity and omit Items. In this configuration, CloudFront doesn't cache based on the values in the request headers.

Type: Integer

Default: None

Parent: Headers

Items (Headers)

A complex type that contains one Name element for each header that you want CloudFront to forward to the origin and to vary on for this cache behavior. If Quantity is 0, omit Items.

Type: Complex

Default: None

Parent: Headers

Child: Name

Name (Headers)

The name of a header that you want CloudFront to forward to the origin for this cache behavior. For more information, see Headers and Quantity (Headers).

When you're using an Amazon S3 origin, the only header that you can specify is the Origin header.

When you're using a custom origin, you can configure CloudFront to cache based on the value of any request header except the following:

  • Accept-Encoding

  • Connection

  • Cookie: You can forward cookies to the origin using the Cookies element as described earlier in this topic.

  • Proxy-Authorization

  • TE

  • Upgrade

For more information about the headers that you can specify when you're using a custom origin, see HTTP Request Headers and CloudFront Behavior in the Amazon CloudFront Developer Guide.

Type: String

Default: None

Parent: Items

TrustedSigners

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 PathPattern for this cache behavior, specify true for Enabled, and specify the applicable values for Quantity and Items. For more information, go to Serving Private Content through CloudFront in the Amazon CloudFront Developer Guide.

If you don't want to require signed URLs in requests for objects that match PathPattern, specify false for Enabled and 0 for Quantity. Omit Items.

To add, change, or remove one or more trusted signers, change Enabled to true (if it's currently false), change Quantity as applicable, and specify all of the trusted signers that you want to include in the updated distribution.

For more information about updating the distribution configuration, see PUT Distribution Config.

Type: Complex type

Default: None

Parent: DefaultCacheBehavior or CacheBehavior

Children: Enabled, Quantity, Items

Enabled (Trusted Signers)

Specifies whether you want to require viewers to use signed URLs to access the files specified by PathPattern and TargetOriginId.

Type: String

Default: None

Valid Values: true | false

Parent: TrustedSigners

Quantity (TrustedSigners)

The number of trusted signers for this cache behavior.

Type: Integer

Default: None

Parent: TrustedSigners

Items (TrustedSigners)

Optional: A complex type that contains trusted signers for this cache behavior. If Quantity is 0, you can omit Items.

Type: Complex

Default: None

Children: Origin

Parent: TrustedSigners

AwsAccountNumber

Specifies an AWS account that can create signed URLs. Valid values include:

  • self, which indicates that the AWS account that was used to create the distribution can created signed URLs.

  • An AWS account number. Omit the dashes in the account number.

You can specify up to five accounts (including self) per cache behavior in separate AwsAccountNumber elements. For more information, see the TrustedSigners element.

Type: String

Default: None

Parent: Items

ViewerProtocolPolicy

The protocol that viewers can use to access the files in the origin specified by TargetOriginId when a request matches the path pattern in PathPattern. You can specify the following options:

  • allow-all: Viewers can use HTTP or HTTPS.

  • redirect-to-https: If a viewer submits an HTTP request, CloudFront returns an HTTP status code of 301 (Moved Permanently) to the viewer along with the HTTPS URL. The viewer then resubmits the request using the new URL.

  • https: If a viewer sends an HTTP request, CloudFront returns an HTTP status code of 403 (Forbidden).

For more information about requiring the HTTPS protocol, go to Using an HTTPS Connection to Access Your Objects in the Amazon CloudFront Developer Guide.

Type: String

Default: None

Valid Values: allow-all, redirect-to-https, or https

Parent: DefaultCacheBehavior or CacheBehavior

Caution

The only way to guarantee that viewers 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 and Errors Stay in a CloudFront Edge Cache (Expiration) in the Amazon CloudFront Developer Guide.

MinTTL

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 and Errors Stay in a CloudFront Edge Cache (Expiration) in the Amazon CloudFront Developer Guide.

You must specify 0 for MinTTL if you configure CloudFront to forward all headers to your origin (under Headers, if you specify 1 for Quantity and * for Name).

Type: Long

Default: 0

Valid Values: 0 to ~3,153,600,000 (100 years)

Parent: DefaultCacheBehavior or CacheBehavior

AllowedMethods

A complex type that controls which HTTP methods CloudFront processes and forwards to your Amazon S3 bucket or your custom origin.

Type: Complex

Default: None

Parent: DefaultCacheBehavior or CacheBehavior

Children: Quantity, Items

Quantity (AllowedMethods)

The number of HTTP methods that you want CloudFront to forward to your origin. You specify the methods in the Methods element, and you're allowed to specify only three combinations of methods, so the only valid values are 2, 3, and 7.

Type: Integer

Default: None

Valid Values: 2, 3, and 7

Parent: AllowedMethods

Items (AllowedMethods)

A complex type that contains a Method element for each HTTP method that you want CloudFront to process and forward to your origin.

Type: Complex

Default: None

Parent: AllowedMethods

Child: Method

Method (AllowedMethods)

The HTTP methods that you want CloudFront to process and forward to your origin.

Type: Complex

Default: None

Valid Values: One of the following groups of methods. Other combinations of methods are not supported.

  • GET

  • HEAD

or:

  • GET

  • HEAD

  • OPTIONS

or:

  • DELETE

  • GET

  • HEAD

  • OPTIONS

  • PATCH

  • POST

  • PUT

Caution

If you specify GET, HEAD, OPTIONS or DELETE, GET, HEAD, OPTIONS, PATCH, POST, and PUT, you might need to restrict access to your Amazon S3 bucket or to your custom origin to prevent users from performing operations that you don't want them to perform. The following examples explain how to restrict access:

  • If you're using Amazon S3 as an origin for your distribution: Create a CloudFront origin access identity to restrict access to your Amazon S3 content, and grant the origin access identity the applicable permissions. For example, if you want to use PUT but not DELETE, you must configure Amazon S3 bucket policies or ACLs to handle DELETE requests appropriately. For more information, see Using an Origin Access Identity to Restrict Access to Your Amazon S3 Content in the Amazon CloudFront Developer Guide.

  • If you're using a custom origin: Configure your origin server to handle all methods. For example, if you want to use POST but not DELETE, you must configure your origin server to handle DELETE requests appropriately.

Parent: Items

CachedMethods

A complex type that controls the HTTP methods for which CloudFront caches responses.

Type: Complex

Default: None

Parent: DefaultCacheBehavior or CacheBehavior

Children: Quantity, Items

Quantity (CachedMethods)

The number of HTTP methods for which you want CloudFront to cache responses. You specify the methods in the Method element. You can specify only two combinations of methods (GET and HEAD, or GET, HEAD, and OPTIONS, so the only valid values for Quantity are 2 and 3.

Type: Integer

Default: None

Valid Values: 2 and 3

Parent: CachedMethods

Items (CachedMethods)

A complex type that contains a Method element for each HTTP method for which you want CloudFront to cache responses.

Type: Complex

Default: None

Parent: CachedMethods

Child: Method

Method (CachedMethods)

The HTTP methods for which you want CloudFront to cache responses.

Type: Complex

Default: None

Valid Values: One of the following groups of methods. Other combinations of methods are not supported.

  • GET

  • HEAD

or:

  • GET

  • HEAD

  • OPTIONS

If you specify GET, HEAD, and OPTIONS and the origin associated with this cache behavior is an Amazon S3 origin, you might need to forward Access-Control-Request-Headers, Access-Control-Request-Method, and Origin headers for the responses to be cached correctly. For more information, see Configuring CloudFront to Respect Cross-Origin Resource Sharing Settings in the Amazon CloudFront Developer Guide.

Parent: Items

SmoothStreaming

Indicates whether you want to distribute media files in the Microsoft Smooth Streaming format using the origin that is associated with this cache behavior. If so, specify true; if not, specify false. If you specify true for SmoothStreaming, you can still distribute other content using this cache behavior if the content matches the value of PathPattern.

Type: String

Default: None

Valid Values: true | false

Parent: DefaultCacheBehavior or CacheBehavior

CustomErrorResponses

A complex type that controls:

  • Whether CloudFront replaces HTTP status codes in the 4xx and 5xx range with custom error messages before returning the response to the viewer.

  • How long CloudFront caches HTTP status codes in the 4xx and 5xx range.

For more information about custom error pages, go to Customizing Error Responses in the Amazon CloudFront Developer Guide.

Type: Complex

Default: None

Parent: DistributionConfig

Children: Quantity, Items

Quantity (CustomErrorResponses)

The number of HTTP status codes for which you want to specify a custom error page and/or a caching duration. If Quantity is 0, you can omit Items.

Type: Integer

Default: None

Parent: CustomErrorResponses

Items (CustomErrorResponses)

A complex type that contains a CustomErrorResponse element for each HTTP status code for which you want to specify a custom error page and/or a caching duration.

Type: Complex

Default: None

Parent: CustomErrorResponses

Child: CustomErrorResponse

CustomErrorResponse

A complex type that contains information about one HTTP status code for which you want to specify a custom error page and/or a caching duration.

Type: Complex

Default: None

Parent: Items

Children: ErrorCode, ResponsePagePath, ResponseCode, ErrorCachingMinTTL

ErrorCode

The HTTP status code for which you want to specify a custom error page and/or a caching duration. For a list of supported HTTP status codes, see "Valid values."

Type: Integer

Default: None

Valid values:

  • 400, 403, 404, 405, 414

  • 500, 501, 502, 503, 504

Parent: CustomErrorResponse

ResponsePagePath

The path to the custom error page that you want CloudFront to return to a viewer when your origin returns the HTTP status code specified by ErrorCode, for example, /4xx-errors/403-forbidden.html. If you want to store your objects and your custom error pages in different locations, your distribution must include a cache behavior for which the following is true:

  • The value of Path Pattern matches the path to your custom error messages. For example, suppose you saved custom error pages for 4xx errors in an Amazon S3 bucket in a directory named /4xx-errors. Your distribution must include a cache behavior for which the path pattern routes requests for your custom error pages to that location, for example, /4xx-errors/*.

  • The value of Origin specifies the value of Origin ID for the origin that contains your custom error pages.

If you specify a value for ResponsePagePath, you must also specify a value for ResponseCode. If you don't want to specify a value, include an empty element, <ResponsePagePath/>, in the XML document.

We recommend that you store custom error pages in an Amazon S3 bucket. If you store custom error pages on an HTTP server and the server starts to return 5xx errors, CloudFront can't get the files that you want to return to viewers because the origin server is unavailable.

Type: String

Default: None

Constraints: Maximum 4000 characters

Parent: CustomErrorResponse

ResponseCode

The HTTP status code that you want CloudFront to return to the viewer along with the custom error page. There are a variety of reasons that you might want CloudFront to return a status code different from the status code that your origin returned to CloudFront, for example:

  • Some Internet devices (some firewalls and corporate proxies, for example) intercept HTTP 4xx and 5xx and prevent the response from being returned to the viewer. If you substitute 200, the response typically won't be intercepted.

  • If you don't care about distinguishing among different client errors or server errors, you can specify 400 or 500 as the ResponseCode for all 4xx or 5xx errors.

  • You might want to return a 200 status code (OK) and static website so your customers don't know that your website is down.

If you specify a value for ResponseCode, you must also specify a value for ResponsePagePath. If you don't want to specify a value, include an empty element, <ResponseCode/>, in the XML document.

Type: Integer

Default: None

Valid values:

  • 200

  • 400, 403, 404, 405, 414

  • 500, 501, 502, 503, 504

Parent: CustomErrorResponse

ErrorCachingMinTTL

The minimum amount of time, in seconds, that you want CloudFront to cache the HTTP status code specified in ErrorCode. When this time period has elapsed, CloudFront queries your origin to see whether the problem that caused the error has been resolved and the requested object is now available.

If you don't want to specify a value, include an empty element, <ErrorCachingMinTTL/>, in the XML document.

For more information, see Customizing Error Responses in the Amazon CloudFront Developer Guide.

Type: Long

Default: 300 (in seconds—applied if you omit the ErrorCachingMinTTL element when you create a CloudFront distribution)

Valid Values: 0 to ~3,153,600,000 (100 years)

Parent: CustomErrorResponse

Restrictions

A complex type that identifies ways in which you want to restrict the ability of viewers to access your content.

Type: Complex

Default: None

Parent: DistributionConfig

Child: GeoRestriction

GeoRestriction

A complex type that controls the countries in which viewers are able to access your content. For more information about geo restriction, go to Restrictions in the Amazon CloudFront Developer Guide.

If a viewer tries to access your content from a country either that is not on the white list or that is on the blacklist for your distribution, CloudFront returns an HTTP 403 status code to the viewer. You can optionally configure CloudFront to return a custom error message to the viewer, and you can specify how long you want CloudFront to cache the error response for the requested object; the default value is five minutes. For more information, see the CustomErrorResponses element earlier in this topic.

Type: Complex

Default: None

Parent: Restrictions

Children: RestrictionType, Quantity, Items

RestrictionType

The method that you want to use to restrict distribution of your content by country:

  • blacklist: The Location elements specify the countries in which you do not want viewers to be able to access your content.

  • whitelist: The Location elements specify the countries in which you want viewers to be able to access your content.

  • none: You don't want to restrict distribution by country. If you specify none for RestrictionType, you must specify 0 for Quantity and omit Items.

Type: String

Default: No default value

Parent: GeoRestriction

Quantity (GeoRestriction)

The number of countries in your whitelist or blacklist. If Quantity is 0, you can omit Items.

Type: Integer

Default: None

Parent: GeoRestriction

Items (GeoRestriction)

A complex type that contains a Location element for each country in which you want viewers to have access to your content (whitelist) or not have access to your content (blacklist).

Type: Complex

Default: None

Parent: GeoRestriction

Child: Location

Location

The two-letter, uppercase country code for a country that you want to include in your blacklist or whitelist. Include one Location element for each country.

We use the International Organization for Standardization country codes. For an easy-to-use list, sortable by code and by country name, see the Wikipedia entry ISO 3166-1 alpha-2.

Type: String

Default: None

Parent: Items

Comment

Any comments you want to include about the distribution.

If you don't want to specify a comment, include an empty Comment element.

To delete an existing comment, update the distribution configuration and include an empty Comment element.

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: DistributionConfig

Logging

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: DistributionConfig

Children: Bucket, Prefix

Enabled (Logging)

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 false for Enabled, and specify empty Bucket and Prefix elements.

If you specify false for Enabled but you specify values for Bucket and Prefix, the values are automatically deleted.

Type: String

Default: None

Valid Values: true | false

Parent: Logging

IncludeCookies

If you want CloudFront to include cookies in access logs, specify true. If you choose to include cookies in logs, CloudFront logs all cookies regardless of whether you configure the distribution to forward all cookies, no cookies, or a specified list of cookies to the origin. For more information about forwarding cookies, see the Cookies complex type earlier in this topic.

Type: String

Default: None

Valid Values: true | false

Parent: Logging

Bucket

The Amazon S3 bucket to store the access logs in, for example, myawslogbucket.s3.amazonaws.com.

For more information, see the Enabled (Logging) element.

Type: String

Default: None

Constraints: Maximum 128 characters

Parent: Logging

Prefix

An optional string that you want CloudFront to prefix to the access log filenames for this distribution, for example, myprefix/.

If you want to enable logging, but you do not want to specify a prefix, you still must include an empty Prefix element in the Logging element.

For more information, see the Logging element.

Type: String

Default: None

Constraints: Maximum 256 characters; the string must not start with a slash ( / ).

Parent: Logging

ViewerCertificate

A complex type that specifies which certificate to use when viewers request objects using HTTPS:

  • A custom certificate that you have uploaded to the IAM certificate store, which you use when the URLs for your objects include an alternate domain name, for example, https://www.example.com/image.jpg.

  • The default CloudFront certificate, which you use when the URLs for your objects include the CloudFront domain name, for example, https://d111111abcdef8.cloudfront.net/image.jpg.

For more information, go to Using Alternate Domain Names and HTTPS in the Amazon CloudFront Developer Guide.

Type: Complex type

Default: None

Parent: DistributionConfig

Children: IAMCertificateId, CloudFrontDefaultCertificate, SSLSupportMethod

IAMCertificateId / CloudFrontDefaultCertificate

If you want viewers to use HTTP to request your objects: Specify the following value:

<CloudFrontDefaultCertificate>true</CloudFrontDefaultCertificate>

In addition, specify allow-all for ViewerProtocolPolicy for all of your cache behaviors.

If you want viewers to use HTTPS to request your objects: Choose the type of certificate that you want to use based on whether you're using an alternate domain name for your objects or the CloudFront domain name:

  • If you're using an alternate domain name, such as example.com: Specify <IAMCertificateId>IAM certificate ID</IAMCertificateId> where IAM certificate ID is the ID that IAM returned when you added the certificate to the IAM certificate store.

    If you specify IAMCertificateId, you must also specify a value for SSLSupportMethod.

    If you choose to use a certificate in the IAM certificate store, we recommend that you use only an alternate domain name in your object URLs (https://example.com/logo.jpg). If you use the domain name that is associated with your CloudFront distribution (https://d111111abcdef8.cloudfront.net/logo.jpg) and the viewer supports SNI, then CloudFront behaves normally. However, if the browser does not support SNI, the user's experience depends on the value that you choose for SSLSupportMethod:

    • vip: The viewer displays a warning because there is a mismatch between the CloudFront domain name and the domain name in your SSL certificate.

    • sni-only: CloudFront drops the connection with the browser without returning the object.

  • If you're using the CloudFront domain name for your distribution, such as d111111abcdef8.cloudfront.net: Specify <CloudFrontDefaultCertificate>true</CloudFrontDefaultCertificate>.

Specify only one value or the other, not both. Do not specify false for CloudFrontDefaultCertificate.

In addition, if you want viewers to use HTTPS, you must also specify one of the following values in your cache behaviors:

  • <ViewerProtocolPolicy>https-only</ViewerProtocolPolicy>

  • <ViewerProtocolPolicy>redirect-to-https</ViewerProtocolPolicy>

You can also optionally require that CloudFront use HTTPS to communicate with your origin:

<OriginProtocolPolicy>match-viewer</OriginProtocolPolicy>

For more information, go to Using Alternate Domain Names and HTTPS in the Amazon CloudFront Developer Guide.

Type:

  • IAMCertificateId: String

  • CloudFrontDefaultCertificate: Boolean

Default: None

Parent: ViewerCertificate

SSLSupportMethod

If you specify a value for IAMCertificateId, you must also specify how you want CloudFront to serve HTTPS requests: using a method that works for all clients or one that works for most clients:

  • vip: CloudFront uses dedicated IP addresses for your content and can respond to HTTPS requests from any viewer. However, you must request permission to use this feature, and you incur additional monthly charges.

  • sni-only: CloudFront can only respond to HTTPS requests from viewers that support Server Name Indication (SNI). All modern browsers support SNI, but some browsers still in use don't support SNI. If some of your users' browsers don't support SNI, we recommend that you do one of the following:

    • Use the vip option (dedicated IP addresses) instead of sni-only.

    • Use the CloudFront SSL certificate instead of a custom certificate. This requires that you use the CloudFront domain name of your distribution in the URLs for your objects, for example, https://d111111abcdef8.cloudfront.net/logo.png.

    • If you can control which browser your users use, upgrade the browser to one that supports SNI.

    • Use HTTP instead of HTTPS.

Do not specify a value for SSLSupportMethod if you specified <CloudFrontDefaultCertificate>true</CloudFrontDefaultCertificate>.

For more information, go to Using Alternate Domain Names and HTTPS in the Amazon CloudFront Developer Guide.

Type: String

Default: None

Parent: ViewerCertificate

PriceClass

The price class that corresponds with the maximum price that you want to pay for CloudFront service. If you specify PriceClass_All, CloudFront responds to requests for your objects from all CloudFront edge locations.

If you specify a price class other than PriceClass_All, CloudFront serves your objects from the CloudFront edge location that has the lowest latency among the edge locations in your price class. Viewers who are in or near regions that are excluded from your specified price class may encounter slower performance.

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:

  • PriceClass_All: Requests are routed to all CloudFront edge locations based entirely on latency.

  • PriceClass_200: Requests are routed to more edge locations than with PriceClass_100 but not to all edge locations.

  • PriceClass_100: Requests are routed to edge locations in the least-expensive CloudFront regions.

Parent: DistributionConfig

Enabled (DistributionConfig)

Whether the distribution is enabled to accept end user requests for content.

Type: String

Default: None

Valid Values: true | false

Parent: DistributionConfig

Example

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/2014-08-31/">
   <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>
         <Headers>
            <Quantity>1<Quantity>
            <Items>
               <Name>Origin</Name>
            <Items>
         </Headers>
      </ForwardedValues>
      <TrustedSigners>
         <Enabled>true</Enabled>
         <Quantity>3</Quantity>
         <Items>
            <AwsAccountNumber>self</AwsAccountNumber>
            <AwsAccountNumber>111122223333</AwsAccountNumber>
            <AwsAccountNumber>444455556666</AwsAccountNumber>
         </Items>
      </TrustedSigners>
      <ViewerProtocolPolicy>redirect-to-https</ViewerProtocolPolicy>
      <MinTTL>0</MinTTL>
      <AllowedMethods>
         <Quantity>2</Quantity>
         <Items>
            <Method>GET</Method>
            <Method>HEAD</Method>
         </Items>
      </AllowedMethods>
      <CachedMethods>
         <Quantity>2</Quantity>
         <Items>
            <Method>GET</Method>
            <Method>HEAD</Method>
         </Items>
      </CachedMethods>
      <SmoothStreaming>false</SmoothStreaming>
   </DefaultCacheBehavior>
   <CacheBehaviors>
      <Quantity>1</Quantity>
      <Items>
         <CacheBehavior>
            <PathPattern>*.jpg</PathPattern>
            <TargetOriginId>example-custom-origin</TargetOriginId>
            <ForwardedValues>
               <QueryString>false</QueryString>
               <Cookies>
                  <Forward>all</Forward>
               </Cookies>
               <Headers>
                  <Quantity>1<Quantity>
                  <Items>
                     <Name>Origin</Name>
                  <Items>
               </Headers>
            </ForwardedValues>
            <TrustedSigners>
               <Enabled>true</Enabled>
               <Quantity>2</Quantity>
               <Items>
                  <AwsAccountNumber>self</AwsAccountNumber>
                  <AwsAccountNumber>111122223333</AwsAccountNumber>
               </Items>
            </TrustedSigners>
            <ViewerProtocolPolicy>allow-all</ViewerProtocolPolicy>
            <MinTTL>86400</MinTTL>
            <AllowedMethods>
               <Quantity>2</Quantity>
               <Items>
                  <Method>GET</Method>
                  <Method>HEAD</Method>
               </Items>
            </AllowedMethods>
            <CachedMethods>
               <Quantity>2</Quantity>
               <Items>
                  <Method>GET</Method>
                  <Method>HEAD</Method>
               </Items>
            </CachedMethods>
            <SmoothStreaming>false</SmoothStreaming>
         </CacheBehavior>
      </Items>
   </CacheBehaviors>
   <CustomErrorResponses>
      <Quantity>1</Quantity>
      <Items>
         <CustomErrorResponse>
            <ErrorCode>404</ErrorCode>
            <ResponsePagePath>/error-pages/404.html</ResponsePagePath>
            <ResponseCode>200</ResponseCode>
            <ErrorCachingMinTTL>30</ErrorCachingMinTTL>
         </CustomErrorResponse>
      </Items>
   </CustomErrorResponses>
   <Restrictions>
      <GeoRestriction>
         <RestrictionType>whitelist</RestrictionType>
         <Quantity>2</Quantity>
         <Items>
            <Location>AQ</Location>
            <Location>CV</Location>
         </Items>
      </GeoRestriction>
   </Restrictions>
   <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>
      <SSLSupportMethod>vip</SSLSupportMethod>
   </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/2014-08-31/">
   <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>