Skip to content

Instantly share code, notes, and snippets.

@weavermedia
Last active December 30, 2015 05:09
Show Gist options
  • Save weavermedia/7780350 to your computer and use it in GitHub Desktop.
Save weavermedia/7780350 to your computer and use it in GitHub Desktop.
Basic AWS S3 operations
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