Search⌘ K
AI Features

Adding Deployment Alerts

Explore how to add automated deployment alerts for AWS Lambda using CloudWatch. Learn to set alarms for error detection, monitor function metrics, and automate rollback with CodeDeploy to improve deployment safety and reliability.

We'll cover the following...

CloudWatch

So far, you haven’t set up any tests to compare the old and new versions. You could manually try things out during the deployment and then roll back in case of problems from the CodeDeploy Web Console, but that’s not really efficient or sustainable. It would be better if CodeDeploy did this automatically.

Luckily, CloudWatch can look out for errors automatically. You used CloudWatch to access logs in the previous chapter, but you can also use it to inspect and monitor operational statistics about your application. CloudWatch automatically tracks lots of interesting information about AWS Lambda and API Gateway, such as latency, number of invocations, and number of errors. Here is how you can see this information:

  1. Go to the AWS Web Console, https://aws.amazon.com, and sign in if necessary.
  2. Select CloudWatch in the list of services.
  3. Select All metrics under the Metrics section in the left-hand menu.
  4. In the list of metric namespaces, select Lambda then By Function name, and select check boxes next to errors and invocations for your function.
CloudWatch automatically tracks useful operational metrics for Lambda functions and API Gateway resources
CloudWatch automatically tracks useful operational metrics for Lambda functions and API Gateway resources
...