# AWS CloudWatch Event Rules

[<mark style="color:blue;">AWS CloudWatch Events</mark>](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/WhatIsCloudWatchEvents.html) delivers a near real-time stream of system events that describe changes in AWS resources. Using simple rules that you can quickly set up, you can match events and route them to one or more target functions or streams.

Route detailed alerts from AWS CloudWatch Event Rules to the right users in Squadcast.

### How to integrate AWS CloudWatch Event Rules with Squadcast

1. Navigate to **Services** -> **Service Overview** -> select or search for your Service. Expand the accordion -> In the Alert Sources section, click **Add**.

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-4fbd74e7ca0b30173c47a1d58ed6a0804a0465aa%2FAlert_Sources.png?alt=media&#x26;token=aaca6610-9d18-4dd4-9cf5-320042f326f1" alt="Integration of Amazon CloudWatch Event Rules as alert source with Squadcast" width="563"><figcaption></figcaption></figure>

2\. Select **Amazon CloudWatch Event Rules**. Copy the displayed **Webhook URL** to [configure](#create-a-squadcast-webhook-in-amazon-cloudwatch) it within **Amazon CloudWatch Event Rules**. Finish by clicking **Add Alert Source** -> **Done**.

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-6ac0272fcd299fb9e5503b737426b5c94c1fd9c3%2FAWS%20CloudWatch%20Event%20Rules.png?alt=media&#x26;token=2b1c8dd4-72f8-4079-8a12-c8a8ffbc7ed7" alt="Webhook URL configuration within Amazon CloudWatch Event Rules in Squadcast" width="563"><figcaption></figcaption></figure>

{% hint style="warning" %} <mark style="color:orange;">**Important**</mark>**:**

When an alert source turns <mark style="color:green;">Active</mark>, it’ll show up under Configured Alert Sources. You can either generate a test alert from the integration or wait for a real-time alert to be generated by the Alert Source.\
\
An Alert Source is <mark style="color:green;">active</mark> if there is a recorded incident via that Alert Source for the Service.
{% endhint %}

### In AWS: Configure SNS Endpoint

1. Log in to your AWS account and proceed to **SNS**
2. Click on **Create topic**
3. Within the dialog box, fill in the details as per your requirements and then click on **Create topic**

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-4541ecbbf40e83f6469f4eae260d8c147dbdcd89%2Fevent_rules_2.png?alt=media&#x26;token=f5f3f381-e201-4c79-866a-e6ecc39c53ed" alt="AWS SNS Endpoint Configuration" width="563"><figcaption></figcaption></figure>

4. Inside the topic, click on **Create Subscription**

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-0ddd1a57bb31506f76fc6efdf03e5a1b99b20394%2Fevent_rules_3.png?alt=media&#x26;token=12279a7e-b525-4aee-9fcb-a47407dcd2fc" alt="AWS SNS Topic Creation and Subscription Process" width="563"><figcaption></figcaption></figure>

5. Select the protocol as **HTTPS** and in the endpoint enter the URL you obtained from the previous step
6. Finally, click on **Create Subscription** to create the subscription

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-617e70cec407d125fdd2b1ce5aa1918cd4221818%2Fevent_rules_4.png?alt=media&#x26;token=9442b424-b1c7-413e-8611-c08d3d577135" alt="AWS SNS Subscription Creation with HTTPS Endpoint" width="563"><figcaption></figcaption></figure>

{% hint style="warning" %} <mark style="color:orange;">**Important**</mark>**:**

The **Subscription ID** for the subscription should immediately change to **Confirmed** from **PendingConfirmation**. Click on the refresh button to verify the same.
{% endhint %}

### In AWS: Configure CloudWatch Event Rules

1. Go to **CloudWatch** and click on **Rules** under **Events**
2. Click on **Create Rule**

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-3ca2f71eee18294d6d20e6e30335a3615f57655f%2Fevent_rules_5.png?alt=media&#x26;token=02d50cd8-8386-40ad-bb89-d8e3081a5969" alt="Creating CloudWatch Event Rules in AWS" width="563"><figcaption></figcaption></figure>

3. Select desired **Service Name** and **Event Type** In this example, we're selecting `Service Name: EC2` and `Event Type: All Events`

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-24aa64669c2243cc74f29bd3aa7f3916cb87d9f4%2Fevent_rules_6.png?alt=media&#x26;token=00f2e6db-f182-4c0b-b519-f864a842f835" alt="Selecting Service Name and Event Type in CloudWatch Event Rules" width="464"><figcaption></figcaption></figure>

4. Under **Targets** click on **Add Target**
5. Select **SNS Topic** and your topic name from the dropdown In this example, we're selecting `Topic: Instance-state-change`

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-959b2555cf2f8807911a464a058653a487caf054%2Fevent_rules_7.png?alt=media&#x26;token=4b4861d4-cead-4bda-86df-d11de721409b" alt="Adding SNS Topic as Target in CloudWatch Event Rules" width="450"><figcaption></figcaption></figure>

6. Click on **Configure rule details**. Enter the name of your rule. Add a description as needed
7. Click on **Create a rule** to save this configuration

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-b7b5f58469caa12801c2f6c9a5da29d9cca32103%2Fevent_rules_8.png?alt=media&#x26;token=16763207-7192-48f1-9de5-184887169750" alt="Configuring Rule Details in CloudWatch Event Rules"><figcaption></figcaption></figure>

That's it, you are good to go! Your AWS CloudWatch Event Rules integration is complete.

* Now, whenever an event is triggered that matches your Event Rules, an incident will be created in Squadcast for it.

{% hint style="info" %} <mark style="color:blue;">**FAQ**</mark>**:**

Q: If an alert gets resolved in AWS CloudWatch Event Rules, does it send auto-resolve signals to Squadcast?\
\
A: No, AWS CloudWatch Event Rules does not send auto-resolve signals to Squadcast. Hence, Squadcast incidents from AWS CloudWatch Event Rules should be resolved manually.
{% endhint %}

*Have any questions?* [*Ask the community*](https://community.squadcast.com/view/home)*.*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.squadcast.com/integrations/alert-source-integrations-native/aws_cloudwatch_event_rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
