

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

# 的 CloudWatch 指標 AWS PrivateLink
<a name="privatelink-cloudwatch-metrics"></a>

AWS PrivateLink 會將介面端點、Gateway Load Balancer 端點和端點服務的資料點發佈至 Amazon CloudWatch。CloudWatch 可讓使用一組時間序列資料的形式來擷取這些資料點的相關統計資料，也就是*指標*。您可以將指標視為要監控的變數，且資料點是該變數在不同時間點的值。每個資料點都有相關聯的時間戳記和可選的測量單位。

您可以使用指標來確認系統的運作符合預期。例如，若指標超過您認為能夠接受的範圍，您可以建立 CloudWatch 警示來監控指定的指標並執行動作 (例如傳送通知到電子郵件地址)。

針對所有介面端點、Gateway Load Balancer 端點和端點服務發佈指標。它們不會針對閘道端點或使用跨區域存取的端點服務消費者發佈。根據預設， 會以一分鐘的間隔 AWS PrivateLink 將指標傳送至 CloudWatch，無需額外費用。

如需詳細資訊，請參閱 [Amazon CloudWatch 使用者指南](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/)。

**Topics**
+ [端點指標和維度](#endpoint-metrics-dimensions)
+ [端點服務指標和維度](#endpoint-service-metrics-dimensions)
+ [檢視 CloudWatch 指標](#view-privatelink-metrics)
+ [使用內建的 Contributor Insights 規則](#privatelink-contributor-insights)

## 端點指標和維度
<a name="endpoint-metrics-dimensions"></a>

`AWS/PrivateLinkEndpoints` 命名空間包含下列介面端點和 Gateway Load Balancer 端點的指標。


| 指標 | Description | 
| --- | --- | 
| ActiveConnections |  作用中並行連線的數目。這包含處於 SYN\$1SENT 與 ESTABLISHED 狀態的連線。 **報告條件**：端點在一分鐘內接收的流量。 **統計資訊**：最實用的統計資訊是 `Average`、`Maximum` 與 `Minimum`。 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/vpc/latest/privatelink/privatelink-cloudwatch-metrics.html)  | 
| BytesProcessed |  端點和端點服務之間交換的位元組數，在兩個方向上聚合。這是端點所有者需付費的位元組數。帳單會以 GB 為單位顯示此值。 **報告條件**：端點在一分鐘內接收的流量。 **統計資訊**：最實用的統計資訊是 `Average`、`Sum`、`Maximum` 和 `Minimum`。 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/vpc/latest/privatelink/privatelink-cloudwatch-metrics.html)  | 
| NewConnections |  透過端點建立的新連線數量。 **報告條件**：端點在一分鐘內接收的流量。 **統計資訊**：最實用的統計資訊是 `Average`、`Sum`、`Maximum` 和 `Minimum`。 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/vpc/latest/privatelink/privatelink-cloudwatch-metrics.html)  | 
| PacketsDropped |  端點捨棄的封包數量。此指標可能不會擷取所有封包捨棄。增加的值可能表示端點或端點服務運行狀況不佳。 **報告條件**：端點在一分鐘內接收的流量。 **統計資訊**：最實用的統計資訊是 `Average`、`Sum` 與 `Maximum`。 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/vpc/latest/privatelink/privatelink-cloudwatch-metrics.html)  | 
| RstPacketsReceived |  端點接收的 RST 封包數量。增加的值可能表示端點服務運行狀況不佳。 **報告條件**：端點在一分鐘內接收的流量。 **統計資訊**：最實用的統計資訊是 `Average`、`Sum` 與 `Maximum`。 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/vpc/latest/privatelink/privatelink-cloudwatch-metrics.html)  | 

若要篩選這些指標，請使用下列維度。


| 維度 | Description | 
| --- | --- | 
| Endpoint Type | 依端點類型篩選指標資料 (Interface \$1 GatewayLoadBalancer)。 | 
| Service Name | 依服務名稱篩選指標資料。 | 
| Subnet Id | 依子網路篩選指標資料。 | 
| VPC Endpoint Id | 依 VPC 端點篩選指標資料。 | 
| VPC Id | 依 VPC 篩選指標資料。 | 

## 端點服務指標和維度
<a name="endpoint-service-metrics-dimensions"></a>

`AWS/PrivateLinkServices` 命名空間包含端點服務的下列指標。


