The following code is working as expeceted and showing bucket name, file name. for e.g.
<Key: vivafree,Master.csv.2012-04-10-17-52-39.gz>
<Key: vivafree,Master.csv.2012-07-12-23-00-49.gz>
I need to download all these files and transfer them to Glacier vault.
from boto.s3.key import Key
from boto.s3.connection import S3Connection
AWS_ACCESS_KEY_ID="ABC"
AWS_SECRET_ACCESS_KEY="PQR+XYZ"
conn = S3Connection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
bucket = conn.get_bucket('vivafree')
ls=bucket.get_all_keys()
for file in ls:
print file
The following code will copy a file and put it in a vault called "company_backup".
import boto.glacier.layer2
vaultName = "company_backup"
fileName = "email_usergroups_permissions.txt.gz"
l = boto.glacier.layer2.Layer2(aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY)
v = l.get_vault(vaultName)
archiveID = v.create_archive_from_file(fileName)
What I need to do is to loop through the files returned from the first code block. Download and then transfer them to glacier using the second code snippet. I will also need to save the archiveID for record purpose.