Cross-region replication (CRR) enables automatic, asynchronous copying of objects across S3 buckets in different regions. Buckets that are configured for CRR can be owned by the same user. Objects may be replicated to a single destination bucket or multiple destination buckets.
To enable CRR, you need to add replication configuration to your source bucket. The minimum configuration must provide the destination buckets where you want to replicate objects and a user with the role that enables replicating objects on your behalf.
- CRR only supports copying new S3 objects after it is enabled.
- S3 clusters are created, as described in Creating the S3 cluster.
To set up CRR replication
Create two or more S3 buckets, one source bucket and one or multiple destination buckets. You can also use buckets that already exist in the S3 cluster. For example, to create the
aws s3api create-bucket --bucket source --endpoint-url http://s3.ostor --profile ostor aws s3api create-bucket --bucket destination --endpoint-url http://s3.ostor --profile ostor
Enable versioning for these buckets. For example:
aws s3api put-bucket-versioning --bucket source --endpoint-url http://s3.ostor --profile ostor \ --versioning-configuration 'Status=Enabled' aws s3api put-bucket-versioning --bucket destination --endpoint-url http://s3.ostor --profile ostor \ --versioning-configuration 'Status=Enabled'
Create a replication configuration file. For example, the replication.conf file may look as follows:
<?xml version="1.0"?> <ReplicationConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Rule> <Status>Enabled</Status> <Filter/> <DeleteMarkerReplication> <Status>Disabled</Status> </DeleteMarkerReplication> <Destination> <Bucket>arn:aws:s3:::destination</Bucket> </Destination> <Priority>1</Priority> <ID>rep-rule</ID> </Rule> <Role>arn:aws:iam::ccb13f7bc586ace0:role/service-role/s3crr_role</Role> </ReplicationConfiguration>
- Specifies which objects to replicate and where to store the replicas.
- Specifies whether to replicate delete markers. If the
Filterelement is specified, you must also include the
- A container for information about the replication destination and its configuration.
- Indicates which rule has precedence whenever two or more replication rules conflict.
- The name of the bucket where you want to store the results.
- Specifies whether the rule is enabled. Valid values are
- A unique identifier for the rule. The value must be up to 255 characters long.
- The ID of the user that is used to replicate objects on your behalf. In the example above, it is
Configure the source bucket for CRR by specifying the replication configuration file. For example:
aws s3api put-bucket-replication --bucket source --endpoint-url http://s3.ostor --profile ostor \ --replication-configuration file://replication.conf