| 指標 | Description | 
| --- | --- | 
| ActiveConnections |  透過端點從用戶端到目標的作用中連線的最大數目。增加的值可能表示需要向負載均衡器新增目標。 **報告條件**：連線到端點服務的端點在一分鐘內傳送流量。 **統計資訊**：最實用的統計資訊是 `Average` 與 `Maximum`。 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/vpc/latest/privatelink/privatelink-cloudwatch-metrics.html)  | 
| BytesProcessed |  在兩個方向上，端點服務和端點之間交換的位元組數。 **報告條件**：連線到端點服務的端點在一分鐘內傳送流量。 **統計資訊**：最實用的統計資訊是 `Average`、`Sum` 與 `Maximum`。 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/vpc/latest/privatelink/privatelink-cloudwatch-metrics.html)  | 
| EndpointsCount |  連線到端點服務的端點數。 **報告條件**：五分鐘內有非零值。 **統計資訊**：最實用的統計資訊是 `Average` 與 `Maximum`。 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/vpc/latest/privatelink/privatelink-cloudwatch-metrics.html)  | 
| NewConnections |  透過端點從用戶端到目標所建立的新連線數目。增加的值可能表示需要向負載均衡器新增目標。 **報告條件**：連線到端點服務的端點在一分鐘內傳送流量。 **統計資訊**：最實用的統計資訊是 `Average`、`Sum` 與 `Maximum`。 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/vpc/latest/privatelink/privatelink-cloudwatch-metrics.html)  | 
| RstPacketsSent |  端點服務傳送到端點的 RST 封包數量。增加的值可能表示存在狀況不佳的目標。 **報告條件**：連線到端點服務的端點在一分鐘內傳送流量。 **統計資訊**：最實用的統計資訊是 `Average`、`Sum` 與 `Maximum`。 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/vpc/latest/privatelink/privatelink-cloudwatch-metrics.html)  | 

若要篩選這些指標，請使用下列維度。


| 維度 | Description | 
| --- | --- | 
| Az | 依可用區域篩選指標資料。 | 
| Load Balancer Arn | 依負載平衡器篩選指標資料。 | 
| Service Id | 依端點服務篩選指標資料。 | 
| VPC Endpoint Id | 依 VPC 端點篩選指標資料。 | 

## 檢視 CloudWatch 指標
<a name="view-privatelink-metrics"></a>

您可以使用 Amazon VPC 主控台、CloudWatch 主控台或 來檢視這些 CloudWatch 指標 AWS CLI ，如下所示。

**若要使用 Amazon VPC 主控台檢視指標**

