Adarsh
Adarsh

Reputation: 3583

Archive retrieval from AWS Glacier

I uploaded an archive to AWS glacier using boto3 using the code as described here: https://github.com/tbumi/glacier-upload/blob/develop/main.py

It returned me archive id which I didn't save at the time and i went through the AWS documentation and archive id is needed for archive retrieval.

As i understood from the boto3 documentation, You first need to create a job as follows:

job = archive.initiate_archive_retrieval()

This returns me a glacier.Job Object and which contains many attributes such as Job id etc. Then i can use the

response = job.get_output(
    range='string'
)

To download the archive from glacier after notified via SNS after 3-5hrs after the job has been completed and the range being the part of the archive in bytes to download( defaults to whole archive).

Also i am not able to delete the vault as the vault is not empty and requires me to delete the archive which again needs the archive id for doing so.

I also looked at their REST API which again is dependent on the archive id for deletion. Here: https://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-delete.html

Also i found that downloading archives can only be done programtically either using their REST APIS or SDK's or aws-cli therefore shutting the door to do so using the AWS console.

Since i don't have the archive id, is it possible for me to retrieve the archive using any other method? If not, is it possible to delete the vault?

Upvotes: 1

Views: 1672

Answers (1)

Sergey Kovalev
Sergey Kovalev

Reputation: 9431

You can get all the IDs by running a vault inventory.

...you can use Initiate a Job (POST jobs) to initiate a new inventory retrieval for a vault. The inventory contains the archive IDs you use to delete archives using Delete Archive (DELETE archive) . http://boto3.readthedocs.io/en/latest/reference/services/glacier.html

So just use Client.initiate_job with Type set to inventory-retrieval, and you'll get your ID after the inventory finishes. http://boto3.readthedocs.io/en/latest/reference/services/glacier.html#Glacier.Client.initiate_job

Upvotes: 4

Related Questions