CreateInvalidation - Amazon CloudFront

CreateInvalidation

Create a new invalidation. For more information, see Invalidating files in the Amazon CloudFront Developer Guide.

Request Syntax

POST /2020-05-31/distribution/DistributionId/invalidation HTTP/1.1 <?xml version="1.0" encoding="UTF-8"?> <InvalidationBatch xmlns="http://cloudfront.amazonaws.com/doc/2020-05-31/"> <CallerReference>string</CallerReference> <Paths> <Items> <Path>string</Path> </Items> <Quantity>integer</Quantity> </Paths> </InvalidationBatch>

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in XML format.

InvalidationBatch

Root level tag for the InvalidationBatch parameters.

Required: Yes

CallerReference

A value that you specify to uniquely identify an invalidation request. CloudFront uses the value to prevent you from accidentally resubmitting an identical request. Whenever you create a new invalidation request, you must specify a new value for CallerReference and change other values in the request as applicable. One way to ensure that the value of CallerReference is unique is to use a timestamp, for example, 20120301090000.

If you make a second invalidation request with the same value for CallerReference, and if the rest of the request is the same, CloudFront doesn't create a new invalidation request. Instead, CloudFront returns information about the invalidation request that you previously created with the same CallerReference.

If CallerReference is a value you already sent in a previous invalidation batch request but the content of any Path is different from the original request, CloudFront returns an InvalidationBatchAlreadyExists error.

Type: String

Required: Yes

Paths

A complex type that contains information about the objects that you want to invalidate. For more information, see Specifying the Objects to Invalidate in the Amazon CloudFront Developer Guide.

Type: Paths object

Required: Yes

Response Syntax

HTTP/1.1 201 <?xml version="1.0" encoding="UTF-8"?> <Invalidation> <CreateTime>timestamp</CreateTime> <Id>string</Id> <InvalidationBatch> <CallerReference>string</CallerReference> <Paths> <Items> <Path>string</Path> </Items> <Quantity>integer</Quantity> </Paths> </InvalidationBatch> <Status>string</Status> </Invalidation>

Response Elements

If the action is successful, the service sends back an HTTP 201 response.

The following data is returned in XML format by the service.

Invalidation

Root level tag for the Invalidation parameters.

Required: Yes

CreateTime

The date and time the invalidation request was first made.

Type: Timestamp

Id

The identifier for the invalidation request. For example: IDFDVBD632BHDS5.

Type: String

InvalidationBatch

The current invalidation information for the batch request.

Type: InvalidationBatch object

Status

The status of the invalidation request. When the invalidation batch is finished, the status is Completed.

Type: String

Errors

For information about the errors that are common to all actions, see Common Errors.

AccessDenied

Access denied.

HTTP Status Code: 403

BatchTooLarge

Invalidation batch specified is too large.

HTTP Status Code: 413

InconsistentQuantities

The value of Quantity and the size of Items don't match.

HTTP Status Code: 400

InvalidArgument

An argument is invalid.

HTTP Status Code: 400

MissingBody

This operation requires a body. Ensure that the body is present and the Content-Type header is set.

HTTP Status Code: 400

NoSuchDistribution

The specified distribution does not exist.

HTTP Status Code: 404

TooManyInvalidationsInProgress

You have exceeded the maximum number of allowable InProgress invalidation batch requests, or invalidation objects.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: