AWS Logo
Menu
Monitor your Serverless Application with AWS CloudWatch

Monitor your Serverless Application with AWS CloudWatch

Monitoring serverless applications with AWS CloudWatch, covering key metrics and alarms for API Gateway, Lambda, DynamoDB, and SES services.

Published Mar 16, 2025

Introduction

Serverless applications have become increasingly popular due to their scalability and reduced operational overhead. However, monitoring these applications presents unique challenges compared to traditional server-based architectures.
This blog post will guide you through effectively monitoring a serverless application using AWS CloudWatch.

Problem

While serverless applications reduce operational complexity, they introduce new monitoring challenges. Unlike traditional applications where you have full control over the server environment, serverless architectures distribute responsibilities across multiple managed services. This distribution can make it harder to:
  • Track application performance across different services
  • Identify the root cause of errors
  • Monitor resource utilization and costs
  • Ensure reliable email delivery in serverless workflows

Serverless Architecture:

Serverless Application Architecture

Prerequisites

Before implementing monitoring for your serverless application, ensure you have:
  • An AWS account with appropriate IAM permissions
  • A deployed serverless application using API Gateway and Lambda
  • Basic understanding of CloudWatch metrics and alarms
  • Access to AWS services like DynamoDB, S3, and SES (if using them)

Solution

The key monitoring metrics across different AWS Serverless services:
NamespaceMetric NameDescription
AWS/ApiGateway5XXErrorNumber of requests with status code 5XX (server-side error)
AWS/ApiGatewayLatencyTime between incoming request and response on API Gateway
AWS/LambdaErrorsNumber of failed function invocations
AWS/LambdaThrottlesNumber of throttled function invocations
AWS/DynamoDBReadThrottleEventsNumber of throttled read requests
AWS/DynamoDBWriteThrottleEventsNumber of throttled read requests
AWS/DynamoDBSystemErrorsNumber of server-side errors
AWS/SESReputation.BounceRatePercentage of bounced messages (multiply by 100)
AWS/SESReputation.ComplaintRatePercentage of messages reported as spam (multiply by 100)

AWS Lambda

Lambda automatically tracks utilization and performance metrics for your functions. Monitoring this data can help you optimize your functions and manage costs.
NameMetric typeAvailabilityDescription
DurationWork: PerformanceCloudWatch & LogsThe elapsed time for a function’s execution, in milliseconds
Billed durationWork: PerformanceLogsExecution time billed in 1 ms increments, rounded up to the nearest millisecond
Memory sizeResource: UtilizationLogsThe amount of memory that is allocated to a function, in megabytes
Max memory usedResource: UtilizationLogsThe maximum amount of memory used for an invocation, in megabytes
ErrorsWork: ErrorCloudWatchThe number of failed invocations due to function errors

API Gateway Monitoring

Critical metrics to monitor:
  • 5XX Error Rate: Set up alarms for server-side errors with a threshold of >1 over 5 periods of 60 seconds
  • Latency: Monitor request-response times with p90/p95 thresholds at 500ms

Supporting Services Monitoring

While these don't require direct alarms, include them in your CloudWatch dashboard:
  • Lambda: Track errors and throttles
  • DynamoDB: Monitor read/write throttles and system errors

Email Service (SES) Monitoring

Set up specific alarms for:
  • Bounce Rate: Alert when exceeding 5% (0.05) over 15-minute periods
  • Complaint Rate: Monitor spam complaints with the same threshold

DynamoDB Monitoring

Critical metrics to monitor:
  • Read/Write Throttle Events: Set up alarms when throttling occurs as it indicates capacity issues
  • System Errors: Monitor for server-side errors that could impact database operations
Additional important metrics to track on your CloudWatch dashboard:
  • Consumed Read/Write Capacity Units (RCU/WCU)
  • Successful Request Latency
  • Error rates and types

Conclusion

The effective monitoring of serverless applications requires a different approach compared to traditional architectures. By focusing on key metrics at the API Gateway level and supplementing with service-specific monitoring, you can maintain high reliability and performance. The monitoring setup described above provides a robust foundation for maintaining the health of your serverless application.
💡Note:
Remember to regularly review and adjust your monitoring thresholds based on real-world usage patterns and requirements.
 

Comments