# Guide for Configuring the External Service Alert CloudWatch on the Elven Platform

The integration of the **External Service Alert CloudWatch** with the **Elven Platform** is a solution designed to make your life easier by centralizing alert management in a single place. With it, you receive notifications directly from **Amazon CloudWatch**, eliminating the need to switch between platforms and allowing for a clear and efficient view of everything happening in your work environment.

In addition, the integration is fully customizable. You define which metrics and conditions are most relevant to your business, ensuring that the alerts received are useful and aligned with your needs. It’s a practical way to turn monitoring into a more fluid, organized, and assertive experience.

{% embed url="<https://demo.elven.works/demo/cmd3gemyd02fk130irxwkpjy0?utm_source=link>" %}

## **API Token Configuration**

To configure the **External Service Alert** in **CloudWatch**, it is necessary to generate an **API Token**. This token will be used as an essential part of the authentication process, being incorporated directly into the **request path**. It acts as an additional layer of security, ensuring that only properly authorized users can access and interact with the external service.

In this context, the **API Token** is included as a **URL parameter** in the call to the **API**. This ensures that client authentication is correctly performed during alert delivery or interaction with the service.

* In the top menu, under your user settings, click on **Organization Settings**.
* In the **API** tab, click the **+** button to create a new **API Token**.

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/p2nqalOf1FAYGbaMimJf/extserca01.png" alt=""><figcaption></figcaption></figure>

## **Accessing External Service Alert CloudWatch**&#x20;

* Navigate to the main menu and click on **Services Hub**.
* In **External Services Monitoring**, select the item **Alert CloudWatch**.

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/7Fa07mOE3mOsqzh8Oafx/extserca02.png" alt=""><figcaption></figcaption></figure>

## **Configuration of the External Service Alert CloudWatch**

The configuration of the fields in the **External Service Alert CloudWatch** is an essential step to ensure that your alerts in the **Elven Platform** work efficiently and reach the right people at the right time.

The first field, **External Service Name**, is where you should assign a name to the service being integrated. This name will appear in **dashboards** and **reports**, making it easier to quickly identify the service among others. Choose a clear and descriptive name, as it will be your reference for managing and reviewing the alert history in the future.

The **Responders** field is the bridge between the incident and the resolution. Here, you define who will be notified when the alert is triggered, whether specific individuals, entire teams, or even automated systems. This field is vital to ensure that alert notifications reach the right people, avoiding delays and confusion. Add relevant contacts, such as **emails** or **team IDs**, and make sure all responsible parties have the necessary information and access to act quickly.

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/IvnGQwnVMPCTOa9SMITW/extserca03.png" alt=""><figcaption></figcaption></figure>

## **Lambda Function of the External Service Alert CloudWatch**

When configuring an **External Service Alert CloudWatch**, one of the most important steps is selecting the **API Token** you previously generated. This key acts as a unique credential that securely connects your system to the alert notification service. Think of it as a master key that enables authentication and communication between platforms. Make sure to choose the correct **API Token** and keep it protected, as it is essential for the service to function and to ensure the integrity of the integration.

After selecting the **API Token**, you will gain access to the **function**, which is generated automatically. This **function** will be responsible for mediating communication between **CloudWatch** alarms and the **Elven Platform**, processing the received events and sending clear, actionable notifications. The integration is designed to transform raw data into structured alerts, ensuring that any important event is captured and delivered efficiently. This guarantees that you are always informed about critical states of your resources, allowing for a quick and assertive response.

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/FaTGSWS4qbtSPlPeUQpr/extserca04.png" alt=""><figcaption></figcaption></figure>

## **AWS Lambda and AWS SNS**

This automation is a **key component** for streamlining the identification and response to issues in your monitoring environment. In this process, the **Lambda Function** and the **SNS (Simple Notification Service)** play fundamental roles.\
\
The **Lambda Function** acts as the intelligent intermediary, processing events generated by **CloudWatch** alarms. When properly configured, it transforms these raw notifications into information that can be sent to the **Elven Platform**, ensuring you receive clear and actionable alerts. Without the **Lambda**, the automated data flow between **CloudWatch** and the **Elven Platform** would not be possible.\
\
The **SNS (Simple Notification Service)** plays a crucial role as the “messenger” in the integration system with the **Elven Platform**. It manages and distributes notifications generated by **CloudWatch** alarms, ensuring that each relevant event is delivered to the **Lambda Function** and subsequently processed for delivery to the **Elven Platform**.\
\
This configuration allows alerts to be forwarded efficiently and in real time to the platform, where they can be centralized and managed more conveniently.

## **Configuring in CloudWatch**

#### In AWS, you need to create a Lambda. In the Services menu, search for Lambda, then click Create Function:

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/6J8glfJc71iM9RhvDu36/extserca05.png" alt=""><figcaption></figcaption></figure>

**When creating the** **Lambda Function**, you must provide the **name** and the **Runtime**. By default, **Node.js 20.x** is used.

After filling in the fields above, click on **Create function**.

