Tutorial to delete amazon S3 glacier vault using AWS CLI
Learning Objectives:
Learn to download amazon S3 glacier vault Inventory.
Learn to delete Archive files from amazon S3 glacier vault.
Step 1:
We will using AWS Cloud9 EC2 development environment. To know how to create Cloud9 IDE visit our Cloud9 IDE tutorial.
In a terminal session in the AWS Cloud9 IDE, Run the yum update (for Amazon Linux) command to help ensure the latest security updates and bug fixes are installed.
For Amazon Linux
sudo yum update
Step 2:
Use the describe-vault command to check status of the vault.
aws glacier describe-vault --account-id - --vault-name myvault
Use the initiate-job command to start an inventory retrieval job.
aws glacier initiate-job --account-id - --vault-name myvault2 --job-parameters "{ \"Type\": \"inventory-retrieval\" }"
Expected output:
Copy & save this Job-ID mark in red box for further use.
Use the describe-job command to check status of the previous retrieval job.
aws glacier describe-job --vault-name myvault2 --account-id - --job-id “-“
Wait for the job to complete.
You must wait until the job output is ready for you to download. It will take up
6 to 7 Hrs. The job ID does not expire for at least 24 hours after S3 Glacier completes the job.
You can delete the Cloud9 IDE to avoid aws charges.
After some time run the same describe-job command to check status of the previous retrieval job.
aws glacier describe-job --vault-name myvault2 --account-id - --job-id “-“
When it's complete, use the get-job-output command to download the retrieval job to the file output.json.
aws glacier get-job-output --vault-name myvault --account-id - --job-id *** output.json
In the left side of your environment panel output.json file will appear.
Right click on the file and download it. And open file with Notepad.
This command produces a file with the following fields.
Copy the Archive-id Replace your account id and vault name with “xyz” and paste your archive id here ***archive-id*** that we copy before and run the command
aws glacier delete-archive --vault-name xyz --account-id - --archive-id="*** archiveid ***"
After running this command you will not get any outcome instantly. You have to wait for 6 to 7 Hrs.
You can delete the Cloud9 IDE to avoid aws charges.
After that you can see vault is empty. Now you can delete vault safely directly from console.
Also Delete the Cloud9 IDE environment to avoid AWS charges.
No comments:
Post a Comment