

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

# Systems Manager 自动化故障排除
<a name="automation-troubleshooting"></a>

利用以下信息，帮助排查 AWS Systems Manager Automation（AWS Systems Manager 中的一项工具）出现的问题。本主题介绍了依据自动化错误消息解决问题的特定任务。

**Topics**
+ [常见自动化错误](#automation-trbl-common)
+ [自动化执行无法启动](#automation-trbl-access)
+ [执行已启动，但是状态为“失败”](#automation-trbl-exstrt)
+ [执行已启动，但超时](#automation-trbl-to)

## 常见自动化错误
<a name="automation-trbl-common"></a>

此部分提供有关常见自动化错误的信息。

### VPC not defined 400
<a name="automation-trbl-common-vpc"></a>

默认情况下，当自动化运行 `AWS-UpdateLinuxAmi` 运行手册或 `AWS-UpdateWindowsAmi` 运行手册时，系统会在默认 VPC (172.30.0.0/16) 中创建一个临时实例。如果您删除了默认 VPC，会收到以下错误：

`VPC not defined 400`

要解决此问题，您必须为 `SubnetId` 输入参数指定值。

## 自动化执行无法启动
<a name="automation-trbl-access"></a>

如果您没有为自动化正确配置 AWS Identity and Access Management（IAM）角色和策略，自动化可能因拒绝访问错误或担任角色无效错误而失败。

### 拒绝访问
<a name="automation-trbl-access-denied"></a>

以下示例描述了自动化执行因拒绝访问错误无法启动的情况。

**对 Systems Manager API 的访问被拒绝**  
**错误消息**：`User: user arn isn't authorized to perform: ssm:StartAutomationExecution on resource: document arn (Service: AWSSimpleSystemsManagement; Status Code: 400; Error Code: AccessDeniedException; Request ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)`
+ 可能的原因 1：尝试启动自动化的用户没有调用 `StartAutomationExecution` API 的权限。要解决此问题，请将所需的 IAM policy 附加到用于启动自动化的用户。
+ 可能的原因 2：尝试启动自动化的用户拥有调用 `StartAutomationExecution` API 的权限，但是无权使用特定运行手册来调用该 API。要解决此问题，请将所需的 IAM policy 附加到用于启动自动化的用户。

**由于缺少 PassRole 权限而导致访问被拒**  
**错误消息**：`User: user arn isn't authorized to perform: iam:PassRole on resource: automation assume role arn (Service: AWSSimpleSystemsManagement; Status Code: 400; Error Code: AccessDeniedException; Request ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)`

尝试启动自动化的 IAM 用户没有担任角色所需的 PassRole 权限。要解决此问题，请将 iam:PassRole 策略附加到尝试启动自动化的用户的角色。有关更多信息，请参阅 [任务 2：将 iam:PassRole 策略附加到您的自动化角色](automation-setup-iam.md#attach-passrole-policy)。

### 担任角色无效
<a name="automation-trbl-ar"></a>

运行自动化时，要么在运行手册中提供担任角色，要么将担任角色作为运行手册的一个参数值传递。如果未指定或未正确配置担任角色，可出现不同类型的错误。

**担任角色格式错误**  
**错误消息**：`The format of the supplied assume role ARN isn't valid.`担任角色格式不正确。要解决该问题，请验证运行手册中是否指定了有效的担任角色，或者在启动自动化时指定为运行时的参数。

**无法担任担任角色**  
**错误消息**：`The defined assume role is unable to be assumed. (Service: AWSSimpleSystemsManagement; Status Code: 400; Error Code: InvalidAutomationExecutionParametersException; Request ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)`
+ 可能的原因 1：担任角色不存在。要解决该问题，请创建角色。有关更多信息，请参阅 [设置自动化](automation-setup.md)。创建此角色的特定详细信息在以下主题中介绍 [任务 1：为自动化创建服务角色](automation-setup-iam.md#create-service-role)。
+ 可能的原因 2：担任角色没有与 Systems Manager 服务的信任关系。要解决该问题，请创建信任关系。有关更多信息，请参阅 *《IAM 用户指南》*中的[我无法担任角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_roles.html#troubleshoot_roles_cant-assume-role)。

## 执行已启动，但是状态为“失败”
<a name="automation-trbl-exstrt"></a>

### 操作特定的失败
<a name="automation-trbl-actspec"></a>

运行手册包含步骤，并且步骤按顺序运行。每个步骤会调用一项或多项 AWS 服务 API。API 可确定本步的输入、行为和输出。在多个位置错误可能导致步骤失败。失败消息指示出现错误的时间和位置。

要查看 Amazon Elastic Compute Cloud (Amazon EC2) 控制台中的失败消息，请选择失败步骤的**查看输出**链接。要查看 AWS CLI 中的失败消息，请调用 `get-automation-execution` 并查找失败的 `StepExecution` 中的 `FailureMessage` 属性。

在以下示例中，与 `aws:runInstance` 操作相关联的步骤失败。每个示例探讨了不同类型的错误。

**缺少映像**  
**错误消息**：`Automation Step Execution fails when it's launching the instance(s). Get Exception from RunInstances API of ec2 Service. Exception Message from RunInstances API: [The image id '[ami id]' doesn't exist (Service: AmazonEC2; Status Code: 400; Error Code: InvalidAMIID.NotFound; Request ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)]. Please refer to Automation Service Troubleshooting Guide for more diagnosis details.`

`aws:runInstances` 操作收到的 `ImageId` 输入不存在。要解决该问题，请用正确的 AMI ID 更新运行手册或参数值。

**担任角色策略缺少足够的权限**  
**错误消息**：`Automation Step Execution fails when it's launching the instance(s). Get Exception from RunInstances API of ec2 Service. Exception Message from RunInstances API: [You aren't authorized to perform this operation. Encoded authorization failure message: xxxxxxx (Service: AmazonEC2; Status Code: 403; Error Code: UnauthorizedOperation; Request ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)]. Please refer to Automation Service Troubleshooting Guide for more diagnosis details.`

担任角色的权限不足，无法在 EC2 实例上调用 `RunInstances` API。要解决此问题，请将 IAM policy 附加到有权调用 `RunInstances` API 的担任角色。有关更多信息，请参阅[使用控制台为 Automation 创建服务角色](automation-setup-iam.md)。

**意外状态**  
**错误消息**：`Step fails when it's verifying launched instance(s) are ready to be used. Instance i-xxxxxxxxx entered unexpected state: shutting-down. Please refer to Automation Service Troubleshooting Guide for more diagnosis details.`
+ 可能的原因 1：实例或 Amazon EC2 服务有问题。要解决此问题，请登录到实例或查阅实例系统日志以了解实例启动关闭的原因。
+ 可能的原因 2：为 `aws:runInstances` 操作指定的用户数据脚本有问题或语法错误。验证用户数据脚本的语法。另外，请验证用户数据脚本是否未关闭实例，或者调用了关闭该实例的其他脚本。

**操作特定失败参考**  
如果步骤失败，失败消息可能指示失败时正在调用哪个服务。下表列出每个操作调用的服务。该表还提供指向有关每个服务的信息的链接。


****  

| Action | 此操作调用的 AWS 服务 | 有关此服务的信息 | 排查内容问题 | 
| --- | --- | --- | --- | 
|  `aws:runInstances`  |  Amazon EC2  |  [Amazon EC2 用户指南](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/)  |  [EC2 实例故障排除](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-troubleshoot.html)  | 
|  `aws:changeInstanceState`  |  Amazon EC2  |  [Amazon EC2 用户指南](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/)  |  [EC2 实例故障排除](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-troubleshoot.html)  | 
|  `aws:runCommand`  |  Systems Manager  |   [AWS Systems Manager Run Command](run-command.md)  |   [对 Systems Manager Run Command 进行故障排除](troubleshooting-remote-commands.md)  | 
|  `aws:createImage`  |  Amazon EC2  |  [https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html)  |  | 
|  `aws:createStack`  |  CloudFormation  |  [《AWS CloudFormation 用户指南》](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html)  |  [CloudFormation 问题排查](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/troubleshooting.html)  | 
|  `aws:deleteStack`  |  CloudFormation  |  [《AWS CloudFormation 用户指南》](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html)  |  [CloudFormation 问题排查](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/troubleshooting.html)  | 
|  `aws:deleteImage`  |  Amazon EC2  |  [亚马逊机器映像](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html)  |  | 
|  `aws:copyImage`  |  Amazon EC2  |  [https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html)  |  | 
|  `aws:createTag`  |  Amazon EC2，Systems Manager  |  [EC2 资源和标签](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_Resources.html)  |  | 
|  `aws:invokeLambdaFunction`  |  AWS Lambda  |  [AWS Lambda 开发人员指南](https://docs.aws.amazon.com/lambda/latest/dg/)  |  [Lambda 故障排除](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-functions.html)  | 

### 自动化服务内部错误
<a name="automation-trbl-err"></a>

**错误消息**：`Internal Server Error. Please refer to Automation Service Troubleshooting Guide for more diagnosis details.`

自动化 服务中的一个问题导致指定运行手册无法正确运行。要解决此问题，请联系 AWS 支持。请提供执行 ID 和客户 ID (如果有)。

## 执行已启动，但超时
<a name="automation-trbl-to"></a>

**错误消息**：`Step timed out while step is verifying launched instance(s) are ready to be used. Please refer to Automation Service Troubleshooting Guide for more diagnosis details.`

`aws:runInstances` 操作中的步骤超时。如果运行本步骤操作所花的时间超出此步骤中为 `timeoutSeconds` 指定的值，就会发生这种情况。要解决此问题，请为 `aws:runInstances` 操作中的 `timeoutSeconds` 参数指定更长的值。如果不能解决问题，请调查步骤运行时间超出预期的原因