I need to delete files stored in a Glacier Vault, but AWS CLI needs the object id and I can't execute the correct command to obtain this id.
Anyone knows the command to see the file id with AWS CLI?
Use aws glacier initiate-job
to obtain an inventory of an Amazon Glacier vault.
From the Amazon Glacier documentation:
The following command initiates a job to get an inventory of the vault my-vault:
aws glacier initiate-job --account-id - --vault-name my-vault --job-parameters '{"Type": "inventory-retrieval"}'
Once the job completes, you can call aws glacier get-job-output
. The inventory will include the archive-id
(files are called archives in Glacier).
Here is a sample output from the get-job-output
documentation:
{"VaultARN":"arn:aws:glacier:us-west-2:0123456789012:vaults/my-vault","InventoryDate":"2015-04-07T00:26:18Z","ArchiveList":[{"ArchiveId":"kKB7ymWJVpPSwhGP6ycSOAekp9ZYe_--zM_mw6k76ZFGEIWQX-ybtRDvc2VkPSDtfKmQrj0IRQLSGsNuDp-AJVlu2ccmDSyDUmZwKbwbpAdGATGDiB3hHO0bjbGehXTcApVud_wyDw","ArchiveDescription":"multipart upload test","CreationDate":"2015-04-06T22:24:34Z","Size":3145728,"SHA256TreeHash":"9628195fcdbcbbe76cdde932d4646fa7de5f219fb39823836d81f0cc0e18aa67"}]}