Amazon EC2 Auto Scaling 故障診斷 - Amazon EC2 Auto Scaling

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

Amazon EC2 Auto Scaling 故障診斷

Amazon EC2 Auto Scaling 提供特定和描述性錯誤,協助您進行故障診斷。您可以在描述擴展活動中找到錯誤訊息。

從擴展活動擷取錯誤訊息

若要從擴展活動的描述中擷取錯誤訊息,請使用 describe-scaling-activities 命令。您有可追溯到 6 週前的擴展活動紀錄。擴展活動依開始時間排序,並會先列出最新的擴展活動。

注意

擴展活動也會顯示在 Amazon EC2 Auto Scaling 主控台的 Auto Scaling 群組的 Activity (活動) 索引標籤的活動歷史記錄中。

若要查看特定 Auto Scaling 群組的擴展活動,請使用下列命令。

aws autoscaling describe-scaling-activities --auto-scaling-group-name my-asg

以下是範例回應,其中 StatusCode 包含目前活動的狀態,StatusMessage 包含錯誤訊息。

{ "Activities": [ { "ActivityId": "3b05dbf6-037c-b92f-133f-38275269dc0f", "AutoScalingGroupName": "my-asg", "Description": "Launching a new EC2 instance: i-003a5b3ffe1e9358e. Status Reason: Instance failed to complete user's Lifecycle Action: Lifecycle Action with token e85eb647-4fe0-4909-b341-a6c42d8aba1f was abandoned: Lifecycle Action Completed with ABANDON Result", "Cause": "At 2021-01-11T00:35:52Z a user request created an AutoScalingGroup changing the desired capacity from 0 to 1. At 2021-01-11T00:35:53Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 1.", "StartTime": "2021-01-11T00:35:55.542Z", "EndTime": "2021-01-11T01:06:31Z", "StatusCode": "Cancelled", "StatusMessage": "Instance failed to complete user's Lifecycle Action: Lifecycle Action with token e85eb647-4fe0-4909-b341-a6c42d8aba1f was abandoned: Lifecycle Action Completed with ABANDON Result", "Progress": 100, "Details": "{\"Subnet ID\":\"subnet-5ea0c127\",\"Availability Zone\":\"us-west-2b\"...}", "AutoScalingGroupARN": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:283179a2-f3ce-423d-93f6-66bb518232f7:autoScalingGroupName/my-asg" }, ... ] }

如需輸出中欄位的說明,請參閱《Amazon EC2 Auto Scaling API 參考》中的活動

檢視已刪除群組的擴展活動

若要在刪除 Auto Scaling 群組之後檢視擴展活動,請按如下所示將 --include-deleted-groups 選項新增至 describe-scaling-activities 命令。

aws autoscaling describe-scaling-activities --auto-scaling-group-name my-asg --include-deleted-groups

以下為回應範例,其中包含已刪除群組的擴展活動。

{ "Activities": [ { "ActivityId": "e1f5de0e-f93e-1417-34ac-092a76fba220", "AutoScalingGroupName": "my-asg", "Description": "Launching a new EC2 instance. Status Reason: Your Spot request price of 0.001 is lower than the minimum required Spot request fulfillment price of 0.0031. Launching EC2 instance failed.", "Cause": "At 2021-01-13T20:47:24Z a user request update of AutoScalingGroup constraints to min: 1, max: 5, desired: 3 changing the desired capacity from 0 to 3. At 2021-01-13T20:47:27Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 3.", "StartTime": "2021-01-13T20:47:30.094Z", "EndTime": "2021-01-13T20:47:30Z", "StatusCode": "Failed", "StatusMessage": "Your Spot request price of 0.001 is lower than the minimum required Spot request fulfillment price of 0.0031. Launching EC2 instance failed.", "Progress": 100, "Details": "{\"Subnet ID\":\"subnet-5ea0c127\",\"Availability Zone\":\"us-west-2b\"...}", "AutoScalingGroupState": "Deleted", "AutoScalingGroupARN": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:283179a2-f3ce-423d-93f6-66bb518232f7:autoScalingGroupName/my-asg" }, ... ] }

關閉縮放活動

如果您需要在不受擴展政策或排程動作干擾的情況下調查問題,您可以使用下列選項:

  • 透過暫停和程序,防止所有動態擴展政策和排程動作對群組的所需容量ScheduledActionsAlarmNotification行變更。如需詳細資訊,請參閱 暫停和恢復 Amazon EC2 Auto Scaling 程序

  • 停用個別動態擴展政策,這樣它們就不會因負載變更而變更群組所需的容量。如需詳細資訊,請參閱 停用 Auto Scaling 群組的擴展政策

  • 透過停用原則的擴充部分,將個別目標追蹤擴展政策更新為僅向外擴充 (增加容量)。此方法可防止群組所需的容量縮小,但可在負載增加時增加。如需詳細資訊,請參閱 Amazon EC2 Auto Scaling 的目標追蹤擴展政策

  • 將您的預測性擴展政策更新為僅預測模式。在僅預測模式下,預測性縮放將繼續產生預測,但不會自動增加容量。如需詳細資訊,請參閱 建立預測性擴展政策

其他疑難排解資源

以下頁面提供針對 Amazon EC2 Auto Scaling 問題進行疑難排解的其他資訊。

以下 AWS 資源也可能有所幫助:

疑難排解通常需要專家或小幫手社群的反覆查詢和探索。如果您在嘗試本節中的建議後仍然遇到問題,請聯絡 AWS Support (在按一下支援 AWS Management Console、支 Support 中心中),或使用 Amazon EC2 Auto Scaling 標籤在 AWS Re: POST 上提出問題。