# AWS SNS Monitor

The **AWS SNS (Simple Notification Service) Monitor** component enables monitoring of **SNS topics and messages** in real time. It integrates with **Amazon SQS queues** and **S3 bucket event notifications** to capture and forward activity to downstream pipeline events.

This component provides a reliable way to track:

* S3 bucket object events (create, update, delete).
* Delivery status of SNS messages.
* Notifications from subscribed SNS topics.

By configuring the monitor with the appropriate AWS credentials and queue URL, you can seamlessly integrate **AWS event-driven workflows** into your pipeline.

### Configuration Sections

All component configurations are grouped into the following sections:

* **Basic Information**
* **Meta Information**
* **Resource Configuration**
* **Connection Validation**

### Basic Information Tab

The *Basic Information* tab defines execution and deployment settings.

| Field                       | Description                                                               | Required |
| --------------------------- | ------------------------------------------------------------------------- | -------- |
| **Invocation Type**         | Select execution mode: **Batch** or **Real-Time**.                        | Yes      |
| **Deployment Type**         | Displays the deployment type of the component (pre-selected).             | Yes      |
| **Container Image Version** | Displays the Docker image version used (pre-selected).                    | Yes      |
| **Failover Event**          | Select a failover event to handle retries or errors.                      | Optional |
| **Batch Size**              | Maximum number of records processed in one execution cycle (minimum: 10). | Yes      |

### Meta Information Tab

The *Meta Information* tab configures AWS credentials and SNS/SQS integration details.

| Field          | Description                                                                                         | Required |
| -------------- | --------------------------------------------------------------------------------------------------- | -------- |
| **Access Key** | AWS Access Key for authentication.                                                                  | Yes      |
| **Secret Key** | AWS Secret Key for authentication.                                                                  | Yes      |
| **Region**     | AWS region where the SNS topic and SQS queue are created.                                           | Yes      |
| **SQS URL**    | URL of the SQS queue subscribed to the SNS topic. The SNS Monitor fetches messages from this queue. | Yes      |

### End-to-End Setup Guide

To configure monitoring with **AWS SNS Monitor**, complete the following steps:

#### Step 1: Create an SNS Topic

1. Sign in to the **AWS Management Console**.
2. Navigate to **Simple Notification Service (SNS)**.
3. Click **Create topic** and provide a name, display name, and optional description.
4. Once created, go to the **Subscriptions** tab → **Create subscription**.
5. Select **Amazon SQS** as the protocol.
6. Choose an existing SQS queue or create a new one.
7. Click **Create subscription**. The **SQS URL** will be available for configuration.

#### Step 2: Create an SQS Queue

1. In the AWS Console, navigate to **Simple Queue Service (SQS)**.
2. Click **Create queue** and enter a name.
3. Configure optional settings (message retention, visibility timeout, etc.).
4. Once created, select the queue from the list.
5. In **Queue Actions**, select **Subscribe to SNS topic**.
6. Choose the SNS topic created earlier.
7. Save the subscription. The **SQS URL** will be displayed in subscription details.

#### Step 3: Configure S3 Event Notification

1. In the AWS Console, go to **S3** and select the bucket to monitor.
2. Navigate to the **Properties** tab → **Events** → **Create event notification**.
3. Provide a name for the event.
4. Select the events to monitor (e.g., *All object create events*, *All object delete events*).
5. Set the destination to **Amazon SNS** and choose the SNS topic created earlier.
6. Optionally add filters (prefix/suffix) to restrict events.
7. Save the event notification.

#### Step 4: Configure AWS SNS Monitor

1. Open the pipeline editor and add the **AWS SNS Monitor** component.
2. Enter the following details in the **Meta Information Tab**:
   * **Access Key / Secret Key**
   * **Region**
   * **SQS URL**
3. Save the configuration.
4. Activate the pipeline.

When an event occurs in the monitored S3 bucket, it is published to the **SNS topic**, forwarded to the **SQS queue**, and consumed by the **AWS SNS Monitor**, which then sends it to the pipeline’s output event.

### Notes

* Ensure the **S3 bucket, SNS topic, and SQS queue are in the same AWS region**.
* Only one SNS Monitor should be configured for a given SQS URL to avoid duplicate processing.

### Example Workflow

1. Create an **S3 event notification** for a bucket storing customer documents.
2. Link it to an **SNS topic** → subscribed by an **SQS queue**.
3. Configure AWS SNS Monitor with the **SQS URL**.
4. When a new document is uploaded, the SNS Monitor pushes metadata about the event into the pipeline for logging and downstream analytics.


---

# 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://docs.bdb.ai/bdb-user-documentation/platform-modules/11.0/data-engineering/data-pipelines/pipeline-editor/pipeline-components/consumers/aws-sns-monitor.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.
