Copying a directory from a S3 bucket A in account X to a S3 bucket B in account Y on AWS

Submitted by Jochus on Fri, 17/02/2017 - 09:16 | Posted in: Java


I had some issues copying data from bucket A to bucket B. Both of the buckets were in different AWS accounts. Copying of data was going fine, but on the target side, I never had the permissions to read the copied data.

I forgot to include the --acl property in my copy command

--acl (string) Sets the ACL for the object when the command is performed. If you use this parameter you must have the "s3:PutObjectAcl" permission included in the 
list of actions for your IAM policy. Only accepts values of private, public-read, public-read-write, authenticated-read, aws-exec-read, bucket-owner-read, bucket-
owner-full-control and log-delivery-write. See Canned ACL for details

So the command I've executed:

$ aws s3 cp --recursive --acl authenticated-read s3://#BUCKET_A#/#PATH_TO_DIR# s3://#BUCKET_B/#PATH_TO_DIR#

Add new comment

The content of this field is kept private and will not be shown publicly.

Full HTML

  • Lines and paragraphs break automatically.
  • You can caption images (data-caption="Text"), but also videos, blockquotes, and so on.
  • Web page addresses and email addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <cpp>, <css>, <html5>, <java>, <php>, <sql>, <xml>. The supported tag styles are: <foo>, [foo].