# Amazon Opensearch

[<mark style="color:blue;">Amazon OpenSearch</mark>](https://aws.amazon.com/opensearch-service/) is a distributed, open-source search and analytics suite used for a broad set of use cases like real-time application monitoring, log analytics, and website search.

Route detailed alerts from Amazon OpenSearch to the right users in Squadcast.

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

Amazon OpenSearch can also be integrated through **Amazon Cloudwatch**. Please find the documentation [here](https://support.squadcast.com/docs/amazon-cloudwatch-aws).
{% endhint %}

### Using Amazon OpenSearch 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="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 OpenSearch as alert source with Squadcast" width="563"><figcaption></figcaption></figure>

2\. Select **Amazon OpenSearch**. Copy the displayed **Webhook URL** to [configure](#create-a-squadcast-webhook-integration-in-amazon-opensearch) it within **Amazon OpenSearch.** 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-5552d02ef600ff1981a47642e8029b2207bb12c5%2FAmazon%20Opensearch.png?alt=media" alt="Webhook URL configuration within Amazon Opensearch 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 a Squadcast Webhook Integration in Amazon OpenSearch

**(1)** Login to your **Amazon OpenSearch** dashboard and select **Alerting**

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-03c61c7bfe8dc8c8727adb3e8c1029b5e093203c%2Famazon_opensearch_2.png?alt=media&#x26;token=03af34d2-2fca-4a0e-a960-2439133c4f37" alt="Alerting selection in Amazon OpenSearch dashboard to integrate Squadcast webhook" width="563"><figcaption></figcaption></figure>

**(2)** **(a)** Navigate to **Destinations** and click on **Add Destination**.

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-baf85a38e7cc26f8d6126979ed5a5d577b30e6ed%2Famazon_opensearch_3.png?alt=media" alt="Add destinations to integrate Squadcast webhook in Amazon open search dashboard" width="563"><figcaption></figcaption></figure>

**(b)** Put in the **Name**, select **Custom webhook** as **Type** and under **Settings**, select **Define endpoint by URL**. Then paste the previously copied Squadcast Webhook URL in the placeholder for **Webhook URL** and click on **Save**

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-0bb4a38a7fd5e8ff9c451910a8d6dd007dd38eef%2Famazon_opensearch_4.png?alt=media" alt="selection of custom webhook type and endpoint URL as webhook URL" width="563"><figcaption></figcaption></figure>

**(3)** **(a)** Under **Alerting**, navigate to **Monitors**. Then either click on **Create Monitor** or edit a pre-existing monitor. Click on **Add Trigger**

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-c7bcc647312efe8617d21e98c92cc8fba3f9d04b%2Famazon_opensearch_5.png?alt=media" alt="Create monitor under alerting monitor" width="563"><figcaption></figcaption></figure>

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-2809dea77cf14dae985b41e90b5f73ab04879291%2Famazon_opensearch_6.png?alt=media" alt="add trigger after creating monitor in amazon open search dashboard" width="563"><figcaption></figcaption></figure>

**(b)** Put in the **Action name**, select the previously created **Destination**. Paste the payload mentioned below under the **Message** box and save it

```json
{ 
    "message" : "Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue ",
    "trigger" : "Trigger: {{ctx.trigger.name}}",
    "severity" : "Severity: {{ctx.trigger.severity}}",
    "start" : "Period start: {{ctx.periodStart}}", 
    "end" : "Period end: {{ctx.periodEnd}}"
}
```

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-dcb298d8e85cc787a72936bd934f3dc19ea2bbaa%2Famazon_opensearch_7.png?alt=media" alt="using the payload under destination in open search dashboard" width="563"><figcaption></figcaption></figure>

{% hint style="info" %} <mark style="color:blue;">**Note: Custom User Defined Variables**</mark>

Users can define custom variables under the **Message** box :

**{ "custom" : { "key" : "value" , . . . , "key" : "value" } }**

Replace the **\[key]** & **\[value]** with proper values and add at the end of the variables mentioned in **Step 3 (b)**. This is how it might look like.

**Eg. :**

```json
{ 
    "message" : "Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue ",
    "trigger" : "Trigger: {{ctx.trigger.name}}",
    "severity" : "Severity: {{ctx.trigger.severity}}",
    "start" : "Period start: {{ctx.periodStart}}", 
    "end" : "Period end: {{ctx.periodEnd}}",
    "custom" : {
        "trigger" : "Trigger: {{ctx.trigger.name}}",
        "severity" : "Severity: {{ctx.trigger.severity}}",
        "start" : "Period start: {{ctx.periodStart}}", 
        "end" : "Period end: {{ctx.periodEnd}}"
    }
}
```

{% endhint %}

That's it, you are good to go!

* Your Amazon OpenSearch integration is now complete. Whenever Amazon OpenSearch fires an alert, an incident will be created in Squadcast for it.

*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/amazon_opensearch.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.
