Skip to content

Instantly share code, notes, and snippets.

@maxmanders
Created March 28, 2014 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxmanders/9831915 to your computer and use it in GitHub Desktop.
Save maxmanders/9831915 to your computer and use it in GitHub Desktop.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"arn:aws:s3:::*"
]
}
]
}
=> true
[2] pry(main)> s3_dev = AWS::S3.new(
[2] pry(main)* :access_key_id => "destination_access_key",
[2] pry(main)* :secret_access_key => "destination_secret_access_key",
[2] pry(main)* :region => "eu-west-1"
[2] pry(main)* )
=> <AWS::S3>
[3] pry(main)> s3_cur = AWS::S3.new(
[3] pry(main)* :access_key_id => "source_access_key",
[3] pry(main)* :secret_access_key => "source_secret_access_key",
[3] pry(main)* :region => "eu-west-1"
[3] pry(main)* )
=> <AWS::S3>
[4] pry(main)> src_file = s3_cur.buckets['some-bucket'].objects['key']
=> <AWS::S3::S3Object:some-bucket/key>
[5] pry(main)> dst_file = s3_dev.buckets['dev-some-bucket'].objects['key']
=> <AWS::S3::S3Object:dev-some-bucket/key>
[8] pry(main)> dst_file.copy_from(src_file)
AWS::S3::Errors::AccessDenied: Access Denied
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::account_number_owning_above_role:role/s3_access_role"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment