本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
AWSSupport-TroubleshootELBHealthChecks
Description
AWSSupport-TroubleshootELBHealthChecks Runbook 透過分析其相關的 Amazon CloudWatch (CloudWatch) 指標、驗證網路連線,以及在目標執行個體上執行診斷命令,協助疑難排解 AWS Elastic Load Balancing (Elastic Load Balancing) 運作狀態檢查問題。
此 Runbook 處理下列使用案例:
負載平衡器或目標群組的目標執行個體中有運作狀態不佳的執行個體。
雖然沒有運作狀態不佳的執行個體,但 CloudWatch 指標會指出 的資料點
UnHealthyHostCounts
重要
重要考量:
自動化著重於疑難排解執行個體類型目標。
允許故障診斷的執行個體數目上限為 50 個。
目標執行個體必須由 Systems Manager 管理,才能在執行個體層級執行診斷命令。
S3BucketName參數為選用,但特定診斷結果會直接上傳至指定的 Amazon S3 儲存貯體,且不會顯示在自動化輸出中。不支援 IPv6 網路連線故障診斷。
文件類型
自動化
擁有者
Amazon
平台
/
必要的 IAM 許可
AutomationAssumeRole 參數需要下列動作才能成功使用 Runbook。
elasticloadbalancing:DescribeLoadBalancerselasticloadbalancing:DescribeTargetGroupselasticloadbalancing:DescribeTargetHealthelasticloadbalancing:DescribeInstanceHealthec2:DescribeInstancesec2:DescribeNetworkInterfacesec2:DescribeSecurityGroupsec2:DescribeSubnetscloudwatch:GetMetricStatisticsssm:SendCommandssm:GetCommandInvocationssm:DescribeInstanceInformations3:GetBucketLocations3:GetBucketAcls3:PutObject
範例政策:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticloadbalancing:DescribeLoadBalancers", "elasticloadbalancing:DescribeTargetGroups", "elasticloadbalancing:DescribeTargetHealth", "elasticloadbalancing:DescribeInstanceHealth", "ec2:DescribeInstances", "ec2:DescribeNetworkInterfaces", "ec2:DescribeSecurityGroups", "ec2:DescribeSubnets", "cloudwatch:GetMetricStatistics", "ssm:SendCommand", "ssm:GetCommandInvocation", "ssm:DescribeInstanceInformation", "s3:GetBucketLocation", "s3:GetBucketAcl", "s3:PutObject" ], "Resource": "*" } ] }
指示
請依照下列步驟設定自動化:
-
在文件下的 Systems Manager
AWSSupport-TroubleshootELBHealthChecks中導覽至 。 -
選擇 Execute automation (執行自動化)。
-
針對輸入參數,輸入下列內容:
-
AutomationAssumeRole (選用):
-
描述:(選用) 允許 SSM Automation 代表您執行動作的 (IAM) 角色的 AWS Identity and Access Management Amazon Resource Name (ARN)。如果未指定角色,SSM Automation 會使用啟動此 Runbook 之使用者的許可。
-
類型:
AWS::IAM::Role::Arn
-
-
LoadBalancerOrTargetGroupName (必要):
描述:(必要) Classic Load Balancer 的名稱,或與 Application Load Balancer 或 Network Load Balancer 相關聯的目標群組名稱。
類型:
String-
允許模式:
^[a-zA-Z0-9-]+$
-
ExecutionMode (必要):
描述:(必要) 控制自動化執行模式。
Complete會在 Amazon EC2 執行個體上執行所有步驟,包括 runCommands。SkipRunCommands會在執行個體上執行命令以外的所有步驟。類型:
String-
允許的值:
[Complete, SkipRunCommands]
-
S3BucketName (選用):
描述:(選用) 帳戶中您要上傳故障診斷日誌的 Amazon S3 儲存貯體名稱。
類型:
String-
預設:
""
-
-
選取執行。
-
自動化會啟動。
-
文件會執行下列步驟:
-
getBucketPublicStatus:
檢查目標 Amazon S3 儲存貯體是否可能授予其物件的讀取或寫入公開存取權。
-
getLoadBalancerDetails:
識別負載平衡器類型,並傳回統一的負載平衡器詳細資訊物件。
-
checkLoadBalancerType:
檢查負載平衡器是否存在。
-
getTargets:
根據不同類型的負載平衡器,查詢會描述 APIs以傳回運作狀態良好和運作狀態不佳目標詳細資訊的映射。
-
checkCloudWatchMetrics:
檢查 CloudWatch 指標
HealthyHostCounts和UnHealthyHostCounts,並產生 CloudWatch 連結。 -
checkUnhealthyReasons:
檢查運作狀態不佳的原因並篩選目標。
-
checkConnectivity:
檢查負載平衡器與其執行個體之間的連線。
-
runCommands:
在執行個體上執行疑難排解命令,並在提供儲存貯體名稱時上傳輸出。
-
generateReport:
根據先前步驟的輸出產生最終報告,並在指定時將報告上傳至 Amazon S3 儲存貯體。
-
-
完成後,請檢閱輸出區段以取得執行的詳細結果。
診斷命令
Runbook 會在執行個體上執行下列診斷命令:
Linux Shell:top、free、ss、curl、iptables、tcpdump
Windows PowerShell:Get-CimInstance、Get-NetFirewallProfile、Get-NetFirewallRule、Invoke-WebRequest、netstat、netsh、pktmon
參考
Systems Manager Automation