| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Amazon CloudFront REST requests are HTTPS requests, as defined by RFC 2616. For more information, go to http://www.ietf.org/rfc/rfc2616.txt. This section describes the structure of a CloudFront REST request. For detailed descriptions of the actions you can perform, go to the Amazon CloudFront API Reference.
A typical REST action consists of sending a single HTTPS request to CloudFront, and waiting for the HTTP response. Like any HTTP request, a REST request to CloudFront contains a request method, a URI, request headers, and sometimes a query string or request body. The response contains an HTTP status code, response headers, and sometimes a response body.
The request URI always starts with a forward slash and then the version of the CloudFront API you use, for example, 2012-07-01. The remainder of the URI indicates the particular resource you want to act on. For example, following is the URI you use when creating a new distribution:
/2012-07-01/distribution
For more information about creating a distribution using the CloudFront API, go to POST Distribution in the Amazon CloudFront API Reference).
The following table lists the HTTP headers that CloudFront REST requests use.
| Header Name | Description | Required |
|---|---|---|
|
The information required for request authentication. For more information, see Authenticating REST Requests. | Yes |
|
Length of the message (without the headers) according to RFC 2616. Condition: Required if the request body itself contains information (most toolkits add this header automatically). | Conditional |
|
The content type of the resource. Example:
Condition: Required for POST and PUT requests. | Conditional |
|
The date used to create the signature contained in the Condition: Required unless you provide the | Conditional |
|
The host being requested. The value must be Condition: Required for HTTP 1.1. Most toolkits add this header automatically. | Conditional |
|
The date used to create the signature contained in the Condition: Required if you do not provide the | Conditional |
You must provide the time stamp in either the HTTP Date header or the AWS
x-amz-date header (some HTTP client libraries don't let you set the
Date header). When an x-amz-date header is present, the system
ignores any Date header when authenticating the request.
The time stamp must be within 15 minutes of the AWS system time when the request is received. If
it isn't, the request fails with the RequestExpired error code. This is to prevent
replays of your requests by an adversary.
Many of the CloudFront API actions require you to include XML in the body of the request. The XML conforms to the CloudFront schema. The topics in this guide that describe the API actions show the structure of the XML required in the request.
The following example request creates a distribution in the CloudFront system.
POST /2012-07-01/distribution HTTP/1.1
Host: cloudfront.amazonaws.com
Authorization: [AWS authentication string]
Date: Thu, 17 May 2012 19:37:58 GMT
[Other required headers]
<?xml version="1.0" encoding="UTF-8"?>
<DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2012-07-01/">
<CallerReference>example.com2012-04-11-5:09pm</CallerReference>
<Aliases>
...
</Aliases>
<DefaultRootObject>index.html</DefaultRootObject>
<Origins>
...
</Origins>
<CacheBehaviors>
...
</CacheBehaviors>
<Comment>example comment</Comment>
<Logging>
...
</Logging>
<PriceClass>PriceClass_All</PriceClass>
<Enabled>true</Enabled>
</DistributionConfig>Related Topics