3

I want to copy an S3 bucket as faithfully as possible (e.g., copying all permission settings).

The standard:

aws s3 sync s3://old-bucket s3://new-bucket --source-region us-west-1 --region us-west-2 

only copies data.

How can one copy an S3 bucket as faithfully as possible (e.g., copying all permission settings)?

3 Answers 3

2

Using the same infrastructure as code that created the first bucket if it was created using IAC. However, I have both types of buckets in my personal AWS account, IAC and manual.

When you create a new bucket in the S3 console it asks you if you want to copy the settings of an existing bucket, which addresses half your question.

To copy objects you could try setting up S3 bucket replication, including using this blog post for instructions how to copy existing objects - usually replication only copies new objects after replication is set up. If that doesn't work you could try CLIv2 "aws s3 sync" from bucket to bucket, not sure if that works, but it will copy everything via the machine you run that command on - EC2 would be a lot faster, cheaper and more efficient than a home PC.

1

use rclone tool and set the ACL option you want.

rclone sync <remote_source_bucket_name>://<path> <remote_destination_bucket_name>://<path> --progress --s3-acl <option>

you read about the options here.

5
  • 1
    That explicitly writes a new ACL, it doesn't copy the existing one as OP wanted.
    – Bob
    Mar 4 at 13:41
  • 1
  • 1
    That's for the AWS CLI tool, not rclone as you suggested in your answer?
    – Bob
    Mar 5 at 0:28
  • yub, rclone suits more but since the exact objective you want can be done witth aws cli which you already use then why not providing it Mar 5 at 8:52
  • Neither rclone nor aws cli perform the operation OP wants. rclone explicitly does not support it. The aws cli github issue you linked is a (still-open) request for it to be added; the comment you linked is just a request for the option that does not actually exist yet.
    – Bob
    Mar 5 at 13:17
0

When creating a bucket via the AWS console, one may choose to copy settings from an existing bucket:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .