

# Amazon CloudWatch subscriptions for Infrastructure Performance
<a name="nmip-subscriptions-cw"></a>

Infrastructure Performance subscriptions publish network performance metrics in five-minute periods to Amazon CloudWatch for any pair of inter Regions, inter-Availability Zones, or intra-Availability Zones that you optionally subscribe to. Once a subscription is enabled, performance metrics continue to publish to CloudWatch for those pairs until you unsubscribe any pair that you no longer want to publish performance metrics for.

**Note**  
There's a separate CloudWatch metrics subscription charge for each inter-Region, inter-Availability Zone, or intra-Availability Zone pair you subscribe to. You won't be charged for any CloudWatch performance metrics that you unsubscribe from, or for any pair that you've not enabled subscriptions for. For more information about pricing guidelines, see [Amazon CloudWatch pricing](https://aws.amazon.com/cloudwatch/pricing/).

## Subscription metrics for CloudWatch
<a name="nmip-subscriptions-metrics"></a>

When subscriptions are enabled, you can use CloudWatch to view metrics. For more information on using CloudWatch for your Infrastructure Performance subscriptions, see [What is CloudWatch Management](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html) in the *Amazon CloudWatch User Guide*.

 The following `EC2` namespace metric for Infrastructure Performance is tracked in CloudWatch:


| Metric | Description | 
| --- | --- | 
| AggregateAWSNetworkPerformance |  The latency between Regions, inter-Availability Zones, or intra-Availability Zones.  | 

**Topics**
+ [Manage CloudWatch subscriptions using the AWS Network Manager console](nmip-subscriptions-manage.md)
+ [Manage CloudWatch subscriptions using the AWS CLI](getting-started-nmip-cli.md)

# Manage CloudWatch subscriptions using the AWS Network Manager console
<a name="nmip-subscriptions-manage"></a>

Subscriptions allow you to send and view Infrastructure Performance metrics in Amazon CloudWatch. Using the console you can either subscribe to, or unsubscribe from, CloudWatch performance metrics.

**To manage CloudWatch subscriptions**

1. Open the Amazon VPC console at [https://console.aws.amazon.com/vpc/](https://console.aws.amazon.com/vpc/).

1. In the navigation pane, choose **Network Manager**.

1. Under **Monitoring and troubleshooting**, choose **Infrastructure Performance**.

1. Choose the **Regions**, ** Inter-Availability Zone**, or **Intra-Availability Zone** that you want to manage subscriptions for. For detailed steps on how to choose them, see [Monitor Infrastructure Performance using the AWS Network Manager console](nmip-pairs.md).

1. Choose **Manage Subscriptions**.

1. From the **Update Subscriptions** drop-down list, choose whether you want to **Subscribe** or **Unsubscribe** the pair.

1. Choose **Confirm**.

# Manage CloudWatch subscriptions using the AWS CLI
<a name="getting-started-nmip-cli"></a>

Use the AWS CLI or APIs to get Infrastructure Performance metrics in AWS Network Manager and to enable or disable Amazon CloudWatch subscriptions. 

**Topics**
+ [DescribeAwsNetworkPerformanceMetricSubscriptions](#nmip-cli-DescribeAggregatedAwsNetworkPerformanceMetricSubscriptions)
+ [DisableAwsNetworkPerformanceMetricSubscription](#nmip-cli-DisableAggregatedAwsNetworkPerformanceMetricSubscription)
+ [EnableAwsNetworkPerformanceMetricSubscription](#nmip-cli-EnableNetworkPerformanceMetricSubscription)

## DescribeAwsNetworkPerformanceMetricSubscriptions
<a name="nmip-cli-DescribeAggregatedAwsNetworkPerformanceMetricSubscriptions"></a>

This provides details about any Infrastructure Performance metric subscriptions for Amazon CloudWatch. For more information, see [DescribeAwsNetworkPerformanceMetricSubscriptions](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeAwsNetworkPerformanceMetricSubscriptions.html).

In this example, a `filter` is used where:
+ The filter `Name` is `Source`.
+ The `Value` of the filter `Name` is `us-east-1`.

 In this example, CloudWatch subscriptions are being described for the Region `us-east-1`.

```
aws ec2  --region us-east-1 describe-aws-network-performance-metric-subscriptions --filters Name=Source,Values=us-east-1
```

The results describe the `us-east-1` subscriptions, including the following:
+  `Source` is the originating location of the subscription. In this example, the `Source` is the Region `us-east-1`.
+ `Destination` is the target location of the subscription. In this example, the `Destination` is the Region `us-east-2`.
+ `Metric` indicates what type of metric is being requested. In this example, `aggregate-latency`, indicates that the performance metrics are aggregated and returned for latency.
+  `Statistic` is the median value of the metric. In this example, `p50` is the statistic of all the data points gathered within those five minutes.
**Note**  
`p50` is the only supported statistic.
+ `Period` indicates the interval at which performance the `metric` is returned. In this example, `aggregated-latency` metrics are returned for every `five-minutes`.

```
{
    "Subscriptions": [
        {
            "Source": "us-east-1",
            "Destination": "us-east-2",
            "Metric": "aggregate-latency",
            "Statistic": "p50",
            "Period": "five-minutes"
        }
    ]
}
```

## DisableAwsNetworkPerformanceMetricSubscription
<a name="nmip-cli-DisableAggregatedAwsNetworkPerformanceMetricSubscription"></a>

This disables Amazon CloudWatch subscriptions for Infrastructure Performance. For more information, see [DisableAwsNetworkPerformanceMetricSubscription](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DisableAwsNetworkPerformanceMetricSubscription.html).

The following example disables subscriptions between a source Region, `us-east-1`, and a destination Region, `us-east-2`. In addition to the `source` and `destination` parameters, the request uses the following parameters:
+ `metric` indicates what type of metric is being requested. In this example, `aggregate-latency`, indicates that the performance metrics are aggregated and returned for latency.
+  `statistic` is the median value of the metric. In this example, `p50` is the statistic of all the data points gathered within those five minutes.
**Note**  
`p50` is the only supported statistic.

```
aws ec2 --region us-east-1 disable-aws-network-performance-metric-subscription --source us-east-1 --destination us-east-2 --metric aggregate-latency --statistic p50
```

The results return the following Boolean, `true`, indicating that the Amazon CloudWatch subscription between the two Regions was disabled. CloudWatch will no longer receive these metrics.

```
{
"Output": true
}
```

## EnableAwsNetworkPerformanceMetricSubscription
<a name="nmip-cli-EnableNetworkPerformanceMetricSubscription"></a>

This enables Amazon CloudWatch subscriptions for Infrastructure Performance. For more information, see [EnableAwsNetworkPerformanceMetricSubscription](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_EnableAwsNetworkPerformanceMetricSubscription.html).

In the following example, subscriptions are enabled between a source Region, `us-east-1`, and a destination Region, `us-east-2`. In addition to the `source` and `destination` parameters, the request also uses the following parameters:
+ `metric` indicates what type of metric is being requested. In this example, `aggregate-latency`, indicates that the performance metrics are aggregated and returned for latency.
+  `statistic` is the median value of the metric. In this example, `p50` is the statistic of all the data points gathered within those five minutes.
**Note**  
`p50` is the only supported statistic.

```
aws ec2 --region us-east-1 enable-aws-network-performance-metric-subscription --source us-east-1 --destination us-east-2 --metric aggregate-latency --statistic p50
```

The results return the following Boolean, `true`, indicating that an Amazon CloudWatch subscription as been enabled between the two Regions. CloudWatch will begin receiving metrics.

```
{
"Output": true
}
```