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.

Revisions

  1. srs81 created this gist Oct 15, 2012.
    22 changes: 22 additions & 0 deletions glacier_layer2.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    # 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)