I Tried Out Amazon S3 Replication Exclusions and Multi-Region Key Resolution

I Tried Out Amazon S3 Replication Exclusions and Multi-Region Key Resolution

I tested Amazon S3 replication exclusions and multi-Region key resolution, replicating from Tokyo to N. Virginia. Prefix exclusion worked with Not in Filter, and objects encrypted with different multi-Region keys replicated under one rule.
2026.11.20

This page has been translated by machine translation. View original

Introduction

On November 18, 2026, exclusions and Multi-Region key resolution were added to Amazon S3 Replication.

https://aws.amazon.com/jp/about-aws/whats-new/2026/11/amazon-s3-replication-exclusions-multi-region-key-resolution/

With exclusions, you can remove objects that have specified prefixes or tags from the replication targets.

Multi-Region key resolution is a feature that encrypts replicas with the multi-Region key in the destination Region that corresponds to the source key.

In this article, I verified prefix exclusion and the replication of objects encrypted with multi-Region keys.

Test Environment

Configuration

The source is Tokyo and the destination is N. Virginia, and versioning is enabled on both.

Not and UseSourceMultiRegionKey are available in AWS CLI 2.41.1 or later.

Verification Commands

I checked the results with the following two commands. In the tables below, the status comes from head-object, and whether the object exists at the destination comes from the result of list-objects-v2.

aws s3api head-object --bucket <SOURCE_BUCKET> --key <KEY> --region ap-northeast-1 --query 'ReplicationStatus' --output text
aws s3api list-objects-v2 --bucket <DEST_BUCKET> --region us-east-1 --query 'Contents[].Key'

The head-object response for an excluded object has no ReplicationStatus field. Therefore, --output text displays None.

Exclusion

Prefix Exclusion

If you place Not directly under Filter, you can exclude only the prefix logs/ from the entire bucket.

replication.json
{
  "Role": "arn:aws:iam::<ACCOUNT_ID>:role/<ROLE_NAME>",
  "Rules": [
    {
      "ID": "all-except-logs",
      "Status": "Enabled",
      "Priority": 1,
      "Filter": { "Not": { "Prefix": "logs/" } },
      "DeleteMarkerReplication": { "Status": "Disabled" },
      "Destination": { "Bucket": "arn:aws:s3:::<DEST_BUCKET>" }
    }
  ]
}
aws s3api put-bucket-replication --bucket <SOURCE_BUCKET> --region ap-northeast-1 --replication-configuration file://replication.json

These are the results after writing app/a.txt, logs/a.log, and root.txt.

Key ReplicationStatus Destination
app/a.txt COMPLETED Present
logs/a.log No field Absent
root.txt COMPLETED Present

For multiple conditions using And or Or, and for exclusion by tag, refer to the AWS CLI reference.

https://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-replication.html

Multi-Region key resolution

Configuration

Assume a setup where each tenant (customer) is encrypted with a different key. Create two multi-Region keys (tenant-a, tenant-b) in Tokyo, and create a replica key for each in N. Virginia.

for t in a b; do
  ID=$(aws kms create-key --region ap-northeast-1 --multi-region --description "tenant-$t" --query KeyMetadata.KeyId --output text)
  echo "tenant-$t $ID"
  aws kms replicate-key --region ap-northeast-1 --key-id "$ID" --replica-region us-east-1 --query ReplicaKeyMetadata.KeyId --output text
done

The replication configuration has one rule. Enable SseKmsEncryptedObjects, which targets objects encrypted with KMS, and UseSourceMultiRegionKey.

replication.json
{
  "Role": "arn:aws:iam::<ACCOUNT_ID>:role/<ROLE_NAME>",
  "Rules": [
    {
      "ID": "all-kms-objects-mrk",
      "Status": "Enabled",
      "Priority": 1,
      "Filter": { "Prefix": "" },
      "DeleteMarkerReplication": { "Status": "Disabled" },
      "SourceSelectionCriteria": { "SseKmsEncryptedObjects": { "Status": "Enabled" } },
      "Destination": {
        "Bucket": "arn:aws:s3:::<DEST_BUCKET>",
        "EncryptionConfiguration": { "UseSourceMultiRegionKey": { "Status": "Enabled" } }
      }
    }
  ]
}
aws s3api put-bucket-replication --bucket <SOURCE_BUCKET> --region ap-northeast-1 --replication-configuration file://replication.json

Grant the replication role kms:Decrypt on the source keys, and kms:Encrypt and kms:GenerateDataKey on the destination keys. This assumes the role with S3 permissions has already been created, and adds the KMS permissions to it.

Role KMS permissions (role-kms-policy.json)
role-kms-policy.json
{
  "Version": "2012-10-17",
  "Statement": [
    {"Effect": "Allow", "Action": ["kms:Decrypt"],
     "Resource": [
       "arn:aws:kms:ap-northeast-1:<ACCOUNT_ID>:key/<KEY_ID_A>", "arn:aws:kms:ap-northeast-1:<ACCOUNT_ID>:key/<KEY_ID_B>"]},
    {"Effect": "Allow", "Action": ["kms:Encrypt", "kms:GenerateDataKey"],
     "Resource": [
       "arn:aws:kms:us-east-1:<ACCOUNT_ID>:key/<KEY_ID_A>", "arn:aws:kms:us-east-1:<ACCOUNT_ID>:key/<KEY_ID_B>"]}
  ]
}
aws iam put-role-policy --role-name <ROLE_NAME> --policy-name kms-replication --policy-document file://role-kms-policy.json

Replication Results

I wrote objects specifying the multi-Region keys for tenant-a and tenant-b. This is the example for tenant-a.

aws s3api put-object --bucket <SOURCE_BUCKET> --key tenant-a/doc.txt --body <FILE> --region ap-northeast-1 --server-side-encryption aws:kms --ssekms-key-id <KEY_ID_A>

Both objects became COMPLETED.

This is the result of comparing the tenant-a object at the source and the destination.

aws s3api head-object --bucket <SOURCE_BUCKET> --key tenant-a/doc.txt --region ap-northeast-1 --query '{ServerSideEncryption:ServerSideEncryption,SSEKMSKeyId:SSEKMSKeyId,ReplicationStatus:ReplicationStatus}'
aws s3api head-object --bucket <DEST_BUCKET> --key tenant-a/doc.txt --region us-east-1 --query '{ServerSideEncryption:ServerSideEncryption,SSEKMSKeyId:SSEKMSKeyId,ReplicationStatus:ReplicationStatus}'

The source response.

{
    "ServerSideEncryption": "aws:kms",
    "SSEKMSKeyId": "arn:aws:kms:ap-northeast-1:<ACCOUNT_ID>:key/<KEY_ID_A>",
    "ReplicationStatus": "COMPLETED"
}

The destination response.

{
    "ServerSideEncryption": "aws:kms",
    "SSEKMSKeyId": "arn:aws:kms:us-east-1:<ACCOUNT_ID>:key/<KEY_ID_A>",
    "ReplicationStatus": "REPLICA"
}

The source object was encrypted with the Tokyo key, and the replica was encrypted with the replica key in the destination Region (us-east-1).

Summary

For exclusions, placing Not in Filter lets you remove a prefix from the replication targets. When there are objects you do not want to replicate, you can now write replication rules more concisely.

For replicating objects encrypted with KMS keys, a rule was previously required for each key. With Multi-Region key resolution, objects encrypted with per-tenant multi-Region keys can now be replicated with a single rule.

If you have many tenants, or if the number of rules had grown to exclude some paths and become a management burden, please give it a try.

Share this article

AWSのお困り事はクラスメソッドへ