This action creates a new distribution. You can create up to 100 per AWS account. For more information about distributions, go to Working with Distributions in the Amazon CloudFront Developer Guide.
To create a new distribution, you do a POST on the 2009-12-01/distribution
resource. The request body must include an XML document with a DistributionConfig
element. The response echoes the DistributionConfig element and returns other
metadata about the distribution. For more information, go to Parts of a Basic Distribution
in the Amazon CloudFront Developer Guide.
POST /2009-12-01/distribution HTTP/1.1
Host: cloudfront.amazonaws.com
Authorization: [AWS authentication string]
Date: [time stamp]
[Other required headers]
<?xml version="1.0" encoding="UTF-8"?>
<DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2009-12-01/">
...
See the description of the DistributionConfig element
for required and optional child elements
...
</DistributionConfig>The request must include the headers required in all CloudFront requests. For more information, see Common REST Headers.
| Name | Description | Required |
|---|---|---|
|
|
The distribution's configuration information. For more information, see DistributionConfig Complex Type. Type: Default: None |
Yes |
201 Created Location: [URI of new distribution] x-amz-request-id: [Request ID] <?xml version="1.0" encoding="UTF-8"?> <Distribution xmlns="http://cloudfront.amazonaws.com/doc/2009-12-01/"> ... See the description of the Distribution element for a list of child elements that can appear here ... </Distribution>
| Name | Description |
|---|---|
|
|
The fully qualified URI of the new distribution resource just
created. For example: Type: String |
| Name | Description |
|---|---|
|
|
The distribution's information. For more information, see Distribution Complex Type. Type: |
The following table lists the special errors returned in addition to the common errors all actions return (for more information, see Errors).
| Error | Description | HTTP Status Code |
|---|---|---|
|
|
One or more of the CNAMEs you provided are already associated with a different distribution. |
409 |
|
|
The caller reference you attempted to create the distribution with is associated with another distribution. |
409 |
|
|
The origin server specified does not refer to a valid Amazon S3 bucket. |
400 |
|
|
The origin access identity is not valid or doesn't exist. |
400 |
|
|
This operation requires a body. Ensure that the body is present and the Content-Type header is set. |
400 |
|
|
Your request contains more CNAMEs than are allowed per distribution. |
400 |
|
|
Processing your request would cause you to exceed the maximum number of distributions allowed. |
400 |
|
|
Your request contains more trusted signers than are allowed per distribution. |
400 |
|
|
One or more of your trusted signers do not exist. |
400 |
The following example request creates a new public content distribution that corresponds to the bucket mybucket.s3.amazonaws.com. The request includes a CNAME alias, and the request enables logging.
POST /2009-12-01/distribution HTTP/1.1
Host: cloudfront.amazonaws.com
Authorization: AWS O39F6A430S6FJNPPGDR2:frJIUN8DYpKDtOLEXAMPLE=
Date: Thu, 19 Nov 2009 19:37:58 GMT
[Other required headers]
<?xml version="1.0" encoding="UTF-8"?>
<DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2009-12-01/">
<Origin>mybucket.s3.amazonaws.com</Origin>
<CallerReference>20091130090000</CallerReference>
<CNAME>beagles.com</CNAME>
<Comment>My comments</Comment>
<Enabled>true</Enabled>
<Logging>
<Bucket>mylogs.s3.amazonaws.com</Bucket>
<Prefix>myprefix/</Prefix>
</Logging>
</DistributionConfig>201 Created
Location: https://cloudfront.amazonaws.com/2009-12-01/distribution/EDFDVBD632BHDS5
x-amz-request-id: request_id
<?xml version="1.0" encoding="UTF-8"?>
<Distribution xmlns="http://cloudfront.amazonaws.com/doc/2009-12-01/">
<Id>EDFDVBD632BHDS5</Id>
<Status>InProgress</Status>
<LastModifiedTime>2009-11-19T19:37:58Z</LastModifiedTime>
<DomainName>d604721fxaaqy9.cloudfront.net</DomainName>
<DistributionConfig>
<Origin>mybucket.s3.amazonaws.com</Origin>
<CallerReference>20091130090000</CallerReference>
<CNAME>beagles.com</CNAME>
<Comment>My comments</Comment>
<Enabled>true</Enabled>
<Logging>
<Bucket>mylogs.s3.amazonaws.com</Bucket>
<Prefix>myprefix/</Prefix>
</Logging>
</DistributionConfig>
</Distribution>The following example request creates a public content distribution, but without a CNAME
alias, and without logging enabled. Only include a CNAME element if you have a
CNAME you want to specify. Don't include an empty CNAME element. If you do,
CloudFront returns a MalformedXML error.
POST /2009-12-01/distribution HTTP/1.1 Host: cloudfront.amazonaws.com Authorization: AWS O39F6A430S6FJNPPGDR2:frJIUN8DYpKDtOLEXAMPLE= Date: Thu, 19 Nov 2009 19:37:58 GMT [Other required headers] <?xml version="1.0" encoding="UTF-8"?> <DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2009-12-01/"> <Origin>mybucket.s3.amazonaws.com</Origin> <CallerReference>20091130090000</CallerReference> <Comment>My comments</Comment> <Enabled>true</Enabled> </DistributionConfig>