Created
October 15, 2012 22:57
-
-
Save srs81/3896192 to your computer and use it in GitHub Desktop.
Sample boto AWS Glacier connection/upload/delete code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Suman | |
# Import boto's layer2 | |
import boto.glacier.layer2 | |
# Various variables for AWS creds, vault name, local file name | |
awsAccess = "AKIAxxxx" | |
awsSecret = "YouRSecRetKeY" | |
vaultName = "YourVaultName" | |
fileName = "LocalFileName" | |
# Create a Layer2 object to connect to Glacier | |
l = boto.glacier.layer2.Layer2(aws_access_key_id=awsAccess, aws_secret_access_key=awsSecret) | |
# Get a vault based on vault name (assuming you created it already) | |
v = l.get_vault(vaultName) | |
# Create an archive from a local file on the vault | |
archiveID = v.create_archive_from_file(fileName) | |
# Delete the archive on the vault | |
v.delete_archive(archiveID) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment