> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-platform/3.0/harness-platform-resources/secrets/secrets-management/add-an-aws-kms-secrets-manager.md).

# Add an AWS KMS secret manager

To store and use encrypted secrets (such as access keys), you can add an AWS KMS Secrets Manager.

To store and use encrypted secrets (such as access keys) and files, you can add an AWS KMS Secret Manager.

This topic describes how to add an AWS KMS Secret Manager in Harness.

#### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

* [Harness' key concepts](https://developer.harness.io/harness-platform/3.0/in-harness-new-experience/overview.md)
* [Harness Secret Manager Overview](https://developer.harness.io/harness-platform/3.0/harness-platform-resources/secrets/secrets-management/harness-secret-manager-overview.md)
* [Store authentication credentials](https://developer.harness.io/harness-platform/3.0/harness-platform-resources/secrets/secrets-management/store-authentication-credentials.md)

#### 1: Add a secret manager <a href="#id-1-add-a-secret-manager" id="id-1-add-a-secret-manager"></a>

Navigate to **Settings** → **Account-level resources** → **Connectors** and click **New Connector**. Then, go to **Secret Managers** and select **AWS KMS**.

#### 2: Overview <a href="#id-2-overview" id="id-2-overview"></a>

Provide the basic details for your secret manager:

* Enter a **Name** for your secret manager.

  ```
    > You can either update the **ID** or leave it the same as your secret manager's name. Go to [Entity Identifier Reference](../../references/entity-identifier-reference.md) to learn how identifiers are generated.
  ```
* (Optional) Enter a **Description** and **Tags** for your secret manager.
* Select **Continue**.

#### 3: Details <a href="#id-3-details" id="id-3-details"></a>

Select the Credential Type. There are four ways to authenticate with AWS, as shown below:

* [**AWS Access Key.**](#option-1-aws-access-key)
* [**Assume IAM role on Delegate.**](#option-2-assume-iam-role-on-delegate)
* [**Assume Role using STS on Delegate.**](#option-3-assume-role-using-sts-on-delegate)
* [**Use OIDC**](#option-4-oidc---openid-connect)

#### Option 1: AWS access key <a href="#option-1-aws-access-key" id="option-1-aws-access-key"></a>

Use your AWS IAM user login credentials.

{% hint style="info" %}
You can get the **AWS Access Key ID**, **AWS Secret Key**, and **Amazon Resource Name (ARN)** either from the **Key Policy** JSON or from the AWS **IAM** console under **Encryption keys**.
{% endhint %}

Go to the AWS guide on [viewing the Key ID and ARN](https://docs.aws.amazon.com/kms/latest/developerguide/viewing-keys.html#find-cmk-id-arn) to find these values.

* **AWS Access Key ID**
  * Select **Create or Select a Secret**.
  * In the secret settings dialog, you can create or select a [Secret](https://developer.harness.io/harness-platform/3.0/harness-platform-resources/secrets/add-use-text-secrets.md) and enter your AWS Access Key as its value.

    <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><ul><li>The AWS Access Key is the AWS Access Key ID for the IAM user you want to use to connect to secret manager.</li></ul></div>
* **AWS Secret Access Key**
  * Select **Create or Select a Secret**. You can create a new [Secret](https://developer.harness.io/harness-platform/3.0/harness-platform-resources/secrets/add-use-text-secrets.md) with your Access Key ID's secret key as the **Secret Value**, or use an existing secret.
* **AWS ARN**: You can provide the AWS ARN as plain text or as an encrypted secret.

  ![arn](https://204875495-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiHCl4N3pQkjhOYjQoOs7%2Fuploads%2Fgit-blob-6b68b837abdcb5d8e8a5f1df35ac43e30bf98062%2Fplaintext-encrypted.png?alt=media)

#### Option 2: Assume IAM role on Delegate <a href="#option-2-assume-iam-role-on-delegate" id="option-2-assume-iam-role-on-delegate"></a>

If you select **Assume the IAM Role on Delegate** Harness will authenticate using the IAM role assigned to the AWS host running the Delegate, you select using a Delegate Selector.

* **AWS ARN**: Enter the AWS ARN directly as plain text or as an encrypted secret.

  ![](https://204875495-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiHCl4N3pQkjhOYjQoOs7%2Fuploads%2Fgit-blob-e24b2d71a19a76f338dd14303a2c534351c9e546%2Fiam-role-del.png?alt=media)
* Select the **Region**, then click **Continue**.

#### Option 3: Assume role using STS on Delegate <a href="#option-3-assume-role-using-sts-on-delegate" id="option-3-assume-role-using-sts-on-delegate"></a>

This option uses the [AWS Security Token Service](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html) (STS) feature. Typically, you use `AssumeRole` within your account or for AWS cross-account access.

* **AWS ARN**: Provide the ARN either in plain text or as an encrypted secret.

  ![](https://204875495-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiHCl4N3pQkjhOYjQoOs7%2Fuploads%2Fgit-blob-4efc5addcab639555d9d0a2f6b06c35e078bc940%2Frole-using-sts.png?alt=media)
* **Region**: select your AWS region.
* **Role ARN**: Enter the Amazon Resource Name (ARN) of the role that you want to assume. This is an IAM role in the target deployment AWS account.
* **External ID**: If the administrator of the account to which the role belongs provided you with an external ID, then enter that value. Go to [How to Use an External ID When Granting Access to Your AWS Resources to a Third Party](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html) in the AWS documentation to learn more.
* **Assume Role Duration (seconds)**: This field sets the AssumeRole session duration. Go to [Session Duration](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) in the AWS AssumeRole documentation to review duration limits.

.

#### Option 4: OIDC - OpenID Connect. <a href="#option-4-oidc-openid-connect" id="option-4-oidc-openid-connect"></a>

This option uses OpenID Connect (OIDC) to authenticate and authorize users. This option is commonly used for secure identity federation across different applications or cloud platforms, enabling seamless authentication and access management.

* **AWS ARN**: Choose to input your ARN either as plain text or as an encrypted secret.

  ![odic-aws-kms](https://204875495-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiHCl4N3pQkjhOYjQoOs7%2Fuploads%2Fgit-blob-0cdcdebccd378bf9a2c24593c32b530d0c188146%2Fodic-aws-kms.png?alt=media)
* **Region and IAM Role**: Once your configuration is complete, set the IAM role and region below to proceed with the setup, as shown in the image above.
* **Delegate Selectors for Access Control** (optional): You can use delegate selectors in OIDC tokens to restrict access to secrets based on which delegates execute tasks. This is useful for enforcing environment-level boundaries. Go to [Delegate selectors as session tags](https://developer.harness.io/harness-platform/3.0/harness-platform-resources/connectors/cloud-providers/ref-cloud-providers/aws-connector-settings-reference.md) to learn how to configure this.

<details>

<summary>An additional step before proceeding.</summary>

#### Connectivity mode

This additional step allows you to select the connectivity mode.

Once you have selected OIDC, you will be able to select **connectivity mode**, based on the requirement you can select the provider that can be either connect through a **delegate** or through **Harness platform**.

![connectivity-mode](https://204875495-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiHCl4N3pQkjhOYjQoOs7%2Fuploads%2Fgit-blob-654e112ed9931321d060bd9dbe5d2e7d4f81349f%2Foidc-connectivity-mode.png?alt=media)

</details>

#### 3: setup delegates <a href="#id-3-setup-delegates" id="id-3-setup-delegates"></a>

In **Delegates** **Setup**, enter [**Selectors**](https://developer.harness.io/harness-platform/use-harness-platform/delegates/delegate/manage-delegates/select-delegates-with-selectors.md#option-select-a-delegate-for-a-connector-using-tags) for specific **Delegates** that you want to allow to connect to this Connector. Select **Save and Continue**.

#### 4: test connection <a href="#id-4-test-connection" id="id-4-test-connection"></a>

In **Connection** **Test**, select **Finish** after your connection is successful.

### Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* **Test connection fails:** Verify that the AWS Access Key, Assume IAM Role, Assume Role using STS, or OIDC credentials you configured are still valid and that the associated IAM identity has permission to use the KMS key.
* **Permission errors when accessing secrets:** Confirm the IAM user, role, or OIDC identity has the required KMS permissions (such as `kms:Encrypt`, `kms:Decrypt`, and `kms:DescribeKey`) on the ARN you provided.
* **OIDC authentication fails:** Make sure the connectivity mode and IAM role configured for OIDC match the delegate or Harness platform setting you selected.

{% @harness-feedback/feedback %}