1. 在 [https://console.aws.amazon.com/vpc/](https://console.aws.amazon.com/vpc/) 開啟 Amazon VPC 主控台。

1. 在導覽窗格中選擇 **Endpoints (端點)**。選取您的端點，然後選擇 **Monitoring** (監控) 標籤。

1. 在導覽窗格中，選擇 **Endpoints Services (端點服務)**。選取您的端點服務，然後選擇 **Monitoring** (監控) 標籤。

**使用 CloudWatch 主控台檢視指標**

1. 在 [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/) 開啟 CloudWatch 主控台。

1. 在導覽窗格中，選擇**指標**。

1. 選取 **AWS/PrivateLinkEndpoints** 命名空間。

1. 選取 **AWS/PrivateLinkServices** 命名空間。

**使用 檢視指標 AWS CLI**  
使用下列 [list-metrics](https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/list-metrics.html) 命令列出介面端點和 Gateway Load Balancer 端點的可用指標：

```
aws cloudwatch list-metrics --namespace AWS/PrivateLinkEndpoints
```

使用下列 [list-metrics](https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/list-metrics.html) 命令列出端點服務的可用指標：

```
aws cloudwatch list-metrics --namespace AWS/PrivateLinkServices
```

## 使用內建的 Contributor Insights 規則
<a name="privatelink-contributor-insights"></a>

AWS PrivateLink 為您的端點服務提供內建 Contributor Insights 規則，協助您尋找哪些端點是每個支援指標的最大貢獻者。如需更多資訊，請參閱*《Amazon CloudWatch 使用者指南》*中的 [Contributor Insights](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ContributorInsights.html)。

AWS PrivateLink 提供下列規則：
+ `VpcEndpointService-ActiveConnectionsByEndpointId-v1` – 按照作用中連線數目對端點分類。
+ `VpcEndpointService-BytesByEndpointId-v1` – 按照已處理的位元組數對端點分類。
+ `VpcEndpointService-NewConnectionsByEndpointId-v1` – 按照新連線數對端點分類。
+ `VpcEndpointService-RstPacketsByEndpointId-v1` – 按照傳送到端點的 RST 封包數量對端點分類。

您必須先啟用內建規則才能加以使用。啟用規則後，規則會開始收集參與者資料。如需 Contributor Insights 費用的資訊，請參閱 [Amazon CloudWatch 定價](https://aws.amazon.com/cloudwatch/pricing/)。

您必須擁有下列許可才能使用 Contributor Insights：
+ `cloudwatch:DeleteInsightRules` – 刪除 Contributor Insights 規則。
+ `cloudwatch:DisableInsightRules` – 停用 Contributor Insights 規則。
+ `cloudwatch:GetInsightRuleReport` – 取得資料。
+ `cloudwatch:ListManagedInsightRules` – 列出可用的 Contributor Insights 規則。
+ `cloudwatch:PutManagedInsightRules` – 啟用 Contributor Insights 規則。

**Topics**
+ [啟用 Contributor Insights 規則](#enable-contributor-insights)
+ [停用 Contributor Insights 規則](#disable-contributor-insights)
+ [刪除 Contributor Insights 規則](#delete-contributor-insights)

### 啟用 Contributor Insights 規則
<a name="enable-contributor-insights"></a>

使用下列程序來啟用 AWS PrivateLink 使用 AWS 管理主控台 或 的內建規則 AWS CLI。

**AWS PrivateLink 使用主控台啟用 Contributor Insights 規則**

1. 在 [https://console.aws.amazon.com/vpc/](https://console.aws.amazon.com/vpc/) 開啟 Amazon VPC 主控台。

1. 在導覽窗格中，選擇 **Endpoints Services (端點服務)**。

1. 選取您的端點服務。

1. 在 **Contributor Insights** 索引標籤上，選擇 **Enable (啟用)**。

1. (選用) 根據預設，所有規則都已啟用。若要僅啟用特定規則，請選取不應啟用的規則，然後選擇 **Actions (動作)**、**Disable rule (停用規則)**。出現確認提示時，請選擇 **Disable **(停用)。

**AWS PrivateLink 使用 啟用 Contributor Insights 規則 AWS CLI**

1. 使用如下列的 [list-managed-insight-rules](https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/list-managed-insight-rules.html) 命令可列舉可用的規則。對於 `--resource-arn` 選項，指定端點服務的 ARN。

   ```
   aws cloudwatch list-managed-insight-rules --resource-arn arn:aws:ec2:region:account-id:vpc-endpoint-service/vpc-svc-0123456789EXAMPLE
   ```

1. 在 `list-managed-insight-rules` 命令的輸出中，從 `TemplateName` 欄位複製範本的名稱。以下為此欄位的範例。

   ```
   "TemplateName": "VpcEndpointService-NewConnectionsByEndpointId-v1"
   ```

1. 使用如下列的 [put-managed-insight-rules](https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/put-managed-insight-rules.html) 命令可啟用規則。您必須指定端點服務的範本名稱和 ARN。

   ```
   aws cloudwatch put-managed-insight-rules --managed-rules TemplateName=VpcEndpointService-NewConnectionsByEndpointId-v1,ResourceARN=arn:aws:ec2:region:account-id:vpc-endpoint-service/vpc-svc-0123456789EXAMPLE
   ```

### 停用 Contributor Insights 規則
<a name="disable-contributor-insights"></a>

 AWS PrivateLink 您可以隨時停用 的內建規則。停用規則後，它會停止收集參與者資料，但現有的參與者資料會保留 15 天。停用規則後，您可以將它再次啟用，以繼續收集參與者資料。

**停用 AWS PrivateLink 使用主控台的 Contributor Insights 規則**

1. 在 [https://console.aws.amazon.com/vpc/](https://console.aws.amazon.com/vpc/) 開啟 Amazon VPC 主控台。

1. 在導覽窗格中，選擇 **Endpoints Services (端點服務)**。

1. 選取您的端點服務。

1. 在 **Contributor Insights** 索引標籤上，選擇 **Disable all (全部停用)**可停用所有規則。或者，也可以展開 **Rules (規則)** 面板，選取要停用的規則，然後選擇 **Actions (動作)**、**Disable rule (停用規則)**

1. 出現確認提示時，請選擇 **Disable **(停用)。

**停用 AWS PrivateLink 使用 的 Contributor Insights 規則 AWS CLI**  
使用 [disable-insight-rules](https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/disable-insight-rules.html) 命令可停用規則。

### 刪除 Contributor Insights 規則
<a name="delete-contributor-insights"></a>

使用下列程序來刪除 AWS PrivateLink 使用 AWS 管理主控台 或 的內建規則 AWS CLI。刪除規則後，規則將停止收集參與者資料，我們則會刪除現有的參與者資料。

**AWS PrivateLink 使用主控台刪除 Contributor Insights 規則**

1. 透過 [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/) 開啟 CloudWatch 主控台。

1. 在導覽窗格中，選擇 **Insights (洞察)**，然後選擇 **Contributor Insights**。

1. 展開 **Rules (規則)** 面板，然後選取規則。

1. 依序選擇 **Actions (動作)**、**Delete rules (刪除規則)**。

1. 出現確認提示時，請選擇**刪除**。

**AWS PrivateLink 使用 刪除 Contributor Insights 規則 AWS CLI**  
使用 [delete-insight-rules](https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/delete-insight-rules.html) 命令可刪除規則。