Skip to content

Instantly share code, notes, and snippets.

@srs81
Created October 15, 2012 22:57
Show Gist options
  • Save srs81/3896192 to your computer and use it in GitHub Desktop.
Save srs81/3896192 to your computer and use it in GitHub Desktop.
Sample boto AWS Glacier connection/upload/delete code
# 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