Creating custom CloudWatch metrics and alarms in AMS - AMS Advanced User Guide

Creating custom CloudWatch metrics and alarms in AMS

You can store your business and application metrics in Amazon CloudWatch. You can view graphs, and set alarms based on these metrics, just as you can for the metrics that CloudWatch already stores for your AWS Managed Services (AMS) resources. To learn more about CloudWatch, see Amazon CloudWatch Concepts.

Amazon SNS allows applications to send time-critical messages to multiple subscribers through a "push" mechanism against the AMS Managed Monitoring System or MMS, Amazon SNS (SNS) topic that the alarms are published to; in this case, MMS and your SQS queues. You can use CloudWatch to create custom metrics and, through an SNS topic, have AMS alarm you appropriately. To do this, follow these steps.


This process doesn't work for immutable deployments that rely on updated AMIs deployed to Auto Scaling groups, it is suitable for mutable application (not ASG) deployments.

Setting up a custom metric within the limitations of AMS Advanced, is a complex task. For an example from CloudWatch, see Example: Count occurrences of a term.

  1. Produce your application monitoring script and custom metric (such as the count occurrences example). For more information and access to example scripts, see Monitoring Memory and Disk Metrics for Amazon EC2 Linux Instances. The Amazon CloudWatch Monitoring Scripts for Linux Amazon EC2 instances demonstrate how to produce and consume Amazon CloudWatch custom metrics. These sample Perl scripts comprise a fully functional example that reports memory, swap, and disk space utilization metrics for a Linux instance.

  2. Upload your monitoring script. To upload the monitoring script to your Auto Scaling group or Amazon EC2 instance configuration, you can use UserData when configuring your Auto Scaling group or Amazon EC2 instance, or, if your application was deployed with CodeDeploy, you can modify the configuration with a Deployment | Applications | CodeDeploy application | Deploy CT (ct-2edc3sd1sqmrb).

  3. Publish your custom metric to CloudWatch (the first time you publish a data point for a new custom metric, it is created), see Publish Custom Metrics.

  4. To integrate your customer metric to your application monitoring system, request AMS create an SNS topic for the metric by submitting an RFC with the Management | Other | Other | Create CT (ct-1e1xtak34nx76).

  5. Create the CloudWatch alarm, see Creating Amazon CloudWatch Alarms.


Monitoring data must be sent to this path [infra/INSTANCE_ID/YOUR_CUSTOM_METRIC].