> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bring your own keys (CMK)

> Encrypt a new LangSmith BYOC data plane on AWS with your own AWS KMS keys, using one key for every service or a separate key per service.

By default, AWS-managed keys encrypt a [BYOC](https://docs.langchain.com/langsmith/byoc.md) [data plane](https://docs.langchain.com/langsmith/byoc-architecture-aws.md#control-plane-and-data-plane-model) at rest. You can instead encrypt it with your own symmetric [AWS KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#kms_keys), using one key for every service or a separate key per service:

| Service | What the key encrypts |
| - | - |
| `s3` | The data plane's S3 buckets. |
| `ebs` | Node volumes. |
| `eks` | Kubernetes secrets in the EKS cluster. |
| `rds` | RDS storage, the RDS master user secrets, and Performance Insights data. |
| `elasticache` | ElastiCache data at rest. |

## Requirements and limitations

* Every service is optional. A service without a key keeps AWS-managed encryption.
* Keys must be symmetric encryption keys in the data plane region. They can be in the data plane account or in another AWS account.
* You set keys when you create the data plane. Keys cannot be added to existing data planes.
* After creation, the `ebs`, `eks`, `rds`, and `elasticache` keys cannot change. To change the `s3` key, contact the LangChain team.

> [!WARNING]
>
> If you disable or delete a key, every service that uses it stops working. Data encrypted with a deleted key cannot be recovered.

## Prepare the keys

Before you create the data plane, prepare the keys:

1. In the [`langsmith-byoc-role` Terraform module](https://github.com/langchain-ai/terraform/tree/main/modules/byoc/aws/langsmith-byoc-role#customer-managed-kms-keys), set `cmk_service_key_arns` to a key ARN for each service. To use one key for every service, set the same key ARN for each service. With [BYOIAM](https://docs.langchain.com/langsmith/byoc-byoiam-aws.md), set it in the BYOIAM module too.
2. Update the key policies as the [module README](https://github.com/langchain-ai/terraform/tree/main/modules/byoc/aws/langsmith-byoc-role#customer-managed-kms-keys) describes. The `ebs` key policy must allow the Auto Scaling service-linked role. When LangSmith manages the VPC, the `s3` key policy must allow VPC flow log delivery.

A key in another AWS account also needs key policy statements that allow the provisioning role and each BYOIAM role. An `ebs` key in another account also needs a grant for the Auto Scaling service-linked role, created from the data plane account, as the [module README](https://github.com/langchain-ai/terraform/tree/main/modules/byoc/aws/langsmith-byoc-role#customer-managed-kms-keys) describes. LangSmith cannot read the policy of a key in another account, so make sure the policy is complete before you create the data plane.

## Set the keys when you create the data plane

In the UI, open **Encryption keys** under **Configuration** when you create the data plane. Choose **One key for all services** or **A key per service**, then enter the key ARNs.

Through the API, include `customer_managed_keys` in the body of the [create data plane request](https://docs.langchain.com/langsmith/smith-api/data_planes/create-a-new-data-plane.md), alongside the other required fields. It takes two fields:

* **`key_arn`**: A key ARN for every service.
* **`service_key_arns`**: An object whose keys are service names and whose values are key ARNs.

```json One key for all services theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
{
  "customer_managed_keys": {
    "key_arn": "arn:aws:kms:us-east-1:123456789012:key/mrk-aaaa1111bbbb2222cccc3333dddd4444"
  }
}
```

```json A key per service theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
{
  "customer_managed_keys": {
    "service_key_arns": {
      "s3": "arn:aws:kms:us-east-1:123456789012:key/mrk-aaaa1111bbbb2222cccc3333dddd4444",
      "ebs": "arn:aws:kms:us-east-1:123456789012:key/mrk-bbbb2222cccc3333dddd4444eeee5555",
      "eks": "arn:aws:kms:us-east-1:123456789012:key/mrk-cccc3333dddd4444eeee5555ffff6666",
      "rds": "arn:aws:kms:us-east-1:123456789012:key/mrk-dddd4444eeee5555ffff666677778888",
      "elasticache": "arn:aws:kms:us-east-1:123456789012:key/mrk-eeee5555ffff66667777888899990000"
    }
  }
}
```

```json A default key with an override theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
{
  "customer_managed_keys": {
    "key_arn": "arn:aws:kms:us-east-1:123456789012:key/mrk-aaaa1111bbbb2222cccc3333dddd4444",
    "service_key_arns": {
      "rds": "arn:aws:kms:us-east-1:123456789012:key/mrk-dddd4444eeee5555ffff666677778888"
    }
  }
}
```

Set `key_arn`, `service_key_arns`, or both. A key in `service_key_arns` overrides `key_arn` for its service. Without `key_arn`, a service that `service_key_arns` does not list keeps AWS-managed encryption.

## How LangSmith validates the keys

Before it creates the data plane, LangSmith checks each key:

* The key exists and is enabled.
* The key is a symmetric encryption key.
* The provisioning role can use the key.

For keys in the data plane account, LangSmith also checks two key policies:

* The `ebs` key policy allows the Auto Scaling service-linked role.
* When LangSmith manages the VPC, the `s3` key policy allows VPC flow log delivery.

LangSmith does not check the policy of a key in another account.

## See also

* [BYOC onboarding](https://docs.langchain.com/langsmith/byoc-onboarding-aws.md)
* [BYOC architecture](https://docs.langchain.com/langsmith/byoc-architecture-aws.md)
* [Bring your own IAM roles](https://docs.langchain.com/langsmith/byoc-byoiam-aws.md)
* [Bring your own VPC](https://docs.langchain.com/langsmith/byoc-byovpc-aws.md)
* [Create a new data plane API reference](https://docs.langchain.com/langsmith/smith-api/data_planes/create-a-new-data-plane.md)

***

[Connect these docs](https://docs.langchain.com/use-these-docs.md) to your agent of choice via MCP for real-time answers.

[Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/langsmith/byoc-byok-aws.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
