# AWS CloudTrail via CloudWatch

Please use this integration guide to configure CloudTrail alerts so they can be received in Squadcast. This integration should be used only for getting CloudTrail alerts via CloudWatch and an SNS endpoint.

For CloudTrail log alerts, use the [AWS CloudTrail Logs integration](https://github.com/punit-squadcast/sq-doc/blob/main/integrations/alert-source-integrations-native/aws-cloudtrail-logs/README.md).

For regular AWS CloudWatch alarms (like EC2 alerts), use the [AWS CloudWatch Integration](https://github.com/punit-squadcast/sq-doc/blob/main/integrations/alert-source-integrations-native/amazon-cloudwatch-aws/README.md).

## Using AWS CloudTrail via CloudWatch as an Alert Source

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="/files/ej4AI9zpOyFu5NZJCbwC" alt="How to configure AWS CloudTrail via CloudWatch integration in Squadcast" width="563"><figcaption></figcaption></figure>

2\. Select **AWS CloudTrail via CloudWatch**. Copy the displayed **Webhook URL** to [configure](#create-cloudtrail-alarm-endpoint-in-aws-sns) it within **AWS CloudTrail via CloudWatch.** Finish by clicking **Add Alert Source** -> **Done**.

<figure><img src="/files/fxoLWgPy7vlli5OkWXdy" alt="Steps to add AWS CloudTrail via CloudWatch integration to a service 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 %}

## Create CloudTrail Alarm Endpoint in AWS SNS

1. Now log in to your AWS account and proceed to SNS.
2. Click on "**Create topic**" to get the "Create new topic" dialogue box. Fill in the details as per your requirements and then click on "**Create topic**"

<figure><img src="/files/4WdbFFDHAjRfY8htNHhU" alt="Create CloudTrail Alarm Endpoint - AWS SNS: Create Topic" width="563"><figcaption></figcaption></figure>

3. Now inside the topic, click on "**Create subscription**" to get the "Create subscription" dialog box. Select the protocol as "**HTTPS**" and in the endpoint enter the URL you obtained from the previous step. Finally, click on "**Create subscription**" to create the subscription.

<figure><img src="/files/pxkemZbQFpxr4rDun5oS" alt="Create Subscription - AWS SNS: HTTPS Endpoint URL" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/doSv3AS71C1QS1ugFWie" alt="Create Subscription - AWS SNS: HTTPS Endpoint URL" width="563"><figcaption></figcaption></figure>

4. The "**Subscription ID**" for the subscription should immediately change to "**Confirmed**" from "**PendingConfirmation**". Click on the refresh button to verify the same.

<figure><img src="/files/2EcKVpvnOuJZUu07XfGM" alt="Verify Subscription Confirmation - AWS SNS: Refresh Subscription Status" width="563"><figcaption></figcaption></figure>

Then you can [configure your CloudTrail alerts](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudwatch-alarms-for-cloudtrail.html#cloudwatch-alarms-for-cloudtrail-security-group) and assign this topic as the notification option and you are good to go.

*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.incidents.cloud.solarwinds.com/integrations/alert-source-integrations-native/aws_cloudtrail_via_cloudwatch.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.
