/
thaw.py
39 lines (26 loc) · 960 Bytes
/
thaw.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# boto is Amazon's python library
import boto
import configparser
# Thaw takes a single configuration file of the format:
#
# [SECTION]
# configitem = value
#
# It expects one section with the values:
# [DEFAULT]
# aws_access_key_id = <value>
# aws_secret_access_key = <value>
# aws_sns_topic_arn = <value>
# aws_glacier_vault_id = <value>
config = configparser.ConfigParser()
ACCESS_KEY_ID = config['DEFAULT']['aws_access_key_id']
SECRET_ACCESS_KEY = config['DEFAULT']['aws_secret_access_key']
SNS_TOPIC = config['DEFAULT']['aws_sns_topic_arn']
VAULT_ID = config['DEFAULT']['aws_glacier_vault_id']
# Connection to Glacier
glacier_connection = boto.connect_glacier(aws_access_key_id=ACCESS_KEY_ID, aws_secret_access_key=SECRET_ACCESS_KEY)
# Connect to specific vault
vault = glacier_connection.get_vault(VAULT_ID)
# initiate a job to retrieve the vault inventory
inventory_job = vault.retrieve_inventory(sns_topic=SNS_TOPIC)
print(inventory_job)