

• Amazon Systems Manager CloudWatch 控制面板在 2026 年 4 月 30 日之后将不再可用。客户可以像现在一样继续使用 Amazon CloudWatch 控制台来查看、创建和管理其 Amazon CloudWatch 控制面板。有关更多信息，请参阅 [Amazon CloudWatch 控制面板文档](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html)。

# `aws:copyImage` – 复制或加密Amazon Machine Image
<a name="automation-action-copyimage"></a>

将 Amazon Machine Image (AMI) 从任何 Amazon Web Services 区域 复制到当前区域中。此操作还可以对新的 AMI 进行加密。

**注意**  
`aws:copyImage` 操作支持自动节流重试。有关更多信息，请参阅 [为节流的操作配置自动重试](automation-throttling-retry.md)。

**Input**  
此操作支持大多数 `CopyImage` 参数。有关更多信息，请参阅 [CopyImage](https://docs.amazonaws.cn/AWSEC2/latest/APIReference/API_CopyImage.html)。

以下示例是在首尔地区创建 AMI 的副本（`SourceImageID`：ami-0fe10819。`SourceRegion`：ap-northeast-2）。新的 AMI 将复制到您启动自动化操作的区域。将对复制的 AMI 进行加密，因为可选 `Encrypted` 标记将设置为 `true`。

------
#### [ YAML ]

```
name: createEncryptedCopy
action: aws:copyImage
maxAttempts: 3
onFailure: Abort
inputs:
  SourceImageId: ami-0fe10819
  SourceRegion: ap-northeast-2
  ImageName: Encrypted Copy of LAMP base AMI in ap-northeast-2
  Encrypted: true
```

------
#### [ JSON ]

```
{   
    "name": "createEncryptedCopy",
    "action": "aws:copyImage",
    "maxAttempts": 3,
    "onFailure": "Abort",
    "inputs": {
        "SourceImageId": "ami-0fe10819",
        "SourceRegion": "ap-northeast-2",
        "ImageName": "Encrypted Copy of LAMP base AMI in ap-northeast-2",
        "Encrypted": true
    }   
}
```

------

SourceRegion  
源 AMI 当前所在的区域。  
类型：字符串  
是否必需：是

SourceImageId  
要从源区域复制的 AMI ID。  
类型：字符串  
是否必需：是

ImageName  
新映像的名称。  
类型：字符串  
是否必需：是

ImageDescription  
目标映像的描述。  
类型：字符串  
必需：否

已加密  
对目标 AMI 进行加密。  
类型：布尔值  
必需：否

KmsKeyId  
在复制操作期间对映像快照进行加密时要使用的 Amazon KMS key 的完整 Amazon Resource Name (ARN)。有关更多信息，请参阅 [CopyImage](https://docs.amazonaws.cn/AWSEC2/latest/APIReference/api_copyimage.html)。  
类型：字符串  
必需：否

ClientToken  
您为确保请求幂等性而提供的唯一、区分大小写的标识符。有关更多信息，请参阅 [CopyImage](https://docs.amazonaws.cn/AWSEC2/latest/APIReference/api_copyimage.html)。  
类型：字符串  
必需：否Output

ImageId  
已复制映像的 ID。

ImageState  
已复制映像的状态。  
有效值：`available` \$1`pending` \$1`failed`