- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
CreateInvalidationCommand
Create a new invalidation. For more information, see Invalidating files in the Amazon CloudFront Developer Guide.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { CloudFrontClient, CreateInvalidationCommand } from "@aws-sdk/client-cloudfront"; // ES Modules import
// const { CloudFrontClient, CreateInvalidationCommand } = require("@aws-sdk/client-cloudfront"); // CommonJS import
const client = new CloudFrontClient(config);
const input = { // CreateInvalidationRequest
DistributionId: "STRING_VALUE", // required
InvalidationBatch: { // InvalidationBatch
Paths: { // Paths
Quantity: Number("int"), // required
Items: [ // PathList
"STRING_VALUE",
],
},
CallerReference: "STRING_VALUE", // required
},
};
const command = new CreateInvalidationCommand(input);
const response = await client.send(command);
// { // CreateInvalidationResult
// Location: "STRING_VALUE",
// Invalidation: { // Invalidation
// Id: "STRING_VALUE", // required
// Status: "STRING_VALUE", // required
// CreateTime: new Date("TIMESTAMP"), // required
// InvalidationBatch: { // InvalidationBatch
// Paths: { // Paths
// Quantity: Number("int"), // required
// Items: [ // PathList
// "STRING_VALUE",
// ],
// },
// CallerReference: "STRING_VALUE", // required
// },
// },
// };
CreateInvalidationCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
DistributionId Required | string | undefined | The distribution's id. |
InvalidationBatch Required | InvalidationBatch | undefined | The batch information for the invalidation. |
CreateInvalidationCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
Invalidation | Invalidation | undefined | The invalidation's information. |
Location | string | undefined | The fully qualified URI of the distribution and invalidation batch request, including the |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
AccessDenied | client | Access denied. |
BatchTooLarge | client | Invalidation batch specified is too large. |
InconsistentQuantities | client | The value of |
InvalidArgument | client | An argument is invalid. |
MissingBody | client | This operation requires a body. Ensure that the body is present and the |
NoSuchDistribution | client | The specified distribution does not exist. |
TooManyInvalidationsInProgress | client | You have exceeded the maximum number of allowable InProgress invalidation batch requests, or invalidation objects. |
CloudFrontServiceException | Base exception class for all service exceptions from CloudFront service. |