replication-change-owner
Changing the Replica Owner
In replication, the owner of the source object also owns the replica by default. When source and destination buckets are owned by different AWS accounts, you can add optional configuration settings to change replica ownership to the AWS account that owns the destination bucket. You might do this, for example, to restrict access to object replicas. This is referred to as the owner override option of the replication configuration. This section explains only the relevant additional configuration settings. For information about setting the replication configuration, see Replication.
To configure the owner override, you do the following:
- Add the owner override option to the replication configuration to tell Amazon S3 to change replica ownership.
- Grant Amazon S3 permissions to change replica ownership.
- Add permission in the destination bucket policy to allow changing replica ownership. This allows the owner of the destination bucket to accept the ownership of object replicas.
The following sections describe how to perform these tasks. For a working example with step-by-step instructions, see Example 3: Changing the Replica Owner When the Source and Destination Buckets Are Owned by Different Accounts.
Adding the Owner Override Option to the Replication Configuration
Warning
Add the owner override option only when the source and destination buckets are owned by different AWS accounts. Amazon S3 doesn't check if the buckets are owned by same or different accounts. If you add the owner override when both buckets are owned by same AWS account, Amazon S3 applies the owner override. It grants full permissions to the owner of the destination bucket and doesn't replicate subsequent updates to the source object access control list (ACL). The replica owner can directly change the ACL associated with a replica with a PUT ACL
request, but not through replication.
To specify the owner override option, add the following to the Destination
element:
- The
AccessControlTranslation
element, which tells Amazon S3 to change replica ownership - The
Account
element, which specifies the AWS account of the destination bucket owner
The following example replication configuration tells Amazon S3 to replicate objects that have the Tax
key prefix to the destination bucket and change ownership of the replicas.
Granting Amazon S3 Permission to Change Replica Ownership
Grant Amazon S3 permissions to change replica ownership by adding permission for the s3:ObjectOwnerOverrideToBucketOwner
action in the permissions policy associated with the IAM role. This is the IAM role that you specified in the replication configuration that allows Amazon S3 to assume and replicate objects on your behalf.
Adding Permission in the Destination Bucket Policy to Allow Changing Replica Ownership
The owner of the destination bucket must grant the owner of the source bucket permission to change replica ownership. The owner of the destination bucket grants the owner of the source bucket permission for the s3:ObjectOwnerOverrideToBucketOwner
action. This allows the destination bucket owner to accept ownership of the object replicas. The following example bucket policy statement shows how to do this.
Additional Considerations
When you configure the ownership override option, the following considerations apply:
- By default, the owner of the source object also owns the replica. Amazon S3 replicates the object version and the ACL associated with it.
If you add the owner override, Amazon S3 replicates only the object version, not the ACL. In addition, Amazon S3 doesn't replicate subsequent changes to the source object ACL. Amazon S3 sets the ACL on the replica that grants full control to the destination bucket owner.
- When you update a replication configuration to enable, or disable, the owner override, the following occurs.
- If you add the owner override option to the replication configuration:
- If you remove the owner override option from the replication configuration: