

• 2026 年 4 月 30 日之後將不再提供 AWS Systems Manager CloudWatch Dashboard。客戶可以繼續使用 Amazon CloudWatch 主控台來檢視、建立和管理其 Amazon CloudWatch 儀表板，就像現在一樣。如需詳細資訊，請參閱 [Amazon CloudWatch Dashboard 文件](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 故障診斷 Systems Manager Automation
<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 未定義 400
<a name="automation-trbl-common-vpc"></a>

根據預設，自動化執行 `AWS-UpdateLinuxAmi` Runbook 或 `AWS-UpdateWindowsAmi` Runbook 時，系統會在預設 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 政策連接至用於啟動自動化的使用者。
+ 可能原因 2：嘗試啟動自動化的使用者有叫用 `StartAutomationExecution` API 的許可，但沒有使用特定執行手冊叫用 API 的許可。若要解決此問題，請將所需的 IAM 政策連接至用於啟動自動化的使用者。

**由於缺少 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)`

嘗試啟動自動化的使用者沒有所擔任角色的 PassRole 許可。若要解決此問題，請將 iam:PassRole 政策連接至嘗試啟動自動化的使用者角色。如需詳細資訊，請參閱[任務 2：將 iam:PassRole 政策連接至自動化角色](automation-setup-iam.md#attach-passrole-policy)。

### 無效的擔任角色
<a name="automation-trbl-ar"></a>

在您執行 Automation 時，擔任角色會由 Runbook 提供或做為 Runbook 的參數值傳遞。如果未指定或正確設定擔任角色，可能會發生不同類型的錯誤。

**格式錯誤的擔任角色**  
**錯誤訊息**：`The format of the supplied assume role ARN isn't valid.` 擔任角色格式不正確。若要解決此問題，請確認您的 Runbook 中指定了有效的擔任角色，或在執行自動化時將其做為執行時間參數。

**擔任角色無法擔任**  
**錯誤訊息**：`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>

Runbook 包含步驟和依序執行的步驟。每個步驟會呼叫一個或多個 AWS 服務 API。API 會決定輸入、行為和步驟的輸出。有許多地方可能會發生錯誤導致步驟失敗。失敗訊息會指出錯誤發生的時間和位置。

若要在 Amazon Elastic Compute Cloud (Amazon EC2) 主控台查看失敗訊息，請選擇失敗步驟的 **View Outputs (檢視輸出)** 連結。若要從 查看失敗訊息 AWS CLI，請呼叫 `get-automation-execution` 並在失敗的 中尋找 `FailureMessage` 屬性`StepExecution`。

在以下範例中，與 `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 更新 Runbook 或參數值。

**擔任角色政策缺少足夠的許可**  
**錯誤訊息**：`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 政策連接至擁有呼叫 `RunInstances` API 之許可的擔任角色。如需更多資訊，請參閱[使用主控台建立用於自動化的服務角色](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 執行命令](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 | [Amazon Machine Image](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.`

Automation 服務的一項問題使指定的 Runbook 無法正確執行。若要解決此問題，請聯絡 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` 參數指定較長的值。如果這樣未解決問題，請調查步驟執行時間比預期更久的原因