- Newest
- Most votes
- Most comments
To delete all archives in an AWS Glacier vault using the AWS CLI, follow these steps in a linux shell
- Initiate an Inventory Retrieval Job
aws glacier initiate-job --account-id - --vault-name YOUR_VAULT_NAME --job-parameters '{"Type": "inventory-retrieval"}'
- Replace YOUR_VAULT_NAME with your actual vault name.
- The --account-id - uses the default account.
- This job can take several hours (up to 24 hours) to complete.
- Get the Job Output After the job is completed, get the job ID from the list of jobs:
aws glacier list-jobs --account-id - --vault-name YOUR_VAULT_NAME
Look for a completed inventory-retrieval job and note its JobId. Once completed, download the inventory:
aws glacier get-job-output --account-id - --vault-name YOUR_VAULT_NAME --job-id YOUR_JOB_ID output.json
- Extract Archive IDs The output.json file will contain a list of archives. Extract archive IDs using jq (a JSON processor):
cat output.json | jq -r '.ArchiveList[].ArchiveId' > archive-ids.txt
- Delete Archives Loop through the archive IDs and delete them one by one:
while read archive_id; do
aws glacier delete-archive --account-id - --vault-name YOUR_VAULT_NAME --archive-id "$archive_id"
done < archive-ids.txt
You can of course put this into a shell script and perform all actions in 1 go
Thanks, I have a timeout:
alex@dsa2:~$ aws glacier initiate-job --account-id 998818------ --vault-name DiskStationAlex_00113233C1FF_1 --job-parameters '{"Type": "inventory-retrieval"}'
Connect timeout on endpoint URL: "https://glacier.us-east-1.amazonaws.com/998818-----/vaults/DiskStationAlex_00113233C1FF_1/jobs"
Your on a Synology NAS? You need to run the command from a machine with access to the endpoint along with IAM access keys.
You may be best running from a cloudshell command in your AWS account.
To be more specific :
aws glacier describe-vault --account-id 998818------ --region us-east-1 --endpoint-url https://glacier.us-east-1.amazonaws.com --vault-name "DiskStationAlex_00113233C1FF_1"
Connect timeout on endpoint URL: "https://glacier.us-east-1.amazonaws.com/998818------/vaults/DiskStationAlex_00113233C1FF_1"
According to GUI this vault has 298,244 archives and is 559.2 GB
I just want to delete it, I can't think how I am going to delete 298,244 archives one by one using the CLI, it does not make any sense at all...
OK I decided to ditch the docker aws-cli on my Synology as I suspected that something was wrong with it and leading to the timouts (network issue?)
I installed AWS CLI on Mac and I immediately got results:
Out of 6 Vaults on my AWS account 1 has a Job ID and 5 have no job IDs.
For the one that has a job ID when I run aws glacier list-jobs --account-id 9988------- --vault-name DiskStation---------233C1FF_1 I get this:
{ "JobId": "abcdefabcdefabcdef", "Action": "InventoryRetrieval", "VaultARN": "arn:aws:glacier:us-east-1:123456123456:vaults/DiskStation_1", "CreationDate": "2025-01-30T03:56:47.618Z", "Completed": false, "StatusCode": "InProgress", "InventoryRetrievalParameters": { "Format": "JSON" }
However when I run aws glacier get-job-output --account-id 998818--- --vault-name DiskStation------233C1FF_1 --job-id abcdefabcdefabcdef output.json
I get
An error occurred (InvalidParameterValueException) when calling the GetJobOutput operation: The job is not currently available for download: abcdefabcdefabcdef
Relevant content
- asked 4 years ago
- asked a year ago
- asked 2 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago

A Gist following your shared steps https://gist.github.com/joariasl/47d80b6f2a5df682ed337b5a54613d1c Thanks