0Pricing
Serverless AWS Lambda Development · Lesson

Custom Metrics and CloudWatch Alarms

Learn to emit your own business and performance metrics from Lambda and to trigger alarms and notifications when thresholds are crossed.

Beyond Default Metrics

Lambda publishes built-in metrics like invocations and errors, but your app has its own signals, such as orders processed or items failed. These are custom metrics.

Embedded Metric Format

The easiest way to emit metrics is the Embedded Metric Format (EMF): print structured JSON to logs and CloudWatch extracts metrics automatically.

{
  "_aws": {
    "CloudWatchMetrics": [{
      "Namespace": "OrdersApp",
      "Metrics": [{"Name": "OrdersProcessed", "Unit": "Count"}]
    }]
  },
  "OrdersProcessed": 12
}

All lessons in this course

  1. CloudWatch Logs and Metrics
  2. Error Handling and Retries
  3. Debugging Serverless Applications
  4. Custom Metrics and CloudWatch Alarms
← Back to Serverless AWS Lambda Development