Skip to content

Instantly share code, notes, and snippets.

@caiusb
Last active January 27, 2016 01:36
Show Gist options
  • Save caiusb/ecb994ee31f45a59d0ce to your computer and use it in GitHub Desktop.
Save caiusb/ecb994ee31f45a59d0ce to your computer and use it in GitHub Desktop.
Deleting all archives from a Glacier vault
#!/opt/local/bin/python
# This gist assumes that the AWS CLI client has been installed
# and configured. To configure, run `aws configure`.
import boto3
import json
#TODO: Fill these in to match your case
vaultName = ""
inventoryFile = ""
json_string = open(inventoryFile).read()
data = json.loads(json_string)
archives = data['ArchiveList']
glacier = boto3.client('glacier')
for archive in archives:
archiveID = archive['ArchiveId']
print("Deleting: " + archiveID + ", size: " + str(archive['Size']))
glacier.delete_archive(vaultName = vaultName, archiveId = archiveID)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment