Last active
August 29, 2015 14:18
-
-
Save nowlinuxing/83ea2ddc50a968e3df65 to your computer and use it in GitHub Desktop.
Copy the Amazon S3 objects between two buckets
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
# AWS SDK v1 | |
require 'aws-sdk' | |
AWS.config(:access_key_id => 'foo', :secret_access_key => 'bar') | |
s3 = AWS::S3.new | |
key = "path/to/src" | |
s3.buckets['src_bucket'].objects.with_prefix(key).each do |o| | |
o.copy_to(o.key, bucket_name: "dst_bucket") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment