

# Adding the Secrets Manager extension to a profile in AWS Systems Manager Cloud Extensions

Add the Secrets Manager extension to a profile on the console or with the AWS CLI, and approve its capabilities.

**Topics**
+ [Viewing the extension on the Systems Manager console](#cloud-extensions-ext-secrets-manager-add-to-profile-viewing-the-extension-on-the-systems-manager-console)
+ [Adding the extension to a profile](#cloud-extensions-ext-secrets-manager-add-to-profile-adding-the-extension-to-a-profile)

## Viewing the extension on the Systems Manager console
<a name="cloud-extensions-ext-secrets-manager-add-to-profile-viewing-the-extension-on-the-systems-manager-console"></a>

**To view the settings, capabilities, and versions of the extension**

1. Open the Systems Manager console at [https://console.aws.amazon.com/systems-manager/](https://console.aws.amazon.com/systems-manager/).

1. In the navigation pane, choose **Cloud Extensions**.

1. On the **Extension catalog** tab, choose **AWS Secrets Manager**.

The page shows an overview of the extension, a usage guide, and tabs for the settings, the capabilities, and the versions of the extension.

## Adding the extension to a profile
<a name="cloud-extensions-ext-secrets-manager-add-to-profile-adding-the-extension-to-a-profile"></a>

### Adding the extension on the console
<a name="cloud-extensions-ext-secrets-manager-add-to-profile-adding-the-extension-on-the-console"></a>

**To add the extension to a profile**

1. Open the Systems Manager console at [https://console.aws.amazon.com/systems-manager/](https://console.aws.amazon.com/systems-manager/).

1. In the navigation pane, choose **Cloud Extensions**.

1. On the **Extension catalog** tab, select **AWS Secrets Manager**, and then choose **Add to profile**.

1. On the **Choose a profile** page, choose **Existing profile** and then choose the profile in **Profile**, or choose **New profile**. Choose **Next**.

1. On the **Configure extension** page, under **Update method**, choose **Latest (recommended)** or **Specific version**.

1. Under **Settings**, review the general settings and the **Security**, **Cache**, and **Prefetch** groups. Change the values that you need. The extension requires the **Security** group.

1. To load secrets when the extension starts, add secrets or tag filters under **Prefetch**. For the steps, see [Prefetching secrets with the Secrets Manager extension in AWS Systems Manager Cloud Extensions](cloud-extensions-ext-secrets-manager-prefetch.md).

1. Review the **Capabilities summary**. The summary lists the capabilities that the extension requires and the capabilities that your settings add. The console approves these capabilities when you add the extension. Choose **Next**.

1. On the **Review and add** page, choose **Add to profile**.

For more information about the **Configure extension** page, see [Configuring an extension on the console](cloud-extensions-profiles.md#cloud-extensions-profiles-configuring-an-extension-on-the-console).

### Adding the extension with the AWS CLI
<a name="cloud-extensions-ext-secrets-manager-add-to-profile-adding-the-extension-with-the-aws-cli"></a>

**To add the extension to your Cloud Extensions profile with the AWS CLI**

1. Install the runtime. In Lambda, set the `AWS_CLOUDEXTENSIONS_PROFILE` environment variable of the function to the profile name or ID. Lambda pauses the runtime between invocations, so a change to the profile applies on a later invocation.

1. Create an execution role with the permissions in [Required IAM permissions](cloud-extensions-ext-secrets-manager-prerequisites.md#cloud-extensions-ext-secrets-manager-prerequisites-required-iam-permissions), and set the role as the default role of the profile:

   ```bash
   aws cloudextensions update-profile \
     --identifier my-application \
     --extension-defaults executionRole=arn:aws:iam::111122223333:role/SecretsManagerExtensionRole
   ```

1. Write your settings. The extension requires the `security` setting. If every caller signs requests with SigV4, turn off the server-side request forgery (SSRF) token check:

   ```json
   {
     "security": { "ssrfHeadersEnabled": false }
   }
   ```

   If you have callers that send an SSRF token header instead of signing, keep the check on and set the token:

   ```json
   {
     "security": {
       "ssrfToken": "YOUR_SSRF_TOKEN"
     }
   }
   ```

   For all options, see [Configuration options for the Secrets Manager extension in AWS Systems Manager Cloud Extensions](cloud-extensions-ext-secrets-manager-configuration.md).

1. Create a profile entry. You must approve the `secretsmanager` capability:

   ```bash
   aws cloudextensions create-profile-entry \
     --profile-identifier my-application \
     --extension-identifier aws:secretsmanager \
     --version-policy updateStrategy=AUTOMATIC,versionSelector=1.x.x \
     --approve secretsmanager \
     --settings file://settings.json
   ```

   The version policy tracks new releases within major version 1. If you didn't set an execution role in the extension defaults of the profile, add the `--execution-role` option.

1. Configure caller authentication. Use signed requests for all callers where you can. The default, `runtimeCredentials`, has callers sign requests with the credentials of the runtime. You can instead use an extension key, which has an access key ID and a secret key in the extension defaults of the profile. Use a Secrets Manager reference for the secret key of an extension key. For more information, see [Authentication](cloud-extensions-security.md#cloud-extensions-security-authentication).

   The SSRF token check is for callers that send a token header instead of signing. If your callers can't sign, set caller authentication to `none` and keep the SSRF token check on.

The runtime picks up profile changes within its poll interval, which is 45 seconds by default.

### Approving capabilities
<a name="cloud-extensions-ext-secrets-manager-add-to-profile-approving-capabilities"></a>

An extension can use a capability only after you approve the capability. To list the capabilities that the extension declares, run the following command:

```bash
aws cloudextensions get-extension \
  --identifier aws:secretsmanager \
  --query 'configuration.capabilities'
```

The extension declares the following capability:
+ **`secretsmanager`** (required) - Calls the Secrets Manager `GetSecretValue`, `BatchGetSecretValue`, and `DescribeSecret` operations.

For more information, see [Approving capabilities](cloud-extensions-profiles.md#cloud-extensions-profiles-approving-capabilities).