HEX
Server: LiteSpeed
System: Linux ip-172-31-76-142.ec2.internal 4.14.158-129.185.amzn2.x86_64 #1 SMP Tue Dec 24 03:15:32 UTC 2019 x86_64
User: 69b4844ae61d4e92bf26ad98af552775 (1065)
PHP: 7.2.27
Disabled: exec,passthru,shell_exec,system,eval
Upload Files
File: //lib/python2.7/site-packages/awscli/examples/s3api/put-bucket-replication.rst
**To configure replication for an S3 bucket**

The following ``put-bucket-replication`` example applies a replication configuration to the specified S3 bucket. ::

    aws s3api put-bucket-replication \
        --bucket my-bucket \
        --replication-configuration file://replication.json

Contents of ``replication.json``::

    {
        "Role": "arn:aws:iam::123456789012:role/s3-replication-role",
        "Rules": [
            {
                "Status": "Enabled",
                "Priority": 1,
                "DeleteMarkerReplication": { "Status": "Disabled" },
                "Filter" : { "Prefix": ""},
                "Destination": {
                    "Bucket": "arn:aws:s3:::my-bucket-backup"
                }
            }
        ]
    }

The destination bucket must be in a different region and have versioning enabled. The specified role must have permission to write to the destination bucket and have a trust relationship that allows Amazon S3 to assume the role.

Example role permission policy::

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": "s3:*",
                "Resource": "*"
            }
        ]
    }

Example trust relationship policy::

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Principal": {
                    "Service": "s3.amazonaws.com"
                },
                "Action": "sts:AssumeRole"
            }
        ]
    }