Last active
December 30, 2015 05:09
-
-
Save weavermedia/7780350 to your computer and use it in GitHub Desktop.
Basic AWS S3 operations
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
s3 = AWS::S3.new | |
bucket = s3.buckets['my_bucket'] | |
# To duplicate an object within a bucket on S3 | |
source_key = 'temp/file.txt' | |
destination_key = 'final/file.txt' | |
options = {:acl => :public_read} # use this to set the read permissions of the new object | |
bucket.objects[destination_key].copy_from(source_key, options) | |
# To delete an object from S3 | |
bucket.objects[object_key].delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment