All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::OSS::BucketReplication

更新时间:Aug 11, 2025

The ALIYUN::OSS::BucketReplication is used to specify data replication rules for an OSS bucket.

Syntax

{
  "Type": "ALIYUN::OSS::BucketReplication",
  "Properties": {
    "BucketName": String,
    "ReplicationConfiguration": Map
  }
}

Properties

Property name

Type

Required

Editable

Description

Constraint

BucketName

String

Yes

No

The destination bucket to which the data is replicated.

None

ReplicationConfiguration

Map

Yes

No

The container that stores bucket data replication configurations.

For more information, refer to ReplicationConfiguration properties.

ReplicationConfiguration syntax

"ReplicationConfiguration": {
  "Rule": Map
}

ReplicationConfiguration properties

Property name

Type

Required

Editable

Description

Constraint

Rule

Map

Yes

No

The container that is used to store data replication rules.

For more information, refer to Rule properties.

Rule syntax

"Rule": {
  "RTC": Map,
  "Destination": Map,
  "Action": String,
  "SyncRole": String,
  "EncryptionConfiguration": Map,
  "SourceSelectionCriteria": Map,
  "PrefixSet": List,
  "Id": String,
  "HistoricalObjectReplication": String
}

Rule properties

Property name

Type

Required

Editable

Description

Constraint

Destination

Map

Yes

No

The container that stores information about the destination bucket.

None.

Action

String

No

No

The operations that can be synchronized to the destination bucket.

If you configure Action in a data replication rule, both new data and historical data will be replicated according to the operations specified in Action.

You can set Action to one or more of the following operation types.

Valid values:

  • ALL (default): indicates that PUT, DELETE, and ABORT operations are synchronized to the destination bucket.

    Important

    With this policy, operations to add, update, and delete objects are replicated to the destination bucket. This ensures data consistency and is suitable for multi-user or application environments that need to share and access the same dataset. However, after this policy is configured, when you manually delete objects from the source bucket or when objects are automatically deleted from the source bucket based on lifecycle rules, the corresponding objects in the destination bucket are also deleted and cannot be recovered.

  • PUT: indicates that write operations are synchronized to the destination bucket, including PutObject, PostObject, AppendObject, CopyObject, PutObjectACL, InitiateMultipartUpload, UploadPart, UploadPartCopy, and CompleteMultipartUpload.

    Important

    With this policy, only operations to add and update objects are replicated, while delete operations do not affect the destination bucket. This effectively prevents data loss in the destination bucket caused by manual deletion or automatic deletion based on lifecycle rules in the source bucket.

EncryptionConfiguration

Map

No

No

Target object encryption configuration.

If Status is set to Enabled, this parameter must be specified.

HistoricalObjectReplication

String

No

No

Specifies whether to replicate historical data from the source bucket

Whether to replicate existing data from the source bucket to the destination bucket before enabling data replication.

Valid values:

  • enabled (default): Replicates historical data.

  • disabled: Does not replicate historical data; only data written after the replication rule is created will be replicated.

Id

String

No

No

The unique identifier of the data replication rule.

None.

PrefixSet

List

No

No

The container that stores prefixes.

You can specify up to 10 prefixes in each data replication rule.

RTC

Map

No

No

The status of the replication time control (RTC) feature.

None.

SyncRole

String

No

No

The RAM role that OSS is authorized to use for data replication.

Required permissions are different for data replication across accounts and data replication within the same account. To complete a data replication task, you must grant the required replication permissions to the RAM role that you want Object Storage Service (OSS) to assume. For more information, refer to Data replication permissions.

SourceSelectionCriteria

Map

No

No

The container that specifies other conditions used to filter the source objects that you want to replicate.

Filtering conditions can be specified only for source objects encrypted using SSE-KMS.

RTC syntax

"RTC": {
  "Status": String
}

RTC properties

Property name

Type

Required

Editable

Description

Constraint

Status

String

No

No

Specifies whether to replicate objects that are encrypted using SSE-KMS.

Valid values:

  • Enabled: objects encrypted using SSE-KMS are replicated.

  • Disabled (default): objects encrypted using SSE-KMS are not replicated.

Destination syntax

"Destination": {
  "Bucket": String,
  "TransferType": String,
  "Location": String
}

Destination properties

Property name

Type

Required

Editable

Description

Constraint

Bucket

String

Yes

No

The destination bucket to which data is replicated.

None.

Location

String

Yes

No

The region in which the destination bucket is located.

None.

TransferType

String

