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
- CloudWatch Logs and Metrics
- Error Handling and Retries
- Debugging Serverless Applications
- Custom Metrics and CloudWatch Alarms