Disabling and deleting a CloudFront distribution

To delete a CloudFront distribution, we need to disable it first. To disable it, we need to use update-distribution, specifying a distribution-config JSON file with all of the existing properties, with the following change:

"Enabled": false,

For the initial JSON file for the update, we can copy and paste the value of DistributionConfig from the get-distribution sub-command response. Note that some properties, such as calling the reference or origin, cannot be updated.

Execute the update-distribution sub-command to disable the distribution.

aws cloudfront update-distribution 
--id E18OUP1REXZHGA
--if-match EV3RMCDP8DYAA
--distribution-config file://resources/distr-config-disable.json
--profile admin

Here, the value for id is the ID of the distribution, and the value for if-match is the value of the Etag from the previous request. It will take some time to process the update request. We can check the status by using the get-description sub-command, until it changes from InProgress to Deployed. After that, we can delete the distribution:

aws cloudfront delete-distribution 
--id E18OUP1REXZHGA
--if-match E2CDLHTOPGMT5J
--profile admin

Here, the value for if-match is the value of the Etag from the previous update request. For updates and deletes, we will also need to pass the Etag that we received in the previous step. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.34.197