In a previous post we discussed how to auto-subscribe a CloudWatch Log Group to a Lambda function using CloudWatch Events. So that we don’t need a manual process to ensure all Lambda logs would go to our log aggregation service.
Whilst this is useful in its own right, it only scratches the surface of what we can do. CloudTrail and CloudWatch Events makes it easy to automate many day-to-day operational steps. With the help of Lambda of course ;-)
You can take this further, and have other Lambda functions to:
create CloudWatch Alarms for 5xx errors for each endpoint
create CloudWatch Dashboard for the API
So there you have it, a useful pattern for automating away manual ops tasks!
And before you even have to ask, yes I’m aware of this serverless plugin by the ACloudGuru folks. It looks neat, but it’s ultimately still something the developer has to remember to do. That requires discipline. My experience tells me that you cannot rely on discipline, ever. Which is why, I prefer to have a platform in place that will generate these alarms automatically.
Like what you’re reading? Check out my video course Production-Ready Serverlessand learn the essentials of how to run a serverless application in production.
We will cover topics including:
authentication & authorization with API Gateway & Cognito
testing & running functions locally
monitoring best practices
distributed tracing with X-Ray
tracking correlation IDs
performance & cost optimization
leading practices for Lambda, Kinesis, and API Gateway
You can also get 40% off the face price with the code ytcui. Hurry though, this discount is only available while we’re in Manning’s Early Access Program (MEAP).
The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.