# AWS SNS

{% hint style="info" %}
The following documentation is for **AWS SNS v1.6.4** *(BDK)*.
{% endhint %}

## Overview

Amazon SNS (Simple Notification Service) provides managed messaging for application-to-application and application-to-person communication. This integration enables automated notifications, message publishing, and distributed system communication workflows. Enhance system reliability and automate messaging across distributed applications.

## Prerequisites

### 1. Required Books

The following Book(s) need to be added to your agent so it can learn and understand the automation procedures defined within them:

* **AWS SNS**

#### How to Add the Book(s)

1. Go to **Books** → **All Books**.
2. Search for the name of the book and click on it.
3. Click on <kbd>**Install**</kbd> or <kbd>**Add Connection**</kbd> to add the book to your agent.
4. If adding a connection, you'll be prompted for [**connectivity**](#connectivity) details.

## Connectivity

This section outlines the available methods for connecting to the Book, along with the required configuration details for each.

### Connect using AWS Access key ID, AWS Secret Access Key, AWS Region, AWS Role ARN and AWS External ID

Assumes a role using the provided AWS credentials.

| Label                 | Description                                                                | Type        |
| --------------------- | -------------------------------------------------------------------------- | ----------- |
| AWS Access key ID     | The AWS Access Key ID for the initial authentication.                      | `text`      |
| AWS Secret Access Key | The AWS Secret Access Key for the initial authentication.                  | `sensitive` |
| AWS Region            | The AWS Region for the initial authentication.                             | `text`      |
| AWS Role ARN          | The ARN of the role to assume.                                             | `text`      |
| AWS External ID       | An optional external ID that might be required by the role's trust policy. | `sensitive` |

### Connect using AWS Access key ID, AWS Secret Access Key and AWS Region

Connects to an API using the provided API key.

| Label                 | Description               | Type        |
| --------------------- | ------------------------- | ----------- |
| AWS Access key ID     | The AWS Access Key ID     | `text`      |
| AWS Secret Access Key | The AWS Secret Access Key | `sensitive` |
| AWS Region            | The AWS Region            | `text`      |

## Procedures

### to get a (topic)

Get an SNS topic by its ARN.

**Input Concepts**

| Concept | Description                          | Type   | Required | Default Value |
| ------- | ------------------------------------ | ------ | -------- | ------------- |
| `arn`   | The ARN of the SNS topic to retrieve | `text` | Yes      | (no default)  |

**Output Concepts**

| Concept               | Description    | Type        |
| --------------------- | -------------- | ----------- |
| [`topic`](#sns-topic) | The SNS topic. | `sns topic` |

**Examples**

```generic
get a topic
   the arn is "<your topic arn here>"
```

### to list (topics)

Get SNS topics in the AWS account that match the filter (if any).

**Output Concepts**

| Concept                | Description           | Type        |
| ---------------------- | --------------------- | ----------- |
| [`topics`](#sns-topic) | A list of SNS topics. | `sns topic` |

**Examples**

```generic
list some topics
```

### to publish a message to a topic

Create a message in an SNS topic.

**Input Concepts**

| Concept               | Description                                                | Type        | Required | Default Value |
| --------------------- | ---------------------------------------------------------- | ----------- | -------- | ------------- |
| [`topic`](#sns-topic) | The SNS topic to publish to                                | `sns topic` | Yes      | (no default)  |
| `message`             | The message to publish                                     | `text`      | Yes      | (no default)  |
| `subject`             | Optional subject for the message (for email subscriptions) | `text`      | No       | (no default)  |
| `message attributes`  | Optional message attributes                                | `json`      | No       | (no default)  |

**Output Concepts**

| Concept  | Description                             | Type   |
| -------- | --------------------------------------- | ------ |
| `answer` | the message id of the published message | `text` |

**Examples**

```generic
list topics
use the first topic as the topic
the message is "Hello, world!"
publish the message to the topic
```

## Concepts

### Sns topic

Represents an Amazon SNS topic.

| Field Name     | Description                                     | Type             |
| -------------- | ----------------------------------------------- | ---------------- |
| `arn`          | The Amazon Resource Name (ARN) of the topic     | `text`           |
| `name`         | The unique name of the topic within the account | `text`           |
| `display_name` | The display name of the topic                   | `optional[text]` |


---

# 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.kognitos.com/legacy/legacy-experience/books/reference/sns.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.
