Skip to content

Instantly share code, notes, and snippets.

@garnaat
Created May 24, 2010 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save garnaat/411994 to your computer and use it in GitHub Desktop.
Save garnaat/411994 to your computer and use it in GitHub Desktop.
Use boto to convert an S3 key to RRS
# Convert an existing key in an S3 bucket that uses the STANDARD storage class
# to one using the REDUCED_REDUNDANCY storage class. This uses the S3 COPY
# command to copy the key back to the same bucket. The ACL is preserved.
import boto
# create connection to S3 service
s3 = boto.connect_s3()
# lookup my existing bucket
bucket = s3.lookup('mybucket')
# lookup the Key you want to copy in the bucket
key = bucket.lookup('myoldkey')
# change the storage_class of the key from STANDARD to REDUCED_REDUNDANCY
key.change_storage_class('REDUCED_REDUNDANCY')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment