# AWS Secrets Manager

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

## Overview

AWS Secrets Manager helps securely store, manage, and retrieve sensitive information like API keys and passwords. This integration enables automated secret retrieval, rotation management, and secure credential workflows. Enhance security posture and automate sensitive data management in cloud environments.

## 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 Secrets Manager**

#### 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 (secret) from *secrets manager*

Get a secret from AWS Secrets Manager.

**Input Concepts**

| Concept       | Description                               | Type   | Required | Default Value |
| ------------- | ----------------------------------------- | ------ | -------- | ------------- |
| `secret name` | The name or ARN of the secret to retrieve | `text` | Yes      | (no default)  |

**Output Concepts**

| Concept  | Description                                  | Type           |
| -------- | -------------------------------------------- | -------------- |
| `secret` | the secret: The secret value as a dictionary | \`\` or `text` |

**Examples**

```generic
get a secret from secrets manager
   the secret name is "my-secret/super-secret"
```

### to list (secrets) from *secrets manager*

Get secrets available in AWS Secrets Manager.

**Input Concepts**

| Concept       | Description                                            | Type     | Required | Default Value |
| ------------- | ------------------------------------------------------ | -------- | -------- | ------------- |
| `max results` | The maximum number of secrets to return (default: 100) | `number` | No       | 100           |

**Output Concepts**

| Concept                              | Description                                                 | Type                     |
| ------------------------------------ | ----------------------------------------------------------- | ------------------------ |
| [`secrets`](#aws-secret-information) | A list of Secret objects (without the actual secret values) | `aws secret information` |

**Examples**

```generic
list secrets from secrets manager
   the max results is 100
```

## Concepts

### Aws secret information

Represents the information of an AWS Secret.

| Field Name    | Description                                | Type                     |
| ------------- | ------------------------------------------ | ------------------------ |
| `name`        | The name of the secret.                    | `text`                   |
| `arn`         | The ARN of the secret.                     | `text`                   |
| `description` | The description of the secret.             | `text`                   |
| `tags`        | A list of tags associated with the secret. | `optional[list of json]` |
