Last active
January 27, 2016 01:36
-
-
Save caiusb/ecb994ee31f45a59d0ce to your computer and use it in GitHub Desktop.
Deleting all archives from a Glacier vault
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
#!/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