

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

# 設定應用程式以進行監控的先決條件
<a name="appinsights-prereqs"></a>

您必須完成以下事前準備，使用 CloudWatch Application Insights 設定應用程式：
+ **AWS Systems Manager enablement** – 在 Amazon EC2 執行個體上安裝 Systems Manager Agent (SSM Agent)，並為 SSM 啟用執行個體。如需有關如何安裝 SSM Agent 的資訊，請參閱*《AWS Systems Manager 使用者指南》*中的[設定 AWS Systems Manager](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-setting-up.html)。
+ **EC2 執行個體角色** — 您必須連接下列 Amazon EC2 執行個體角色才能啟用 Systems Manager
  + 您必須連接 `AmazonSSMManagedInstanceCore` 角色，以啟用 Systems Manager。如需詳細資訊，請參閱 [AWS Systems Manager 以身分為基礎的政策範例](https://docs.aws.amazon.com/systems-manager/latest/userguide/auth-and-access-control-iam-identity-based-access-control.html)。
  + 您必須連接 `CloudWatchAgentServerPolicy` 政策，以便透過 CloudWatch 發出執行個體指標和日誌。如需詳細資訊，請參閱[《建立 IAM 角色和使用者以使用 CloudWatch 代理程式》](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/create-iam-roles-for-cloudwatch-agent.html)。
+ **AWS 資源群組** – 若要將應用程式加入 CloudWatch Application Insights，請建立資源群組，其中包含應用程式堆疊所使用的所有相關 AWS 資源。這包括 Application Load Balancer、執行 IIS 和網路前端的 Amazon EC2 執行個體、.NET 工作者層和 SQL Server 資料庫。如需有關 Application Insights 支援的應用程式元件和技術堆疊的詳細資訊，請參閱 [支援的應用程式元件](appinsights-what-is.md#appinsights-components)。CloudWatch Application Insights 會自動納入和您資源群組使用相同標籤或 CloudFormation 堆疊的 Auto Scaling 群組，因為 CloudFormation 資源群組不支援 Auto Scaling 群組。如需詳細資訊，請參閱[《 AWS Resource Groups 入門》](https://docs.aws.amazon.com/ARG/latest/userguide/gettingstarted.html)。
+ **IAM 許可** – 對於沒有管理存取權的使用者，您必須建立允許 Application Insights 建立服務連結角色並將其連接到使用者身分的 AWS Identity and Access Management (IAM) 政策。如需有關如何建立 IAM 政策的詳細資訊，請參閱 [CloudWatch Application Insights 的 IAM 政策](appinsights-iam.md)。
+ **服務連結角色** – Application Insights 使用 AWS Identity and Access Management (IAM) 服務連結角色。系統會在您於 Application Insights 主控台建立第一個 Application Insights 應用程式時，為您建立服務連結角色。如需詳細資訊，請參閱[針對 CloudWatch Application Insights 使用服務連結角色](CHAP_using-service-linked-roles-appinsights.md)。
+ **效能計數器指標支援 EC2 Windows 執行個體** — 若要監控 Amazon EC2 Windows 執行個體上的效能計數器指標，執行個體上必須安裝效能計數器。如需效能計數器指標和對應的效能計數器集名稱，請參閱[效能計數器指標](application-insights-performance-counter.md)。如需效能計數器的詳細資訊，請參閱[效能計數器](https://docs.microsoft.com/en-us/windows/win32/perfctrs/performance-counters-portal)。
+ **Amazon CloudWatch 代理程式** — Application Insights 會安裝並設定 CloudWatch 代理程式。若您已安裝 CloudWatch 代理程式，Application Insights 會保留您的組態。若要避免合併衝突，請從現有的 CloudWatch 代理程式組態檔案中移除您要在 Application Insights 中使用的資源組態。如需詳細資訊，請參閱[手動建立或編輯 CloudWatch 代理程式組態檔案](CloudWatch-Agent-Configuration-File-Details.md)。