#### **After accessing the created Lambda Function, in Code Source, replace the default content with the one obtained during the creation of the External Service Alert CloudWatch.**

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/d1HPgcT6JK4RHxAT58sG/extserca06.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/IzvrsUrcLYdC3VMLNRak/extserca07.png" alt=""><figcaption></figcaption></figure>

Click **Deploy** after inserting the provided **code**.

#### **Access the SNS service.**

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/bNlVG9gkgU6mEALiTWfM/extserca08.png" alt=""><figcaption></figcaption></figure>

After accessing the **service**, go to **Topics** and then click **Create Topic**.\
\
Select the **Standard** option and give it a name of your choice.

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/mJU4g2BE2FkmDyffFjTh/extserca09.png" alt=""><figcaption></figcaption></figure>

After that, click **Create Topic**.

#### **When creating the Topic, the next step is to associate the created Lambda Function.** **To do this, scroll down to the bottom of the page and click on Create Subscription.**

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/A9b2jWNYtC1fVJGi7MNe/extserca10.png" alt=""><figcaption></figcaption></figure>

Select the created Topic, choose AWS Lambda as the protocol, and in the endpoint, select the one created for the integration. After that, click on Create Subscription.

#### **After creating the SNS Topic, we need to configure it in CloudWatch.**

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/DDFUt7q4AoJyKwYNADyv/extserca11.png" alt=""><figcaption></figcaption></figure>

When accessing the CloudWatch service, the next step is to create the alarm by clicking on “Create Alarm”.\
Select the metric you want to monitor. In the example below, we are monitoring the CPU Utilization metric.

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/kqicMVp92xpzhHQlb9Yo/extserca12.png" alt=""><figcaption></figcaption></figure>

Define the conditions according to your operation.

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/JLfTEbn4Wdgox8ujIpaV/extserca13.png" alt=""><figcaption></figcaption></figure>

Click on Next to proceed to the next step.

**Configure actions, we need to set up notifications for all three statuses:**

* In Alarm&#x20;
* OK&#x20;
* Insufficient data&#x20;

Todos devem enviar para o tópico criado no SNS, conforme exemplo:

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/G0TUSQeQ3HsY4mqih22J/extserca14.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/DbMQC4mFrAnVxK2MM56J/extserca15.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/mybKCAW34fmffcYTgElm/extserca16.png" alt=""><figcaption></figcaption></figure>

\
Click on Next to proceed to the next step and name the alert that was created.

<figure><img src="https://content.gitbook.com/content/NbD6tAAcbxaY8pw1cchL/blobs/wqacn2qNHZJ54L7WrH0K/extserca17.png" alt=""><figcaption></figcaption></figure>

Verify that the **alarm** and **conditions** were created correctly and click **Create Alarm** to finish. After that, all **CloudWatch alerts** should appear in the **One Platform**.

Once configured, the service will appear in the **External Services Monitoring Center**, categorized by **status**, making it easier to monitor **incidents** with priority given to those in **alarm state**.

## **Additional security and performance settings**

* **IP Whitelist**: API communication can be configured to allow only authorized IPs. To activate or modify this setting, contact **Elven Platform support**.
* **Rate Limiting**: The default request limiting time is **5 minutes**, but it can be adjusted as needed. For changes, contact **Elven Platform support**.

These settings ensure greater **security** and **control** over data traffic between integrated systems.

## **Glossary of Technical Terms**

**API Token**: A unique key used for secure authentication between systems. In the context of this documentation, it is essential for connecting **CloudWatch** to the **Elven Platform**.

**CloudWatch**: AWS monitoring service that collects and tracks metrics, monitors logs, and generates alarms for changes in your environment.

**External Service Name**: Descriptive name assigned to an external service integrated with the **Elven Platform**, used for identification in **dashboards** and **reports**.

**Responders**: People, teams, or systems designated to receive alert notifications and act accordingly.

**Lambda Function**: A function in **AWS Lambda** that processes events generated by **CloudWatch** alarms and forwards them to the **Elven Platform**.

**SNS (Simple Notification Service)**: AWS messaging service that delivers notifications generated by **CloudWatch** alarms to the **Lambda Function** or other **endpoints**.

**Node.js Runtime**: Execution environment used for the **Lambda Function**. In this documentation, **Node.js 20.x** is mentioned as the default.

**Code Source**: Area within the **Lambda Function** where the processing code is inserted or edited before deployment.

**Topics (SNS)**: **SNS** feature used to organize and distribute messages to specific subscribers, such as **Lambda Functions**.

**Subscription**: Association between an **SNS Topic** and an **endpoint** (e.g., a **Lambda Function**) that ensures notification delivery.

**CPU Utilization**: Common metric used in resource monitoring to assess CPU usage by instances or applications in **AWS**.

**Standard Topic (SNS)**: Type of **SNS Topic** that delivers messages with maximum effort for availability and reliability.

**Endpoint**: Destination where **SNS** notifications are sent, such as a **Lambda Function** configured for integration.
