Adding Deployment Alerts
So far, you haven’t set up any tests o 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:
- Go to the AWS Web Console, https://aws.amazon.com, and sign in if necessary.
- Select CloudWatch in the list of services.
- Select Metrics in the left-hand menu.
- In the list of metric namespaces, select Lambda then By Function name, and select check boxes next to errors and invocations for your function.