Solx
Solx

Reputation: 5111

How do I do an S3 copy between regions using aws cli?

It was far to difficult to figure this out. It wasn't obvious to me and lots of explanations left out key details. I will answer this with the solution. Sorry if it seems obvious to you, but given how many searches and experiments it took me to do this, I think it is quite worthwhile to show others how to do it.

Upvotes: 24

Views: 28305

Answers (1)

Solx
Solx

Reputation: 5111

UPDATE: According to a commenter, the extra parameters I show here may no longer be needed. I am not currently working with AWS, so I don't have a way to verify it. Anyway, I didn't change the rest of this post in case it is still needed in some case.

The trick is being explicit about both the source and destination regions. They might not always be required, but it doesn't hurt to always show them:

$ aws s3 cp s3://my-source-bucket-in-us-west-2/ \
      s3://my-target-bucket-in-us-east-1/ \
      --recursive --source-region us-west-2 --region us-east-1

Or on Windows

> aws s3 cp s3://my-source-bucket-in-us-west-2/ ^
          s3://my-target-bucket-in-us-east-1/ ^
          --recursive --source-region us-west-2 --region us-east-1

Upvotes: 36

Related Questions