Monitoring VPN tunnels using Amazon CloudWatch - AWS Site-to-Site VPN

Monitoring VPN tunnels using Amazon CloudWatch

You can monitor VPN tunnels using CloudWatch, which collects and processes raw data from the VPN service into readable, near real-time metrics. These statistics are recorded for a period of 15 months, so that you can access historical information and gain a better perspective on how your web application or service is performing. VPN metric data is automatically sent to CloudWatch as it becomes available.

Important

CloudWatch metrics are not supported for AWS Classic VPN connections. For more information, see Site-to-Site VPN categories.

For more information, see the Amazon CloudWatch User Guide.

VPN tunnel metrics and dimensions

The following metrics are available for your VPN tunnels.

Metric Description

TunnelState

The state of the tunnels. For static VPNs, 0 indicates DOWN and 1 indicates UP. For BGP VPNs, 1 indicates ESTABLISHED and 0 is used for all other states. For both types of VPNs, values between 0 and 1 indicate at least one tunnel is not UP.

Units: Fractional value between 0 and 1

TunnelDataIn

The bytes received on the AWS side of the connection through the VPN tunnel. Each metric data point represents the number of bytes received after the previous data point. Use the Sum statistic to show the total number of bytes received during the period.

This metric counts the data after decryption.

Units: Bytes

TunnelDataOut

The bytes sent from the AWS side of the connection through the VPN tunnel. Each metric data point represents the number of bytes sent after the previous data point. Use the Sum statistic to show the total number of bytes sent during the period.

This metric counts the data before encryption.

Units: Bytes

To filter the metric data, use the following dimensions.

Dimension Description

VpnId

Filters the metric data by the Site-to-Site VPN connection ID.

TunnelIpAddress

Filters the metric data by the IP address of the tunnel for the virtual private gateway.

Viewing VPN tunnel CloudWatch metrics

When you create a new Site-to-Site VPN connection, the VPN service sends the following metrics about your VPN tunnels to CloudWatch as it becomes available. You can view the metrics for VPN tunnels as follows.

To view metrics using the CloudWatch console

Metrics are grouped first by the service namespace, and then by the various dimension combinations within each namespace.

  1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. In the navigation pane, choose Metrics.

  3. Under All metrics, choose the VPN metric namespace.

  4. Select the metric dimension to view the metrics (for example, for the Site-to-Site VPN connection).

To view metrics using the AWS CLI

At a command prompt, use the following command:

aws cloudwatch list-metrics --namespace "AWS/VPN"

Creating CloudWatch alarms to monitor VPN tunnels

You can create a CloudWatch alarm that sends an Amazon SNS message when the alarm changes state. An alarm watches a single metric over a time period you specify, and sends a notification to an Amazon SNS topic based on the value of the metric relative to a given threshold over a number of time periods.

For example, you can create an alarm that monitors the state of a VPN tunnel and sends a notification when the tunnel state is DOWN for 3 datapoints within 15 minutes.

To create an alarm for tunnel state

  1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. In the navigation pane, choose Alarms, Create alarm.

  3. Choose Select metric.

  4. Choose VPN, then choose VPN Tunnel Metrics.

  5. Choose the IP address of the VPN tunnel and the TunnelState metric. Choose Select metric.

  6. Choose Next.

  7. Do one of the following, and then under Additional configuration, enter 3 for the datapoints to alarm. Choose Next.

    • To monitor when both tunnels are down, for Whenever, choose Lower/Equal (<=) , and then enter 0.5.

    • To monitor the DOWN state for either tunnel, for Whenever, choose Lower (<), and then enter 1.

  8. Under Select an SNS topic, select an existing notification list or create a new one. Choose Next.

  9. Enter a name and description for your alarm. Choose Next.

  10. Check the settings for your alarm, and then choose Create alarm.

You can create an alarm that monitors the state of the Site-to-Site VPN connection. For example, you can create an alarm that sends a notification when the status of one or both tunnels is DOWN for one 5-minute period.

To create an alarm for Site-to-Site VPN connection state

  1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. In the navigation pane, choose Alarms, Create alarm.

  3. Choose Select metric.

  4. Choose VPN, then choose VPN Connection Metrics.

  5. Select your Site-to-Site VPN connection and the TunnelState metric. Choose Select metric.

  6. For Statistic, specify Maximum.

    Alternatively, if you've configured your Site-to-Site VPN connection so that both tunnels are up, you can specify a statistic of Minimum to send a notification when at least one tunnel is down.

  7. For Whenever, choose Lower/Equal (<=) and enter 0 (or 0.5 for when at least one tunnel is down). Choose Next.

  8. Under Select an SNS topic, select an existing notification list or choose New list to create a new one. Choose Next.

  9. Enter a name and description for your alarm. Choose Next.

  10. Check the settings for your alarm, and then choose Create alarm.

You can also create alarms that monitor the amount of traffic coming in or leaving the VPN tunnel. For example, the following alarm monitors the amount of traffic coming into the VPN tunnel from your network, and sends a notification when the number of bytes reaches a threshold of 5,000,000 during a 15 minute period.

To create an alarm for incoming network traffic

  1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. In the navigation pane, choose Alarms, Create alarm.

  3. Choose Select metric.

  4. Choose VPN, then choose VPN Tunnel Metrics.

  5. Select the IP address of the VPN tunnel and the TunnelDataIn metric. Choose Select metric.

  6. For Statistic, specify Sum.

  7. For Period, select 15 minutes.

  8. For Whenever, choose Greater/Equal(>=) and enter 5000000. Choose Next.

  9. Under Select an SNS topic, select an existing notification list or choose New list to create a new one. Choose Next.

  10. Enter a name and description for your alarm. Choose Next.

  11. Check the settings for your alarm, and then choose Create alarm.

The following alarm monitors the amount of traffic leaving the VPN tunnel to your network, and sends a notification when the number of bytes is less than 1,000,000 during a 15 minute period.

To create an alarm for outgoing network traffic

  1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. In the navigation pane, choose Alarms, Create alarm.

  3. Choose Select metric.

  4. Choose VPN, then choose VPN Tunnel Metrics.

  5. Select the IP address of the VPN tunnel and the TunnelDataOut metric. Choose Select metric.

  6. For Statistic, specify Sum.

  7. For Period, select 15 minutes.

  8. For Whenever, choose Lower/Equal (<=) and enter 1000000. Choose Next.

  9. Under Select an SNS topic, select an existing notification list or choose New list to create a new one. Choose Next.

  10. Enter a name and description for your alarm. Choose Next.

  11. Check the settings for your alarm, and then choose Create alarm.

For more examples of creating alarms, see Creating Amazon CloudWatch alarms in the Amazon CloudWatch User Guide.