CloudWatch


Setup CloudWatch to route alerts to AWS CloudWatch.

Prerequisites 

An AWS account with access to CloudWatch is required.

Set up an AWS connection 

First, Lenses needs to get access to your AWS environment. This is done by creating an AWS connection.

1. Visit Admin → Connections and click New connection

Lenses.io Connection

2. Under “Alert & audit channels”, Select AWS

CloudWatch Connection

3. Provide a name to your liking and configuration and press “Save Connection”

CloudWatch Connection

Add channel 

Next add one or multiple target CloudWatch channels.

1. Visit Admin → Channels → New Alert Channel and click AWSCloudWatch

CloudWatch channel

2. Setup the configuration options. The name can be anything to your taste. For the connection, select the previously created AWS connection. For “source”, provide a string that allows you to uniquely identify CloudWatch events originating from Lenses.

CloudWatch details

For example the above will create the cw-devops alert channel, that is using the aws connection having as source the lenses.alerts.

Route CloudWatch events using a Rule 

With Lenses now setup to turn alerts into CloudWatch events, let’s make those events go somewhere. To do so, create a CloudWatch Rule in AWS.

In the AWS console:

  1. Navigate to “Events” -> “Rules” -> “Create rule”
  2. Select “Event pattern” and “Build custom event pattern”
  3. Provide the following pattern:
    {
      "source": ["lenses.alerts"]
    }
    
    This pattern filters only CloudWatch events with the source we previously configured in Lenses. If you named “source” different than lenses.alerts, change the pattern accordingly.
  4. Under “Targets”, select CloudWatch group
  5. Specify a name for the group (/aws/events/... - any name should work)
  6. Click “Configure details”
CloudWatch prerequisites

An example of alerts in a CloudWatch log 

After having setup the previous steps, Lenses will now emit CloudWatch events for alerts, and the CloudWatch Rule you created in AWS will make the event get routed to a log. An example of such a log looks like this.

CloudWatch log

Related

Webhooks (Email)
Webhooks (SMS)
Webhooks (SMS)
Webhooks (Email)
Webhooks (Email)
--
Last modified: June 18, 2024