Lab 7 - Alerting

In this Lab we will:

  • Take a look at Cloudwatch Metrics
  • Create two alarms based on these metrics
  • Trigger an alert and see what happens

You completed this lab if you:

  • Created at least one Cloudwatch Alarm
  • Generated metrics in a way, that your alarms got triggered

Why is this important?

When using serverless components from AWS you leave big part of the heavy lifting to Amazon. This gives you the advantage of not having to worry about monitoring your servers anymore.

Despite that, there are still things that could go wrong:

  • You can deploy code that only errors under certain circumstances, not covered by your integration tests.
  • You can hit the memory limit of your function.
  • Your function can get throttled, because there is not enough reserved concurrency left.

Alerting with Cloudwatch Alarms

With Cloudwatch Alarms it is fairly easy to create alarms alongside your function definition. These alarms utilize Cloudwatch metrics to decide if they have to trigger. The metrics can be used in two different ways:

Steps to take in this lab:

  • Take a look a Cloudwatch metrics or the docs
  • Set yourself to a metric you want to use in your alarm
  • Write some cloudformation to create the alarm
  • Modify your function if needed (e.g. use time.Sleep() or let it error on certain inputs)
  • Call your function to trigger an alarm