| Did this page help you? Yes No Tell us about it... |
This action creates a new distribution. You can create up to 100 per AWS account.
To create a new distribution, you do a POST on the 2010-11-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 about the parts of a distribution and creating
distributions, see Working with Distributions
in the Amazon CloudFront Developer Guide.
POST /2010-11-01/distribution HTTP/1.1 Host: cloudfront.amazonaws.com Authorization:AWS authentication stringDate: [time stamp]Other required headers<?xml version="1.0" encoding="UTF-8"?> <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> <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> </DistributionConfig>
Use the | |
Use the |
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/2010-11-01/">
<Id>EDFDVBD632BHDS5</Id>
<Status>InProgress</Status>
<LastModifiedTime>2009-11-19T19:37:58Z</LastModifiedTime>
<DomainName>d604721fxaaqy9.cloudfront.net</DomainName>
<DistributionConfig>
<S3Origin>
<DNSName>mybucket.s3.amazonaws.com</DNSName>
<OriginAccessIdentity>
origin-access-identity/cloudfront/E127EXAMPLE51Z
</OriginAccessIdentity>
</S3Origin>
<CustomOrigin>
<DNSName>www.example.com</DNSName>
<HTTPPort>80</HTTPPort>
<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>
</DistributionConfig>
</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 Amazon S3 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 the HTTPS protocol. Ensure that you specify
the HTTPS protocol in your request, or omit the |
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 /2010-11-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/2010-11-01/">
<S3Origin>
<DNSName>mybucket.s3.amazonaws.com</DNSName>
</S3Origin>
<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/2010-11-01/distribution/EDFDVBD632BHDS5
x-amz-request-id: request_id
<?xml version="1.0" encoding="UTF-8"?>
<Distribution xmlns="http://cloudfront.amazonaws.com/doc/2010-11-01/">
<Id>EDFDVBD632BHDS5</Id>
<Status>InProgress</Status>
<LastModifiedTime>2009-11-19T19:37:58Z</LastModifiedTime>
<DomainName>d604721fxaaqy9.cloudfront.net</DomainName>
<DistributionConfig>
<S3Origin>
<DNSName>mybucket.s3.amazonaws.com</DNSName>
</S3Origin>
<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 /2010-11-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/2010-11-01/">
<S3Origin>
<DNSName>mybucket.s3.amazonaws.com</DNSName>
</S3Origin>
<CallerReference>20091130090000</CallerReference>
<Comment>My comments</Comment>
<Enabled>true</Enabled>
</DistributionConfig>