Created
September 27, 2011 17:03
-
-
Save douglasjarquin/1245625 to your computer and use it in GitHub Desktop.
List S3 object versions with Boto and Python
This file contains hidden or 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
| """ | |
| List all S3 object versions | |
| """ | |
| import os | |
| from boto.s3.connection import S3Connection | |
| print '--- Connecting to S3' | |
| c = S3Connection(aws_access_key_id=os.environ['AWS_ACCESS_KEY_ID'], | |
| aws_secret_access_key=os.environ['AWS_SECRET_ACCESS_KEY']) | |
| print '--- Selecting the bucket' | |
| bucket = c.get_bucket('...') | |
| versions = bucket.list() | |
| #versions = bucket.list(prefix='') | |
| print '--- List all bucket key versions' | |
| for version in versions: | |
| print version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
All of these codes are printing the keys not the versions...