

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

# `AWSSupport-TroubleshootConnectivityToRDS`
<a name="automation-awssupport-troubleshootconnectivitytords"></a>

 **Description** 

 `AWSSupport-TroubleshootConnectivityToRDS` Runbook 會診斷 EC2 執行個體與 Amazon Relational Database Service 執行個體之間的連線問題。自動化會確認資料庫執行個體可用，然後會檢查關聯的安全群組規則、網路存取控制清單 (網路 ACL)，以及路由表來檢查是否有潛在的連線能力問題。

 [執行此自動化 （主控台）](https://console.aws.amazon.com/systems-manager/automation/execute/AWSSupport-TroubleshootConnectivityToRDS) 

**文件類型**

 自動化

**擁有者**

Amazon

**平台**

Linux、macOS、 Windows

**參數**
+ AutomationAssumeRole

  類型：字串

  描述：（選用） 允許 Systems Manager Automation 代表您執行動作的 (IAM) 角色的 AWS Identity and Access Management Amazon Resource Name (ARN)。如果未指定角色，Systems Manager Automation 會使用啟動此 Runbook 之使用者的許可。
+ DBInstanceIdentifier

  類型：字串

  描述：(必要) 要測試連線能力的目標資料庫執行個體 ID。
+ SourceInstance

  類型：字串

  允許的模式：^i-[a-z0-9]\$18,17\$1\$1

  描述：(必要) 要測試連線能力的來源 EC2 執行個體 ID。

**必要的 IAM 許可**

`AutomationAssumeRole` 參數需要下列動作才能成功使用 Runbook。
+  `ec2:DescribeInstances` 
+  `ec2:DescribeNetworkAcls` 
+  `ec2:DescribeRouteTables` 
+  `ec2:DescribeSecurityGroups` 
+  `ec2:DescribeSubnets` 
+  `rds:DescribeDBInstances` 

 **文件步驟** 
+  `aws:assertAwsResourceProperty` - 確認資料庫執行個體狀態為 `available` 。
+  `aws:executeAwsApi` - 取得資料庫執行個體的相關資訊。
+  `aws:executeAwsApi` - 取得資料庫執行個體網路 ACLs的相關資訊。
+  `aws:executeAwsApi` - 取得資料庫執行個體子網路 CIDR。
+  `aws:executeAwsApi` - 取得 EC2 執行個體的相關資訊。
+  `aws:executeAwsApi` - 取得 EC2 執行個體網路 ACLs的相關資訊。
+  `aws:executeAwsApi` - 取得與 EC2 執行個體相關聯之安全群組的相關資訊。
+  `aws:executeAwsApi` - 取得與資料庫執行個體相關聯之安全群組的相關資訊。
+  `aws:executeAwsApi` - 取得與 EC2 執行個體相關聯之路由表的相關資訊。
+  `aws:executeAwsApi` - 取得與 EC2 執行個體的 Amazon VPC 相關聯之主要路由表的相關資訊。
+  `aws:executeAwsApi` - 取得與資料庫執行個體相關聯之路由表的相關資訊。
+  `aws:executeAwsApi` - 取得與資料庫執行個體的 Amazon VPC 相關聯的主路由表相關資訊。
+  `aws:executeScript` - 評估安全群組規則。
+  `aws:executeScript` - 評估網路 ACLs。
+  `aws:executeScript` - 評估路由表。
+  `aws:sleep` - 結束自動化。

 **輸出** 

getRDSInstanceProperties.DBInstanceIdentifier - 自動化中使用的資料庫執行個體。

getRDSInstanceProperties.DBInstanceStatus ‒ 資料庫執行個體目前的狀態。

 evalSecurityGroupRules.SecurityGroupEvaluation ‒ 比較 `SourceInstance` 安全群組規則與資料庫執行個體安全群組規則的結果。

 evalNetworkAclRules.NetworkAclEvaluation ‒ 比較 `SourceInstance` 網路 ACL 與資料庫執行個體網路 ACL 的結果。

 evalRouteTableEntries.RouteTableEvaluation ‒ 比較 `SourceInstance` 路由表與資料庫執行個體路由的結果。