简体   繁体   中英

AWS CLI delete cloudfront distribution - InvalidIfMatchVersion

I am trying to delete a cloudfront distribution via the AWS CLI. Doing

aws cloudfront delete-distribution --id <DISTRIBUTION-ID>

I am getting the following error:

A client error (InvalidIfMatchVersion) occurred when calling the DeleteDistribution operation: 
The If-Match version is missing or not valid for the resource.

I do not quite understand, what this error means and how to get around it.

From this documentation I assume, that it is necessary to disable the distribution first. But if so - how do I to do this with the CLI?

What is the error that you received? You have not provided an Etag to the CloudFront API when you are modifying your distribution. The possible reason they have this check is that you are not overriding a change that someone else made with your current change.

To get the Etag , run the following command:

$ aws cloudfront get-distribution-config --id E123456

Truncated example output:

{ "ETag": "ETAGEXAMPLE",

$ aws cloudfront delete-distribution --id E123456 --if-match ETAGEXAMPLE

You will ultimately get

"A client error (DistributionNotDisabled) occurred when calling the DeleteDistribution operation: The distribution you are trying to delete has not been disabled.".

You will need to submit an update that disables your distribution and then you will be able to delete it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM