Throughout the book we have been talking about checking and monitoring your Lambda functions using CloudWatch. It's really not that difficult to set it up and once you have the base ready, you can reuse the same setup for monitoring almost all of your functions. So, let us quickly recap on how to monitor Lambda functions using CloudWatch!
To start off, we first need to prepare the base that we talked about. The base here is nothing more that the correct set of policies that allow your function to send its logs to CloudWatch. In most cases, your functions will require rights to create log groups and streams in CloudWatch, as well as to put log events into that particular stream. The log group creation, as well as the stream creation, is all taken care of by CloudWatch itself. Here is a simple IAM policy that will basically allow...