I am trying to copy between two S3 buckets in different regions using the Command Line Interface on an EC2 server.
region info:
EC2 instance: us-west-2
S3 origin: us-east-1
S3 destination: us-west-2
The following commands work perfectly from the EC2 server: aws s3 cp s3://n-virginia/origin s3://n-virginia/destination --recursive --source-region us-east-1 --region us-east-1 --profile my_profileaws s3 cp s3://oregon/origin s3://oregon/destination --recursive --source-region us-west-2 --region us-west-2 --profile my_profile
I need to run the following command from the EC2 server:aws s3 cp s3://n-virginia/origin s3://oregon/destination --recursive --source-region us-east-1 --region us-west-2 --profile my_profile
If I run that command from a local machine it works, but if I run it from the EC2 server that I used for the previous two commands I get the following error:
Error:"A client error (AccessDenied) occurred when calling the CopyObject operation: VPC endpoints do not support cross-region requests"
I am able to copy the files from the origin bucket to the EC2 server, and then copy from the EC2 server to the destination bucket, but this is not an acceptable solution in production. I don't understand why it will work on a local machine but not on the EC2 server ("my_profile" is identical on both machines)