The Python Oracle

Using Boto to tell when a file has successfully been uploaded to Glacier

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Sunrise at the Stream

--

Chapters
00:00 Question
02:16 Accepted answer (Score 5)
03:06 Thank you

--

Full question
https://stackoverflow.com/questions/1703...

Accepted answer links:
[Boto and Glacier guide]: http://thomassileo.com/blog/2012/10/24/g.../
[Here]: https://github.com/dmiyakawa/glacier_exp...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #amazonwebservices #boto #amazonglacier

#avk47



ACCEPTED ANSWER

Score 5


Take a look at this Boto and Glacier guide, you can either poll it manually from boto or you can set up Amazon Simple Notification Service to notify you when the job is done.

archive_id = vault.upload_archive("mybackup.tgz")
retrieve_job = vault.retrieve_archive(archive_id)

# if the job is in progress
job_id = retrieve_job.id
retrieve_job = vault.get_job(job_id)

if retrieve_job.completed:
    job.download_to_file("mybackup.tgz")

You can use boto's set_vault_notifications function set the SNS notifications.

notification_config = {'SNSTopic': 'my_notification_topic',
                       'Events': ['ArchiveRetrievalCompleted',
                                  'InventoryRetrievalCompleted']}
vault.set_vault_notifications(vault, notification_config)

Here is an extensive example of waiting for an upload by setting up SNS notification subscriptions to SQS queue service.