How do I calculate throughput and set a CloudWatch alarm for Transit Gateway?

3 minute read

I have an AWS Transit Gateway attachment. I want to use Amazon CloudWatch metrics to calculate throughput, and set up a throughput-based notification.

Short description

Use CloudWatch metrics to calculate throughput for a Transit Gateway attachment. To create an alert for when throughput exceeds your specified values, create a CloudWatch alarm with an Amazon Simple Notification Service (Amazon SNS) notification.

Important: Throughput calculation is approximate and doesn't provide exact up-to-the-moment bandwidth usage. A CloudWatch metrics alarm is effective for connections that exceed throughput for a duration of 15 minutes or more.


The following steps calculate throughput on a Transit Gateway attachment. You can use a similar calculation on different types of attachments:

  1. Open the CloudWatch console, and then choose the AWS Region that's associated with your transit gateway.
  2. In the navigation pane, choose Metrics. Then, choose All metrics.
  3. Under All Metrics, choose TransitGateway. Then, choose Per-TransitGatewayAttachmentMetrics.
  4. Select the BytesIn and BytesOut metrics for the Transit Gateway attachment that you want to measure.
  5. Choose the Graphed metrics tab, and then set the following parameters:
    Statistics: SUM
    Period: 5 minutes
  6. Choose Add Math.
  7. From the dropdown list, choose Start with an empty expression, and then in the math expression box enter (m1+m2)*8/300.
    This formula converts bytes per second (Bps) to bits per second (bps) to calculate the output. The variables represent the following values:
    m1 = BytesIn 
    m2 = BytesOut 
  8. Choose Apply.
  9. In the graphed metrics section, you see the expression that you added and the metrics in the expression. To see the representation in the graph section, select only the expression that you added: (m1+m2)*8/300. The output is in bits per second.
    Note: Clear m1 and m2 so that you select only the math expression.
  10. Create a CloudWatch alarm based on a metric math expression. When you create the alarm, set the following values:
    For Select metric, enter the expression that you created in step 7. Select only this expression.
    In the Conditions section, set the throughput value that you want to monitor as a condition. For example, to be notified when throughput reaches 100 Mbps, enter Greater/Equal(>=) 1,000,000,00.
    In the Additional configuration section, set Datapoints to alarm to 3 out of 3.
  11. (Optional) Set up Amazon SNS notifications for the CloudWatch alarm.

Related information

Transit Gateway metrics