

# 多区域金丝雀的权限
<a name="CloudWatch_Synthetics_MultiLocation_Permissions"></a>

要创建和管理多区域金丝雀，IAM 主体必须具有标准的 CloudWatch Synthetics 权限（请参阅 [CloudWatch 金丝雀的必需角色和权限](CloudWatch_Synthetics_Canaries_Roles.md)）以及以下权限：
+ `synthetics:ReplicateCanary`：允许 CloudWatch Synthetics 服务代表您在副本区域中创建、更新和删除副本。如果策略已包含 `synthetics:*`，则该权限已包含在内，无需执行其他操作。

**多区域金丝雀的条件键**  
您可以在 IAM 策略中使用条件键来控制哪些区域可以用作副本区域。以下条件键可用于：


| 条件键 | 说明 | Type | 结合使用 | 
| --- | --- | --- | --- | 
| synthetics:AddReplicaLocations | 按请求中指定的副本区域筛选访问权限 | 字符串数组 | synthetics:CreateCanary, synthetics:UpdateCanary | 
| synthetics:RemoveReplicaLocations | 按请求中要移除的副本区域筛选访问权限 | 字符串数组 | synthetics:UpdateCanary | 

**示例：仅允许复制到特定区域**  
以下策略仅允许在美国和加拿大区域创建和更新带有副本的金丝雀。

```
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "synthetics:CreateCanary",
                "synthetics:UpdateCanary"
            ],
            "Resource": "*",
            "Condition": {
                "ForAllValues:StringLike": {
                    "synthetics:AddReplicaLocations": [
                        "us-*",
                        "ca-*"
                    ]
                }
            }
        }
    ]
}
```

**示例：拒绝复制到特定区域**  
以下策略拒绝在 `eu-west-1` 或 `ap-southeast-1` 中创建或更新带有副本的金丝雀。

```
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Deny",
            "Action": [
                "synthetics:CreateCanary",
                "synthetics:UpdateCanary"
            ],
            "Resource": "*",
            "Condition": {
                "ForAnyValue:StringEquals": {
                    "synthetics:AddReplicaLocations": [
                        "eu-west-1",
                        "ap-southeast-1"
                    ]
                }
            }
        }
    ]
}
```

有关 CloudWatch Synthetics 权限的更多信息，请参阅 [CloudWatch 金丝雀的必需角色和权限](CloudWatch_Synthetics_Canaries_Roles.md)。