Amazon CloudFront
Developer Guide (API Version 2010-11-01)
Print this pageEmail this pageGo to the ForumsView the PDFShare this page on TwitterShare this page on FacebookBookmark this page on DeliciousSubmit this page to RedditSubmit this page to DiggDid this page help you?  Yes  No   Tell us about it...

Deleting a Distribution

You can have up to 100 distributions of each type (download and streaming) in the Amazon CloudFront system. However, you might find that you no longer want to use a particular distribution. The following figure and table describe the process you must use to delete a distribution.

Basic flow for deleting a distribution

Process for Deleting a Distribution

1

You disable the distribution and get the value of the ETag header in the response to your PUT request.

Specifically, you update the distribution's configuration to have the Enabled value set to false. For information about updating a distribution's configuration, see Updating a Distribution's Configuration.

2

You confirm that the distribution is disabled.

This task is optional; if you try to delete the distribution before it is fully disabled, CloudFront returns a DistributionNotDisabled error (HTTP status code 409).

To confirm the distribution is disabled, you fetch the distribution's information and confirm the value of the Status is Deployed and not InProgress (Deployed indicates your request to disable the distribution has propagated throughout the CloudFront system). For information about fetching a download distribution's information, go to GET Distribution in the Amazon CloudFront API Reference.

After the distribution is disabled, any end-user requests that use the domain name associated with the distribution will fail.

3

You send a request to delete the distribution and include the HTTP If-Match header set to the value of the ETag header you received in task 1.

For more information, go to DELETE Distribution in the Amazon CloudFront API Reference.

4

AWS confirms that the version number you sent in the If-Match header matches the current version of the configuration information.

If it does, your request is processed.

If it does not, this means that someone else has modified the distribution since you disabled it (and possibly re-enabled it). In this case, CloudFront returns a PreconditionFailed error (HTTP status code 412). You should then repeat tasks 1-3. In task 1 you'll get a different value for the ETag header than you did the first time, and you must provide that new value in task 3.