

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

# 疑難排解
<a name="troubleshooting"></a>

已知問題解決提供減輕已知錯誤的指示。如果這些指示無法解決您的問題，請參閱[聯絡 AWS Support](contact-aws-support.md) 一節，以取得為此解決方案開啟 AWS Support 案例的說明。

## 已知問題解決方案
<a name="known-issue-resolution"></a>

在 AWS 上部署工作負載探索期間以及在部署後階段，可能會發生幾個常見的組態錯誤：

**注意**  
為了協助您更輕鬆地進行故障診斷，建議您在 AWS CloudFormation 範本中停用轉返失敗功能。您也可以在 AWS [部署後工作負載探索組態文件中](https://aws-solutions.github.io/workload-discovery-on-aws/workload-discovery-on-aws/2.0/index.html)找到其他故障診斷說明。

### Config 交付管道錯誤
<a name="config-delivery-channel-error"></a>

 **問題：**部署主要 AWS CloudFormation 範本時發生下列錯誤：

```
Failed to put delivery channel '<stack-name>-DiscoveryImport-<ID-string>-DeliveryChannel-<ID-string>' because the maximum number of delivery channels: 1 is reached. (Service: AmazonConfig; Status Code: 400; Error Code: MaxNumberOfDeliveryChannelsExceededException; Request ID: 4edc54bc-8c85-4925-b99d-7ef9c73215b3; Proxy: null)
```

 **原因：**解決方案正在部署到已啟用 AWS Config 的區域。

 **解決方案：**遵循[先決條件一節](https://docs.aws.amazon.com/solutions/latest/workload-discovery-on-aws/prerequisites.html#verify-your-aws-config-details-in-your-account)中的指示，並將 CloudFormation 參數 **AlreadyHaveConfigSetup** 設定為 來部署解決方案`Yes`。

### 將部署至現有 VPC 時搜尋解析程式堆疊部署逾時
<a name="search-resolver-stack-deployment-times-out-when-deploying-to-existing-vpc"></a>

 **問題：**佈建自訂資源以在 OpenSearch 叢集中建立索引的巢狀堆疊逾時，並顯示下列錯誤：

```
Embedded stack arn:aws:cloudformation:<region>::stack/<stack-name>-SearchResolversStack-<ID-string>/<guid> was not successfullycreated: Stack creation time exceeded the specified timeout
```

 **原因：**以 CloudFormation 參數提供的私有子網路無法路由至 S3 （自訂資源必須使用預先簽章的 URL 將執行結果寫入 S3 儲存貯體）。這通常有兩個原因：

1. 私有子網路沒有與其相關聯的 NAT 閘道，因此無法存取網際網路。

1. 私有子網路使用 VPC 端點而非 NAT 閘道，而且 S3 閘道端點未正確設定。

 **解決方法：**

1. 在 VPC 中佈建 NAT 閘道，以允許在私有子網路中執行的任務存取網際網路，可根據[文件](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html#nat-gateway-api-cli)使用 CloudFormation 或 AWS CLI。

1. 確定子網路的路由表已根據[文件](https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html#create-gateway-endpoint-s3)更新 S3 VPC 端點。

### 匯入帳戶後未發現的資源
<a name="resources-not-discovered-after-account-has-been-imported"></a>

 **問題：**帳戶已透過 Web UI 匯入，但在探索程序執行後似乎沒有發現任何資源。

 **原因：**最可能的原因如下：

1. 當 **CrossAccountDiscovery** CloudFormation 參數設定為 時`SELF_MANAGED`，尚未部署全域資源 CloudFormation 範本。

1. 當 **CrossAccountDiscovery** CloudFormation 參數設定為 時`AWS_ORGANIZATIONS`：未探索一或多個帳戶，且**角色狀態**欄具有**未部署**的項目。這表示使用 StackSets 自動部署全域資源範本時發生問題。

1. 探索程序 ECS 任務記憶體不足。匯入大量帳戶或資源時會發生這種情況。UI 中的**上次探索**欄的值會大於 **DiscoveryTaskFrequency** CloudFormation 參數中指定的值 （預設值為 15 分鐘），而且 ECS 主控台中會出現記憶體不足錯誤。

 **解決方法：**

1. 根據[文件](https://docs.aws.amazon.com/solutions/latest/workload-discovery-on-aws/import-a-region.html#deploy-the-aws-cloudformation-templates)，在所需帳戶中部署全域資源範本。

1. 前往已部署工作負載探索之區域中的 **WdGlobalResources** StackSet，並檢查已部署失敗之堆疊執行個體中的錯誤。

1. 將 **Memory** CloudFormation 參數更新為較大的值：從雙數開始，並持續增加直到錯誤停止為止。

**注意**  
只有特定 CPU 單位和記憶體值組合有效，因此您可能也必須更新 **CpuUnits** CloudFormation 參數。組合的完整清單會列在 [ECS 文件中](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-cpu-memory-error.html)。

### 在特定帳戶中僅探索非 AWS Config 資源
<a name="only-non-aws-config-resources-are-being-discovered-in-specific-accounts"></a>

 **問題：**解決方案探索的唯一資源類型是支援資源區段中 資料表中[列出的類型](https://docs.aws.amazon.com/solutions/latest/workload-discovery-on-aws/supported-resources-1.html)。

 **原因：**此問題最常見的原因是，

1. 當 **CrossAccountDiscovery** CloudFormation 參數設定為 時`SELF_MANAGED`，CloudFormation 範本尚未部署在每個要探索之帳戶的區域中。

1. 當 **CrossAccountDiscovery** CloudFormation 參數設定為 時`SELF_MANAGED`，CloudFormation 範本已部署在許多未啟用 Config 但 CloudFormation 參數 **AlreadyHaveConfigSetup** 錯誤設定為 的帳戶區域中`Yes`。

1. 當 **CrossAccountDiscovery** CloudFormation 參數設定為 時`AWS_ORGANIZATIONS`，不會在每個要探索的帳戶區域中啟用 AWS Config。在 `AWS_ORGANIZATIONS`模式下，您有責任根據組織的政策啟用 Config。

 **解決方法：**

1. 根據[文件](https://docs.aws.amazon.com/solutions/latest/workload-discovery-on-aws/import-a-region.html#deploy-the-aws-cloudformation-templates)，在所需帳戶中部署區域資源範本。

1. 刪除先前部署的區域資源堆疊 （否則 AWS Config 將處於不一致狀態），並使用設定為 的 CloudFormation 參數**AlreadyHaveConfigSetup**部署`No`。

1. 在要探索的每個帳戶區域中啟用 AWS Config。