Skip to Content

How do I route CloudWatch alarms to an AI SRE?

Tares receives CloudWatch alarms through the webhook connector and a vendor setup in Amazon EventBridge, because Tares has no connector of its own for CloudWatch today. You point an EventBridge API destination at a webhook source’s ingest URL, then add a trigger that wakes your agent when an alarm event arrives. The AI SRE guide shows how a trigger wakes an agent.

How it works

The route has three parts:

  • EventBridge sends the alarm. A rule on the default event bus matches CloudWatch alarm state changes and sends each one to an API destination. The destination posts the event as a JSON body to your Tares ingest URL.
  • A webhook source stores it. The webhook connector parses the JSON body whatever the Content-Type and stores the payload lossless. source and detail-type are top-level fields. detail.alarmName is one level deep, so it works as a dotted label. detail.state.value is two levels deep. If you want it as a label or in text_template, flatten it with an input transformer on the rule target.
  • A trigger wakes the agent. The trigger watches the webhook source. When its condition holds, it wakes the agent subscribed to it. The AI SRE guide builds the full chain: sources keyed by the same label, a trigger, an agent, and a finding written back.

The ingest URL must be public HTTPS, because EventBridge calls it from AWS.

Set it up

  1. Create the webhook source in Tares. Go to Sources → Add source → webhook, or ask a connected agent to create it. Label the fields you want to correlate on and mark one primary. The field names below come from the CloudWatch alarm event shape. If your other sources share a key label, such as service in the AI SRE guide, give this source a label with that same name so the alarm can be matched with them.
- name: cloudwatch-alarms connector: webhook config: event_type_field: detail-type labels: - { name: alarm, field: detail.alarmName, primary: true } - { name: region, field: region }
  1. Copy the ingest endpoint from the source page. It looks like /ingest/<ingest_key> on your Tares address.
  2. Create an API destination in EventBridge. Set its endpoint to the Tares ingest URL and its method to POST.
  3. Give the destination a connection. EventBridge requires one on every API destination. Choose API key authorization with header name Authorization and the value Bearer followed by an ingest-scoped API key. The key only matters when Tares has auth on.
  4. Create a rule on the default event bus. Match source aws.cloudwatch and detail-type CloudWatch Alarm State Change, and set the API destination as the rule’s target.
  5. Post a sample payload to the ingest URL to check your labels. The body is only an example of the fields the labels read.
curl -X POST http://localhost:8787/ingest/<ingest_key> \ -H 'Content-Type: application/json' \ -d '{"detail-type": "CloudWatch Alarm State Change", "source": "aws.cloudwatch", "region": "us-east-1", "detail": {"alarmName": "example-alarm"}}'
  1. Read Recent events and Fields on the source page. Recent events shows what arrived, and Fields shows which payload fields arrive and how often.
  2. Add a trigger on the source. This one fires when at least one alarm event arrives in a five-minute window, then waits five minutes before firing again.
- name: cloudwatch-alarm sources: [cloudwatch-alarms] condition: { aggregate: count, predicate: "> 0", window: 5m } cooldown: 5m
  1. Subscribe an agent to the trigger. Choose a Tares agent, your own agent service over a webhook, or a Slack channel, as the AI SRE guide describes under who gets woken.

What you get

  • Every CloudWatch alarm state change that matches your rule arrives in Tares as an event on a webhook source, with the full payload kept as sent.
  • A trigger on that source wakes the agent you chose when the alarm events meet your condition, so nobody has to poll.
  • The webhook source takes the alarm into Tares through ordinary configuration. The labels you declare map payload fields into the event, so you can correlate on them.
  • A cooldown on the trigger keeps repeated alarm events from waking the agent again right away.

When something else fits

  • If your alarms publish through SNS, this route does not fit. An SNS HTTPS subscription cannot send a custom header, and its SubscriptionConfirmation message would never be confirmed. Use an EventBridge rule with an API destination instead.
  • If your alerts already come from Prometheus, the AI SRE guide covers the prometheus_alerts and alertmanager connectors, which fit that setup directly.
  • For other vendors that post JSON, the same webhook connector setup applies.

Still stuck? Get help

Last updated on