Setting Up Our Project

Learn how to set up the project and infrastructure with a dummy Lambda.


The idea of this chapter is to create an application that monitors the metrics of a single Lambda. Monitoring multiple Lambdas, or perhaps all our AWS resources, would be much more useful. But we have to limit the scope of our project. So instead, we’ll suggest ways to expand the reach of this application at the end of the chapter. The source of our metrics will be Cloudwatch, which is the logging and metrics service of AWS. Lambdas automatically send logs and metric info there.

First, we’ll set up the project and infrastructure with a dummy Lambda. Next, we’ll write functional code that retrieves metric information from Cloudwatch regarding Invocations (how many times was the Lambda function called?), Errors (how many errors did it produce?), and Throttles (we can be throttled by AWS when we run into certain limits). Depending on the information we retrieve, we’ll return status with values ok, warning, or error, and add a string with some additional information.

To make things easier, we’ll monitor the function we’re creating. Pretty useless, sure, but it also means that readers don’t have to set up some mock Lambda in their account if they don’t have one running yet.

Setting up our environment

We’ll start by setting up our environment and infrastructure before writing our actual functional code.

Get hands-on with 1200+ tech skills courses.