我已依照「透過 AWS Config 規則修復不合規的 AWS 資源」的指示操作。但修補執行失敗,且 AWS Config 主控台顯示動作狀態錯誤「動作執行失敗 (詳細資訊)」。我已開啟詳細資訊頁面,但該頁面未提供對該問題進行疑難排解的足夠資訊。
解決方法
請依照下列指示使用 AWS Command Line Interface (AWS CLI) 或 AWS CloudTrail 事件歷史記錄對修復動作失敗進行疑難排解。
**注意事項:**如果您在執行 AWS CLI 命令時收到錯誤訊息,請確認您使用的是最新版本的 AWS CLI。
AWS CLI
- 執行 AWS CLI 命令 describe-remediation-execution-status 以取得更詳細的錯誤訊息、狀態和時間戳記,修復動作步驟類似於以下內容:
aws configservice describe-remediation-execution-status \
--config-rule-name example-rule \
--region example-region \
--resource-keys resourceType=example-resource-type,resourceId=example-resource-ID
**注意事項:**使用 AWS Config 規則名稱、區域、資源類型和資源 ID 取代 example-rule、example-region、example-resource-type 和 example-resource-ID。
- 您會收到類似下列內容的輸出:
{
"RemediationExecutionStatuses": [
{
"ResourceKey": {
"resourceType": "AWS::EC2::Volume",
"resourceId": "vol-0b399a24561582586"
},
"State": "FAILED",
"StepDetails": [
{
"Name": "createDocumentStack",
"State": "FAILED",
"ErrorMessage": "Automation Step Execution fails when it is creating a CloudFormation stack.
Get Exception from CreateStack API of cloudformation Service. Exception Message from CreateStack API:
[User: arn:aws:sts::xxxxx:assumed-role/config-remediation-sshpublic-role-zkga0ot3/config-remediation-sshpublic is not authorized to perform: cloudformation:CreateStack
on resource: arn:aws:cloudformation:eu-west-2:xxxxx:stack/DetachEBSVolumeStack2f6d3590-ea2c-424a-97ea-045749f07164/*
(Service: AmazonCloudFormation; Status Code: 403; Error Code: AccessDenied; Request ID: b8f41dd6-9020-11e9-897d-f9719db1a9e6)].
Please refer to Automation Service Troubleshooting Guide for more diagnosis details.",
"StartTime": 1560680582.675,
"StopTime": 1560680582.884
},
{
"Name": "detachVolume",
"State": "PENDING"
},
{
"Name": "deleteCloudFormationTemplate",
"State": "PENDING"
}
],
"InvocationTime": 1560680582.419,
"LastUpdatedTime": 1560680583.67
}
]
}
- 在 StepDetails 中,記下錯誤訊息和失敗原因。
CloudTrail 事件歷史記錄
1. 開啟 AWS CloudTrail 主控台。
-
請依照在 CloudTrail 主控台中檢閱 CloudTrail 事件的指示進行操作。
-
當 AWS Config 啟動修復動作時,將叫用 StartAutomationExecution API 操作。使用 StartAutomationExecution API 篩選事件名稱,並在事件詳細資訊頁面中,複製 requestID。
4. 開啟 AWS Systems Manager 主控台,然後從導覽窗格中選擇自動化。
-
在自動化文件搜尋欄位中貼上 requestID。
-
然後,找到該修復執行的操作。驗證該錯誤是否與 AWS Identity and Access Management (IAM) 許可、語法問題或修復動作中配置的不正確參數相關。
相關資訊
為 AWS Config 使用者授予自訂許可
如何對 AWS Config 主控台錯誤訊息進行疑難排解?
檢視、更新和刪除規則 (AWS CLI)
如何解決嘗試在 AWS Config 中刪除修復動作時遇到的錯誤「NoSuchRemediationConfigurationException」或「unexpected internal error」?