Yes

No

The link that is used to transfer data during data replication.

Valid values:

  • internal (default): the default data transfer link used in OSS.

  • oss_acc: the link in which data transmission is accelerated. You can set the TransferType parameter to oss_acc only when you create cross-region replication (CRR) rules.

EncryptionConfiguration syntax

"EncryptionConfiguration": {
  "ReplicaKmsKeyID": String
}

EncryptionConfiguration properties

Property name

Type

Required

Editable

Description

Constraint

ReplicaKmsKeyID

String

No

No

The customer master key (CMK) ID that is used in SSE-KMS.

If Status is set to Enabled, this parameter must be specified.

SourceSelectionCriteria syntax

"SourceSelectionCriteria": {
  "SseKmsEncryptedObjects": Map
}

SourceSelectionCriteria properties

Property name

Type

Required

Editable

Description

Constraint

SseKmsEncryptedObjects

Map

No

No

The container that is used to filter source objects encrypted using SSE-KMS.

This parameter must be specified if SourceSelectionCriteria is specified in the data replication rule.

SseKmsEncryptedObjects syntax

"SseKmsEncryptedObjects": {
  "Status": String
}

SseKmsEncryptedObjects properties

Property name

Type

Required

Editable

Description

Constraint

Status

String

No

No

Specifies whether to replicate objects that are encrypted using SSE-KMS.

Valid values:

  • Enabled: objects encrypted using SSE-KMS are replicated.

  • Disabled (default): objects encrypted using SSE-KMS are not replicated.

Return values

Fn::GetAtt

None

Examples

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  BucketName:
    Type: String
    Description:
      en: Bucket name.
    Required: true
  ReplicationConfiguration:
    AssociationPropertyMetadata:
      Parameters:
        Rule:
          AssociationPropertyMetadata:
            Parameters:
              RTC:
                AssociationPropertyMetadata:
                  Parameters:
                    Status:
                      Type: String
                      Description:
                        en: Whether to enable real-time replication.
                      AllowedValues:
                        - enabled
                        - disabled
                      Required: false
                Type: Json
                Required: false
              Destination:
                AssociationPropertyMetadata:
                  Parameters:
                    Bucket:
                      Type: String
                      Description:
                        en: Destination bucket name.
                      Required: true
                    TransferType:
                      Type: String
                      Description:
                        en: Transfer type for replication.
                      AllowedValues:
                        - internal
                        - accelerate
                      Required: true
                      Default: internal
                    Location:
                      Type: String
                      Description:
                        en: Destination region.
                      Required: true
                Type: Json
                Description:
                  en: Destination bucket and location for replication.
                Required: true
              Action:
                Type: String
                Description:
                  en: Action to be taken on matching objects. Valid values are ALL, PUT, DELETE.
                AllowedValues:
                  - ALL
                  - PUT
                  - DELETE
                Required: false
              SyncRole:
                Type: String
                Description:
                  en: Role used for replication synchronization.
                Required: false
              EncryptionConfiguration:
                AssociationPropertyMetadata:
                  Parameters:
                    ReplicaKmsKeyID:
                      Type: String
                      Description:
                        en: ARN of the KMS key used to encrypt replica objects.
                      Required: false
                Type: Json
                Required: false
              SourceSelectionCriteria:
                AssociationPropertyMetadata:
                  Parameters:
                    SseKmsEncryptedObjects:
                      AssociationPropertyMetadata:
                        Parameters:
                          Status:
                            Type: String
                            Description:
                              en: Status of KMS encrypted object replication.
                            AllowedValues:
                              - Enabled
                              - Disabled
                            Required: false
                      Type: Json
                      Required: false
                Type: Json
                Description:
                  en: Criteria for selecting source objects.
                Required: false
              PrefixSet:
                AssociationPropertyMetadata:
                  Parameter:
                    Type: String
                    Required: false
                AssociationProperty: List[Parameter]
                Type: Json
                Description:
                  en: List of prefixes to which this rule applies.
                Required: false
              Id:
                Type: String
                Description:
                  en: ID of the rule applied.
                Required: false
              HistoricalObjectReplication:
                Type: String
                Description:
                  en: Whether to replicate existing objects.
                AllowedValues:
                  - enabled
                  - disabled
                Required: false
          Type: Json
          Description:
            en: Replication Rule
          Required: true
    Type: Json
    Description:
      en: Replication configuration.
    Required: true
