ALIYUN::OSS::BucketReplication类型用于为存储空间(Bucket)指定数据复制规则。
语法
{
  "Type": "ALIYUN::OSS::BucketReplication",
  "Properties": {
    "BucketName": String,
    "ReplicationConfiguration": Map
  }
}属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| BucketName | String | 是 | 否 | 指定数据要复制到的目标Bucket。 | 无 | 
| ReplicationConfiguration | Map | 是 | 否 | 配置Bucket数据复制规则的容器。 | 更多信息,请参考ReplicationConfiguration属性。 | 
ReplicationConfiguration语法
"ReplicationConfiguration": {
  "Rule": Map
}ReplicationConfiguration属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| Rule | Map | 是 | 否 | 保存数据复制规则的容器。 | 更多信息,请参考Rule属性。 | 
Rule语法
"Rule": {
  "RTC": Map,
  "Destination": Map,
  "Action": String,
  "SyncRole": String,
  "EncryptionConfiguration": Map,
  "SourceSelectionCriteria": Map,
  "PrefixSet": List,
  "Id": String,
  "HistoricalObjectReplication": String
}Rule属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| Destination | Map | 是 | 否 | 保存目标Bucket信息的容器。 | 无 | 
| Action | String | 否 | 否 | 指定可以被复制到目标Bucket的操作。 | 如果配置了Action,则新写入的数据和历史数据的同步都会遵循Action指定的复制操作。 Action允许以下操作类型,您可以指定一项或多项。 取值: 
 | 
| EncryptionConfiguration | Map | 否 | 否 | 目标对象加密配置。 | 如果指定Status为Enabled,则必须指定该元素。 | 
| HistoricalObjectReplication | String | 否 | 否 | 指定是否复制历史数据。 | 即开启数据复制前,是否将源Bucket中的数据复制到目标Bucket。 取值: 
 | 
| Id | String | 否 | 否 | 数据复制规则的唯一标识。 | 无 | 
| PrefixSet | List | 否 | 否 | 保存前缀(Prefix)的容器。 | 每条数据复制规则中,最多可指定10条Prefix。 | 
| RTC | Map | 否 | 否 | 数据复制时间控制功能的状态。 | 无 | 
| SyncRole | String | 否 | 否 | 授权OSS使用哪个RAM角色来进行数据复制。 | 数据复制权限有同账号复制与跨账号复制两种使用场景。对于同账号与跨账号复制,您必须授予RAM角色相应的复制权限,否则无法完成复制任务。详情请参见数据复制权限介绍。 | 
| SourceSelectionCriteria | Map | 否 | 否 | 用于标识要复制的源对象的其他筛选条件的容器。 | 当前OSS仅支持针对SSE-KMS加密的源对象指定筛选条件。 | 
RTC语法
"RTC": {
  "Status": String
}RTC属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| Status | String | 否 | 否 | 指定OSS是否复制通过SSE-KMS加密创建的对象。 | 取值范围如下: 
 | 
Destination语法
"Destination": {
  "Bucket": String,
  "TransferType": String,
  "Location": String
}Destination属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| Bucket | String | 是 | 否 | 指定数据要复制到的目标Bucket。 | 无 | 
| Location | String | 是 | 否 | 目标Bucket所处的地域。 | 无 | 
| TransferType | String | 是 | 否 | 指定数据复制时使用的数据传输链路。 | 取值: 
 | 
EncryptionConfiguration语法
"EncryptionConfiguration": {
  "ReplicaKmsKeyID": String
}EncryptionConfiguration属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| ReplicaKmsKeyID | String | 否 | 否 | 指定SSE-KMS密钥ID。 | 如果指定Status为Enabled,则必须指定该元素。 | 
SourceSelectionCriteria语法
"SourceSelectionCriteria": {
  "SseKmsEncryptedObjects": Map
}SourceSelectionCriteria属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| SseKmsEncryptedObjects | Map | 否 | 否 | 用于筛选使用SSE-KMS加密对象的容器。 | 如果在数据复制规则中指定了SourceSelectionCriteria,则必须指定该元素。 | 
SseKmsEncryptedObjects语法
"SseKmsEncryptedObjects": {
  "Status": String
}SseKmsEncryptedObjects属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| Status | String | 否 | 否 | 指定OSS是否复制通过SSE-KMS加密创建的对象。 | 取值范围如下: 
 | 
返回值
Fn::GetAtt
无
示例
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"
        }
      }
    }
  }
}