Skip to main content
Welcome to this lesson on publishing custom metrics to Amazon CloudWatch. CloudWatch includes many built-in metrics for AWS services, but when you need to monitor application-specific events or measurements you can publish custom metrics and then graph them, add them to dashboards, or create alarms. In this guide you’ll publish a simple custom metric using CloudShell (AWS CLI) and verify it appears in the CloudWatch console.
Choose a clear, consistent namespace for your custom metrics. Namespace names must be unique to your application, are case-sensitive, and must not begin with AWS/. Example: MyApplication.

Prerequisites

  • An AWS account with permissions to publish CloudWatch metrics (IAM policies that allow cloudwatch:PutMetricData).
  • Access to CloudShell or another shell with the AWS CLI configured.

Step 1 — Publish a metric from CloudShell (AWS CLI)

Open CloudShell from the AWS Console and wait until the shell is ready. Use the aws cloudwatch put-metric-data command to send a single data point. Minimal example — publish one data point:
CLI parameter overview Use dimensions to add metadata that helps break down metrics by region, service, environment, etc. Example with a single dimension:
Note: On success, the CLI typically returns to the shell prompt with no JSON output.

Step 2 — Verify the metric in the CloudWatch console

  1. Open the CloudWatch console.
  2. Navigate to Metrics → All metrics.
  3. Select the MyApplication namespace.
  4. Find the OrdersProcessed metric and open it to view or graph the data point you published.
Metrics may take a minute or two to become visible. If you don’t see the point immediately, expand the time range to include when you sent the metric. You can now:
  • Add this metric to dashboards,
  • Create alarms based on the metric,
  • Use it in composite or math expressions.
A screenshot of the AWS CloudWatch Metrics console showing an untitled, empty graph and time-range controls. The metric list shows "OrdersProcessed" with no alarms and buttons for adding queries, math, and graphing.
That’s it — publishing custom metrics lets CloudWatch capture application-specific measurements that built-in metrics don’t cover.

Watch Video