Error Copying files from one S3 bucket to another AWS account
I ran into a strange problem when trying to copy files from one S3 bucket to another S3 bucket in a different account. I kept receiving access denied errors no matter what I tried! It turns out the solution was rather simple!
When trying to copy files from the source bucket, I would receive errors such as:
- An error occurred (AccessDenied) when calling the GetObject operation: Access Denied
- 404 errors
- No error at all!
Yet I was able to use the ls command to see the source file! I tried several different methods of setting up the permissions, creating bucket policies, etc. Nothing was working.
It turns out the solution was very simple: the permissions on each file did not allow the user! I thought that just setting the Bucket Policy to allow the user would be enough, but it was not! To fix this you need to create a new source bucket with the correct permissions. Unless you only have a few files, it will take far too long to edit permissions on the individual files.