Skip to content

Commit 24fc330

Browse files
committed
Add note about ACLs and ownership when copying between accounts
1 parent 74ef7d9 commit 24fc330

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

docs/notes/infrastructure/cross-account-transfer.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ tags:
55
link: https://aws.amazon.com/premiumsupport/knowledge-center/cross-account-access-s3/
66
---
77

8-
To copy bucket contents from bucket in account A to bucket in account B:
8+
To copy bucket contents from a bucket in account A to a bucket in account B:
99

1010
1. Create new S3 bucket in account B
1111
2. Create IAM role / user in account B, with access to destination bucket
12-
3. Add IAM inline policy to user:
12+
3. Add IAM inline policy to the newly-created user:
1313

1414
```json
1515
{
@@ -44,3 +44,14 @@ To copy bucket contents from bucket in account A to bucket in account B:
4444
]
4545
}
4646
```
47+
48+
Now, you can run `aws s3 sync` as the account in account B, and access both buckets.
49+
50+
!!! warning
51+
Whilst it might seem counter-intuitive, a **pull**-based transfer is significantly simpler than a **push**-based transfer. Notably, it avoids [issues](https://stackoverflow.com/a/63804619) with ownership issues and ACLs.
52+
53+
These can be solved by overwriting the file's ACLs to enforce the bucket owner owns the file:
54+
55+
```
56+
aws s3 cp --recursive 's3://<destination_bucket>` 's3://<destination_bucket>` --acl bucket-owner-full-control --metadata-directive REPLACE
57+
```

0 commit comments

Comments
 (0)