Skip to content

Commit

Permalink
Expand on ACL issues
Browse files Browse the repository at this point in the history
  • Loading branch information
RealOrangeOne committed Feb 21, 2024
1 parent 65e6817 commit 4227e6d
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Cross-account data transfer
title: Cross-account data transfer in S3
tags:
- AWS
sources:
Expand Down Expand Up @@ -49,11 +49,14 @@ To copy bucket contents from a bucket in account A to a bucket in account B:

Now, you can run `aws s3 sync` as the account in account B, and access both buckets.

!!! warning
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.
## ACLs

These can be solved by overwriting the file's ACLs to enforce the bucket owner owns the file:
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. Bucket policies don't seem to apply if the object is owned by a different account, which is the case when ACLs are enabled and the object is written by a user not in the organisation (hence pull-based being best).

```
aws s3 cp --recursive 's3://<destination_bucket>` 's3://<destination_bucket>` --acl bucket-owner-full-control --metadata-directive REPLACE
```
These can be solved by overwriting the file's ACLs to enforce the bucket owner owns the file:

```
aws s3 cp --recursive 's3://<destination_bucket>` 's3://<destination_bucket>` --acl bucket-owner-full-control --metadata-directive REPLACE
```

It's then good practice to make sure the ACLs are as you expect (eg [`./manage.py fix_document_acls`](https://github.com/torchbox/wagtail-storages?tab=readme-ov-file#django-admin-fix_document_acls)).

0 comments on commit 4227e6d

Please sign in to comment.