Creating S3 bucket replication

Create a replication configuration for a bucket or replace an existing one.

Before you begin

Before you begin, make sure that you have the following prerequisites in place:
  • A running IBM Storage Ceph 9.9.0 cluster with Multi-site Ceph object Gateway configured. For more information on creating multi-site sync policies, see Creating a sync policy group.
  • Zonegroup-level policy is created. For more information on creating zone group policies, see Bucket granular sync policies.

About this task

You can create a replication configuration for a bucket or replace an existing one. Specify the replication configuration in the request body. Provide the name of the destination bucket or buckets where you want to replicate objects.

A replication configuration must include at least one rule. Each rule identifies a subset of objects to replicate by filtering the objects in the source bucket.

Procedure

  1. Create a replication configuration file that contains the details of replication.
    { 
        "Role": "arn:aws:iam::account-id:role/role-name", 
        "Rules": [ 
            { 
                "ID": "String",
                "Status": "Enabled", 
                "Priority": 1, 
                "DeleteMarkerReplication": { "Status": "Enabled"|"Disabled" }, 
                "Destination": { 
                    "Bucket": "BUCKET_NAME" 
                } 
            } 
        ] 
    }
    For example,
    [root@host01 ~]# cat replication.json
    { 
        "Role": "arn:aws:iam::account-id:role/role-name", 
        "Rules": [ 
            { 
                "ID": "pipe-bkt",
                "Status": "Enabled", 
                "Priority": 1, 
                "DeleteMarkerReplication": { "Status": "Disabled" },  
                "Destination": { 
                    "Bucket": "testbucket" 
                } 
            } 
        ] 
    }
  2. Create the S3 API put bucket replication.
    aws --endpoint-url=RADOSGW_ENDPOINT_URL s3api put-bucket-replication --bucket BUCKET_NAME --replication-configuration file://REPLICATION_CONFIIRATION_FILE.json
    For example,
    [root@host01 ~]# aws --endpoint-url=http://host01:80 s3api put-bucket-replication --bucket testbucket --replication-configuration file://replication.json

What to do next

  • Verify the sync policy, by using the sync policy get command.

    Syntax

    radosgw-admin sync policy get --bucket BUCKET_NAME
    Note: When applying replication policy, the rules are converted to sync-policy rules, that are known as pipes, and are categorized as enabled and disabled.
    Enabled
    These pipes are enabled and are active and the group status is set to rgw_sync_policy_group:STATUS.

    Example,

    s3-bucket-replication:enabled.
    Disabled
    The pipes under this set are not active and the group status is set to rgw_sync_policy_group:STATUS.

    Example,

    s3-bucket-replication:disabled.
    Since there can be multiple configurable rules as part of replication policy, it has two separate groups (one with enabled and another with allowed state) for accurate mapping of each group.

    Example

    [host01 /]# radosgw-admin sync policy get --bucket testbucket
    
    {
        "groups": [
            {
                "id": "s3-bucket-replication:disabled",
                "data_flow": {},
                "pipes": [],
                "status": "allowed"
            },
            {
                "id": "s3-bucket-replication:enabled",
                "data_flow": {},
                "pipes": [
                    {
                        "id": "pipe-bkt",
                        "source": {
                            "bucket": "*",
                            "zones": [
                                "*"
                            ]
                        },
                        "dest": {
                            "bucket": "testbucket",
                            "zones": [
                                "*"
                            ]
                        },
                        "params": {
                            "source": {},
                            "dest": {},
                            "priority": 1,
                            "mode": "user",
                            "user": "s3cmd"
                        }
                    }
                ],
                "status": "enabled"
            }
        ]
    }