我已依照指示透過 AWS Config 規則修復不合規的 AWS 資源。但是,修復動作失敗,並顯示錯誤 "Action execution failed (details)"。我檢閱了錯誤詳細資訊,但沒有足夠的資訊用於對問題進行疑難排解。
解決方法
請依照下列指示使用 AWS Command Line Interface (AWS CLI) 或 AWS CloudTrail 事件歷史記錄對修復動作失敗進行疑難排解。
**注意:**如果您在執行 AWS CLI 命令時收到錯誤,請參閱對 AWS CLI 錯誤進行疑難排解。此外,請確定您使用的是最新的 AWS CLI 版本。
AWS CLI
若要尋找與失敗的修復動作相關的錯誤資訊,請在 AWS CLI 中完成下列步驟:
-
若要取得更詳細的錯誤訊息、狀態資訊和修正動作步驟的時間戳記,請執行 describe-remediation-execution-status AWS CLI 命令。
請參閱下列範例:
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 規則名稱、AWS 區域、資源類型和資源 ID 取代 example-rule、example-region、example-resource-type 和 example-resource-ID。
-
檢閱您的命令輸出。
請參閱下列範例:
{
"RemediationExecutionStatuses": [
{
"InvocationTime": 1560680582.419,
"LastUpdatedTime": 1560680583.67,
"ResourceKey": {
"resourceId": "vol-0b399a24561582586",
"resourceType": "AWS::EC2::Volume"
},
"State": "FAILED",
"StepDetails": [
{
"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.",
"Name": "createDocumentStack",
"StartTime": 1560680582.675,
"State": "FAILED",
"StopTime": 1560680582.884
},
{
"Name": "detachVolume",
"State": "PENDING"
},
{
"Name": "deleteCloudFormationTemplate",
"State": "PENDING"
}
]
}
]
}
-
在 StepDetails 清單中,檢閱錯誤訊息資訊。
**注意:**錯誤中的時間戳記為紀元時間格式。要將時間戳記轉換為 UTC,請使用免費的線上轉換器,例如 EpochConverter。
CloudTrail 事件歷史記錄
若要尋找與失敗的修復動作相關的錯誤資訊,請在 CloudTrail 和 AWS Systems Manager 主控台中完成下列步驟:
- 開啟 CloudTrail 主控台。
- 請遵循使用 CloudTrail 主控台檢視最近的 CloudTrail 管理事件的說明。
- 當 AWS Config 啟動修復動作時,將調用 StartAutomationExecution API 動作。在事件歷史記錄頁面上,依事件名稱查詢屬性進行篩選,然後搜尋 StartAutomationExecution。
- 選擇相關的 API 事件。
- 在事件詳細資訊頁面的事件 JSON 中,複製 requestID 值。
- 開啟 Systems Manager 主控台。
- 在導覽窗格中,選擇自動化。
- 在自動執行頁面上,依執行 ID 屬性進行篩選,然後搜尋步驟 4 中複製的 requestID 值。
- 檢閱執行詳細資訊頁面上的資訊。確定失敗詳細資訊是否與 AWS Identity and Access Management (IAM) 權限、語法問題或修復動作中設定的不正確參數相關。使用這些詳細資訊修復不符合規的資源。
相關資訊
如何針對 AWS Config 主控台錯誤訊息進行疑難排解?
檢視、更新或新增和刪除規則 (AWS CLI)