Resources:
  Replication:
    Type: ALIYUN::OSS::BucketReplication
    Properties:
      BucketName:
        Ref: BucketName
      ReplicationConfiguration:
        Ref: ReplicationConfiguration
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "BucketName": {
      "Type": "String",
      "Description": {
        "en": "Bucket name."
      },
      "Required": true
    },
    "ReplicationConfiguration": {
      "AssociationPropertyMetadata": {
        "Parameters": {
          "Rule": {
            "AssociationPropertyMetadata": {
              "Parameters": {
                "RTC": {
                  "AssociationPropertyMetadata": {
                    "Parameters": {
                      "Status": {
                        "Type": "String",
                        "Description": {
                          "en": "Whether to enable real-time replication."
                        },
                        "AllowedValues": [
                          "enabled",
                          "disabled"
                        ],
                        "Required": false
                      }
                    }
                  },
                  "Type": "Json",
                  "Required": false
                },
                "Destination": {
                  "AssociationPropertyMetadata": {
                    "Parameters": {
                      "Bucket": {
                        "Type": "String",
                        "Description": {
                          "en": "Destination bucket name."
                        },
                        "Required": true
                      },
                      "TransferType": {
                        "Type": "String",
                        "Description": {
                          "en": "Transfer type for replication."
                        },
                        "AllowedValues": [
                          "internal",
                          "accelerate"
                        ],
                        "Required": true,
                        "Default": "internal"
                      },
                      "Location": {
                        "Type": "String",
                        "Description": {
                          "en": "Destination region."
                        },
                        "Required": true
                      }
                    }
                  },
                  "Type": "Json",
                  "Description": {
                    "en": "Destination bucket and location for replication."
                  },
                  "Required": true
                },
                "Action": {
                  "Type": "String",
                  "Description": {
                    "en": "Action to be taken on matching objects. Valid values are ALL, PUT, DELETE."
                  },
                  "AllowedValues": [
                    "ALL",
                    "PUT",
                    "DELETE"
                  ],
                  "Required": false
                },
                "SyncRole": {
                  "Type": "String",
                  "Description": {
                    "en": "Role used for replication synchronization."
                  },
                  "Required": false
                },
                "EncryptionConfiguration": {
                  "AssociationPropertyMetadata": {
                    "Parameters": {
                      "ReplicaKmsKeyID": {
                        "Type": "String",
                        "Description": {
                          "en": "ARN of the KMS key used to encrypt replica objects."
                        },
                        "Required": false
                      }
                    }
                  },
                  "Type": "Json",
                  "Required": false
                },
                "SourceSelectionCriteria": {
                  "AssociationPropertyMetadata": {
                    "Parameters": {
                      "SseKmsEncryptedObjects": {
                        "AssociationPropertyMetadata": {
                          "Parameters": {
                            "Status": {
                              "Type": "String",
                              "Description": {
                                "en": "Status of KMS encrypted object replication."
                              },
                              "AllowedValues": [
                                "Enabled",
                                "Disabled"
                              ],
                              "Required": false
                            }
                          }
                        },
                        "Type": "Json",
                        "Required": false
                      }
                    }
                  },
                  "Type": "Json",
                  "Description": {
                    "en": "Criteria for selecting source objects."
                  },
                  "Required": false
                },
                "PrefixSet": {
                  "AssociationPropertyMetadata": {
                    "Parameter": {
                      "Type": "String",
                      "Required": false
                    }
                  },
                  "AssociationProperty": "List[Parameter]",
                  "Type": "Json",
                  "Description": {
                    "en": "List of prefixes to which this rule applies."
                  },
                  "Required": false
                },
                "Id": {
                  "Type": "String",
                  "Description": {
                    "en": "ID of the rule applied."
                  },
                  "Required": false
                },
                "HistoricalObjectReplication": {
                  "Type": "String",
                  "Description": {
                    "en": "Whether to replicate existing objects."
                  },
                  "AllowedValues": [
                    "enabled",
                    "disabled"
                  ],
                  "Required": false
                }
              }
            },
            "Type": "Json",
            "Description": {
              "en": "Replication Rule"
            },
            "Required": true
          }
        }
      },
      "Type": "Json",
      "Description": {
        "en": "Replication configuration."
      },
      "Required": true
    }
  },
  "Resources": {
    "Replication": {
      "Type": "ALIYUN::OSS::BucketReplication",
      "Properties": {
        "BucketName": {
          "Ref": "BucketName"
        },
        "ReplicationConfiguration": {
          "Ref": "ReplicationConfiguration"
        }
      }
    }
  }
}