> This page location: /docs.md > /docs/management.md > /docs/atlas/create-connect-deployments.md > /docs/atlas/manage-clusters.md > /docs/atlas/customize-storage.md > /docs/atlas/security-kms-encryption.md > /docs/atlas/security-aws-kms.md

> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

<!--
Tab options on this page. Append to the .md URL to filter:
  ?tabs=<id,...>   select specific tabs (e.g. ?tabs=nodejs,shell)
  ?allTabs=true    include every tab
  (no param)       default: one tab per tabset

Available tabs:
  other tabs: ui, api
-->

# Manage Customer Keys with AWS Over Private Endpoints

In addition to encrypting your data at rest in Atlas with the customer-managed keys (CMK) that you create, own, and manage in your AWS (Amazon Web Services) KMS (Key Management Service), you can add another layer of security by configuring all traffic to your AWS (Amazon Web Services) KMS (Key Management Service) to use AWS PrivateLink.

**Note:**

The MongoDB Atlas Shared Responsibility Model defines the complementary duties of MongoDB and its customers in maintaining a secure and resilient data environment. Under this framework, MongoDB manages the security and operational integrity of the underlying platform, while customers are responsible for the configuration, management, and data policies of their specific deployments. For a detailed breakdown of ownership across security and operational excellence, see [Shared Responsibility Model.](https://www.mongodb.com/resources/products/fundamentals/shared-responsibility)

This page describes how to set up AWS PrivateLink in your AWS (Amazon Web Services) KMS (Key Management Service) to ensure that all traffic between Atlas and your AWS (Amazon Web Services) KMS (Key Management Service) takes place over AWS (Amazon Web Services)'s private network interfaces.

## Considerations

Before you enable Encryption at Rest using AWS (Amazon Web Services) KMS (Key Management Service) over PrivateLink, review the following use cases, benefits, limitations, and prerequisites.

### Use Case

Suppose your Atlas deployment is on a single cloud service provider. You now have a requirement that all access to your AWS (Amazon Web Services) KMS (Key Management Service) occurs over your cloud provider's private networking infrastructure. This page walks you through the steps to enable private endpoint connections for your Atlas project.

### Benefits

You can configure Encryption at Rest with AWS (Amazon Web Services) KMS (Key Management Service) over private networking. This configuration allows all traffic to your AWS (Amazon Web Services) KMS (Key Management Service) to pass through a set of private endpoints and avoids exposing your AWS (Amazon Web Services) KMS (Key Management Service) to the public Internet or public IP addresses. This configuration also eliminates the need to maintain allowed IP addresses while enhancing data security by keeping all AWS (Amazon Web Services) KMS (Key Management Service) traffic within AWS (Amazon Web Services)'s private network.

### Limitations

- Atlas supports Encryption at Rest using AWS (Amazon Web Services) KMS (Key Management Service) over private networking only for single-cloud deployments.

- Atlas supports Encryption at Rest using AWS (Amazon Web Services) KMS (Key Management Service) over private networking only for projects in the `ACTIVE` state.

## Prerequisites

To enable customer-managed keys with AWS (Amazon Web Services) KMS (Key Management Service) for a MongoDB project, you must:

- Use an M10 or larger cluster.

* Have an AWS (Amazon Web Services) IAM (Identity and Access Management) role with sufficient privileges. Atlas must have permission to perform the following actions with your key:

  - [DescribeKey](http://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html)

  - [Encrypt](http://docs.aws.amazon.com/kms/latest/APIReference/API_Encrypt.html)

  - [Decrypt](http://docs.aws.amazon.com/kms/latest/APIReference/API_Decrypt.html)

  **Note:**

  If you wish to use the AWS (Amazon Web Services) KMS (Key Management Service) key with an AWS IAM role from a different AWS account instead of that of the IAM role which created the AWS (Amazon Web Services) KMS (Key Management Service) key , ensure you have sufficient privileges:

  - Add a key policy statement under the AWS (Amazon Web Services) KMS (Key Management Service) key  to include the external AWS account.

  - Add an IAM inline policy for the IAM role in the external AWS account.

  For a comprehensive discussion of IAM roles and customer master keys, see the [AWS documentation.](https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-modifying-external-accounts.html)

  After confirming the above privileges, you can follow the usual steps to configure the KMS settings in Atlas, with the following exception:

  - You must provide the full ARN (Amazon Resource Name) for the AWS (Amazon Web Services) KMS (Key Management Service) key  (e.g. `arn:aws:kms:eu-west-2:111122223333:key/12345678-1234-1234-1234-12345678`) instead of the master key ID (e.g. `12345678-1234-1234-1234-12345678`) in the AWS (Amazon Web Services) KMS (Key Management Service) key ID field.

  To learn how to create an IAM (Identity and Access Management) role, see [IAM Roles](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html) in the AWS (Amazon Web Services) documentation.

  Atlas uses the same IAM (Identity and Access Management) role and AWS (Amazon Web Services) KMS (Key Management Service) key settings for all clusters in a project for which Encryption at Rest is enabled.

* If your AWS (Amazon Web Services) KMS (Key Management Service) configuration requires it, [allow access](http://docs.aws.amazon.com/kms/latest/developerguide/conditions-aws.html#conditions-aws-ip-address) from [Atlas IP addresses](https://www.mongodb.com/docs/atlas/setup-cluster-security.md#std-label-atlas-add-inbound-ips) and the public IP addresses or DNS hostnames of your cluster nodes so that Atlas can communicate with your KMS (Key Management Service). You must include the IP addresses in your [managed IAM role policy](http://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-edit.html) by configuring [IP address condition operators](http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html#Conditions_IPAddress) in your policy document. If the node IP addresses [change](https://www.mongodb.com/docs/atlas/reference/faq/networking.md#std-label-faq-public-ip-changes), you must update your configuration to avoid connectivity interruptions.

## Procedures

### Enable Role-Based Access for Your Encryption Key for a Project

### Atlas UI

1. In Atlas, go to the Advanced page for your project.

   If it's not already displayed, select the organization that contains your project from the  Organizations menu in the navigation bar.

   If it's not already displayed, select your project from the Projects menu in the navigation bar.

   In the sidebar, click Database & Network Access under the Security heading.

   In the sidebar, click Advanced.

   The [Advanced](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fsecurity%2Fadvanced) page displays.

2. Toggle the button next to Encryption at Rest using your Key Management to On.

3. Click the Authorize a new IAM role link to authorize an AWS (Amazon Web Services) IAM role to Atlas to access your AWS (Amazon Web Services) KMS keys for encryption at rest.

   To create a new AWS (Amazon Web Services) IAM role for accessing your AWS (Amazon Web Services) KMS keys for encryption at rest, follow the [Create New Role with the AWS CLI](https://www.mongodb.com/docs/atlas/security/set-up-unified-aws-access.md#std-label-set-up-unified-aws-access) procedure. If you have an existing AWS (Amazon Web Services) IAM role that you want to authorize, follow the [Add Trust Relationships to an Existing Role](https://www.mongodb.com/docs/atlas/security/set-up-unified-aws-access.md#std-label-set-up-unified-aws-access) procedure.

4. Add an access policy to your AWS (Amazon Web Services) IAM role via the AWS (Amazon Web Services) console or CLI. See [Managing IAM policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage.html) for more information.

   **Note:**

   This policy statement allows MongoDB's AWS (Amazon Web Services) Principal to use the customer's KMS key for encryption and decryption operations. The Atlas Principal is not secret and is used across all Atlas customers. This is a highly-restricted, purpose-limited AWS (Amazon Web Services) account, with no resources in it other than the IAM user. The `ExternalId` in the policy statement is unique for each Atlas project, but it is not secret. The `ExternalId` is used to mitigate the possibility of cross-context (confused deputy) vulnerabilities. Atlas's use of a common principal to access all customers' keys is an access pattern recommended by Amazon, as described [here.](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html)

   The access policy for encryption at rest looks similar to the following:

   ```json
   {
     "Version": "2012-10-17",
     "Statement": [
       {
         "Effect": "Allow",
         "Action": [
           "kms:Decrypt",
           "kms:Encrypt",
           "kms:DescribeKey"
         ],
         "Resource": [
           "arn:aws:kms:us-east-1:123456789012:key/12x345y6-7z89-0a12-3456-xyz123456789"
         ]
       }
     ]
   }
   ```

5. Repeat steps 1 and 2 to assign the role you authorized in step 3 to your project for accessing your encryption key.

6. Specify the following for accessing your encryption key and click Save.

   Select the role to assign from the AWS IAM role dropdown list.

   Specify your encryption key in the Customer Master Key ID field.

   Select the AWS (Amazon Web Services) region for your encryption key.

After you enable role-based access for your encryption key for your project, enable private endpoint connections for your project by following [Enable and Set up Private Endpoint Connections for a Project.](https://www.mongodb.com/docs/atlas/security/aws-kms-over-private-endpoint.md#std-label-aws-kms-enable-pvt-endpoint)

### Switch to Role-Based Access for Your Encryption Key for a Project

AWS (Amazon Web Services) requires the use of IAM (Identity and Access Management) *roles* instead of IAM (Identity and Access Management) *users* for managing access to AWS (Amazon Web Services) KMS (Key Management Service) encryption keys within Atlas. If you initially configured your project to use IAM (Identity and Access Management) *user* credentials to access AWS (Amazon Web Services) KMS (Key Management Service) keys, switch to role-based access using the following procedure.

**Important:**

If you switch your encryption keys to role-based access, you can't undo the role-based access configuration and revert to credentials-based access for encryption keys on that project.

### Atlas UI

1. In Atlas, go to the Advanced page for your project.

   If it's not already displayed, select the organization that contains your project from the  Organizations menu in the navigation bar.

   If it's not already displayed, select your project from the Projects menu in the navigation bar.

   In the sidebar, click Database & Network Access under the Security heading.

   In the sidebar, click Advanced.

   The [Advanced](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fsecurity%2Fadvanced) page displays.

2. For the Encryption at Rest using your Key Management section, click Edit .

3. Read the information in the Grant Access to Keys with an AWS IAM Role section and click Configure.

4. Authorize and assign an AWS IAM role to Atlas to access your AWS KMS keys for encryption at rest.

   To create a new AWS (Amazon Web Services) IAM role for accessing your AWS (Amazon Web Services) KMS keys for encryption at rest, follow the [Create New Role with the AWS CLI](https://www.mongodb.com/docs/atlas/security/set-up-unified-aws-access.md#std-label-set-up-unified-aws-access) procedure. If you have an existing AWS (Amazon Web Services) IAM role that you want to authorize, follow the [Add Trust Relationships to an Existing Role](https://www.mongodb.com/docs/atlas/security/set-up-unified-aws-access.md#std-label-set-up-unified-aws-access) procedure.

### Enable and Set up Private Endpoint Connections for a Project

To enable private networking and set up a private endpoint in your AWS (Amazon Web Services) KMS (Key Management Service), you must do the following:

### Atlas UI

1. In Atlas, go to the Advanced page for your project.

   If it's not already displayed, select the organization that contains your project from the  Organizations menu in the navigation bar.

   If it's not already displayed, select your project from the Projects menu in the navigation bar.

   In the sidebar, click Database & Network Access under the Security heading.

   In the sidebar, click Advanced.

   The [Advanced](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fsecurity%2Fadvanced) page displays.

2. Go to the Private Endpoints for AWS KMS page.

   On the Advanced page, in the Encryption at Rest
   using your Key Management section, do the following steps:

   Expand Network Settings for your AWS KMS if it's collapsed.

   Toggle on the button next to Require Private
   Networking.

   Click Set up.

   The Set Up Private Networking for AWS page displays.

3. Replicate your encryption key in each region.

   Sign into your AWS (Amazon Web Services) KMS (Key Management Service) dashboard.

   In the Atlas UI, click Copy to save your customer master key ID.

   In your AWS (Amazon Web Services) KMS (Key Management Service) dashboard, replicate your key in all desired regions. To learn more, see the [AWS documentation.](http://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-replicate.html#create-replica-keys)

   In the Atlas UI, click Continue

4. Specify the AWS (Amazon Web Services) regions where you want to create private endpoints.

   Select the AWS (Amazon Web Services) regions from the dropdown.

   Click Continue.

   Atlas automatically creates private endpoints in these regions to allow you to connect by using private networking.

   Atlas can take up to three minutes to reflect the current status of your private endpoint. The private endpoint can have one of the following statuses:

   | ACTIVE | Indicates that the private endpoint is approved and Atlas can or is using it. |
   | --- | --- |
   | FAILED | Indicates that the private endpoint creation failed. |

5. Click Done to start using the private endpoints.

After you enable customer key management for your project and set up private endpoints, enable customer key management for each Atlas cluster in your project by following [Enable Customer Key Management for an Atlas Cluster.](https://www.mongodb.com/docs/atlas/security/aws-kms-over-private-endpoint.md#std-label-aws-pvt-enable-cluster-encryption-at-rest)

**Important:**

If you have an existing multi-region AWS cluster with customer key management enabled using an AWS (Amazon Web Services) KMS (Key Management Service) single-region key, you can't enable the Require Private Networking option. This configuration is not supported.

### Enable Customer Key Management for an Atlas Cluster

After you [Enable Role-Based Access for Your Encryption Key for a Project](https://www.mongodb.com/docs/atlas/security/aws-kms-over-private-endpoint.md#std-label-aws-kms-pvt-enable-project), you must enable customer key management for each Atlas cluster that contains data that you want to encrypt.

**Note:**

You must have the [`Project Owner`](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Project-Owner) role to enable customer key management for clusters in that project.

#### Multi-Region CMK

For multi-region AWS CMK (customer-managed key), make sure to add **every** regional key ARN to the KMS key policy so that Atlas clusters in those regions can access it.

For multi-region Atlas clusters on AWS (Amazon Web Services) that use AWS (Amazon Web Services) KMS (Key Management Service) private networking, your KMS (Key Management Service) setup must cover every Atlas region that the cluster uses. Replicate the multi-Region key to each region and create an AWS (Amazon Web Services) KMS (Key Management Service) private endpoint in each region.

For new clusters, toggle the [Manage your own encryption keys](https://www.mongodb.com/docs/atlas/cluster-additional-settings.md#std-label-create-cluster-enable-encryption) setting to Yes when you create the cluster.

For existing clusters:

1. In Atlas, go to the Clusters page for your project.

   If it's not already displayed, select the organization that contains your desired project from the  Organizations menu in the navigation bar.

   If it's not already displayed, select your desired project from the Projects menu in the navigation bar.

   In the sidebar, click Clusters under the Database heading.

   The [Clusters](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fclusters) page displays.

2. Modify the cluster's configuration.

   For the cluster that contains data that you want to encrypt, click the , then select Edit Configuration.

3. Enable cluster encryption.

   Expand the Additional Settings panel.

   Toggle the Manage your own encryption keys setting to Yes.

   Verify the status of the Require Private Networking setting for your cluster.

   If you configured Encryption at Rest Using CMK (customer-managed key) (Over Private Networking) for Atlas at the project level, the status is Active. If you haven't configured any private endpoint connection for your project, the status is Inactive.

4. Review and apply your changes.

   Click Review Changes.

   Review your changes, then click Apply Changes to update your cluster.

### Disable Customer-Managed Keys for a Project

To disable CMK (customer-managed key) for a project, you must first [remove](https://www.mongodb.com/docs/atlas/security/aws-kms-over-private-endpoint.md#std-label-aws-remove-reject-pvt-endpoint) all private endpoints associated with the project, regardless of their state. Atlas displays an error if you attempt to disable CMK (customer-managed key) for a project that is associated with active private endpoints.

After you remove all private endpoints for a project, you must disable customer key management on each cluster in the project before you disable the feature for the project.

**Warning:**

Do *not* disable or delete any AWS (Amazon Web Services) KMS (Key Management Service) keys that any cluster in your Atlas project uses before you have disabled customer key management within the Atlas project. If Atlas can't access an AWS (Amazon Web Services) KMS (Key Management Service) key, any data that the key encrypted becomes inaccessible.

### Create New Endpoints for a Project

After you enable and set up private endpoint connections for your project, you can add additional endpoints at anytime from the Atlas UI and the Atlas Administration API.

### Atlas UI

1. In Atlas, go to the Advanced page for your project.

   If it's not already displayed, select the organization that contains your project from the  Organizations menu in the navigation bar.

   If it's not already displayed, select your project from the Projects menu in the navigation bar.

   In the sidebar, click Database & Network Access under the Security heading.

   In the sidebar, click Advanced.

   The [Advanced](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fsecurity%2Fadvanced) page displays.

2. Go to the Private Endpoints for AWS KMS page.

   On the Advanced page, in the Encryption at Rest
   using your Key Management section, perform the following actions:

   Expand Network Settings for your AWS KMS if it's collapsed.

   Click Manage.

   The Private Endpoints for AWS KMS page displays the regions, endpoint name, status of the private endpoints for your Atlas clusters, and the actions you can take on the private endpoints.

3. Click Create new endpoints.

4. Specify the regions where you want to create private endpoints.

   Select the AWS (Amazon Web Services) regions from the dropdown.

   Click Continue.

   Atlas automatically creates private endpoints in these regions to allow you to connect by using private networking.

   Atlas can take up to three minutes to reflect the current status of your private endpoint. The private endpoint can have one of the following statuses:

   | ACTIVE | Indicates that the private endpoint is approved and Atlas can or is using it. |
   | --- | --- |
   | FAILED | Indicates that the private endpoint creation failed. |

5. Click Done to start using the private endpoints.

### Reject or Remove Private Endpoint Connection

You can remove private endpoint connections from the Atlas UI and the Atlas Administration API.

### Atlas UI

1. In Atlas, go to the Advanced page for your project.

   If it's not already displayed, select the organization that contains your project from the  Organizations menu in the navigation bar.

   If it's not already displayed, select your project from the Projects menu in the navigation bar.

   In the sidebar, click Database & Network Access under the Security heading.

   In the sidebar, click Advanced.

   The [Advanced](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fsecurity%2Fadvanced) page displays.

2. Go to the Private Endpoints for AWS KMS page.

   On the Advanced page, in the Encryption at Rest
   using your Key Management section, perform the following actions:

   Expand Network Settings for your AWS KMS if it's collapsed.

   Click Manage.

   The Private Endpoints for AWS KMS page displays the regions, endpoint name, status of the private endpoints for your Atlas clusters, and the actions you can take on the private endpoints.

3. Remove the private endpoint connection.

   Click the  icon in the Actions column for the private endpoint that you want to remove.

   Click Delete to confirm deletion of the private endpoint.

### View Private Endpoints and their Statuses

You can view the private endpoints in the various regions and their statuses from the Atlas UI and the Atlas Administration API.

### Atlas UI

1. In Atlas, go to the Advanced page for your project.

   If it's not already displayed, select the organization that contains your project from the  Organizations menu in the navigation bar.

   If it's not already displayed, select your project from the Projects menu in the navigation bar.

   In the sidebar, click Database & Network Access under the Security heading.

   In the sidebar, click Advanced.

   The [Advanced](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fsecurity%2Fadvanced) page displays.

2. Go to the Private Endpoints for AWS KMS page.

   On the Advanced page, in the Encryption at Rest
   using your Key Management section, perform the following actions:

   Expand Network Settings for your AWS KMS if it's collapsed.

   Click Manage.

   The Private Endpoints for AWS KMS page displays the regions, endpoint name, status of the private endpoints for your Atlas clusters, and the actions you can take on the private endpoints.

Each private endpoint can be in one of the following statuses:

| ACTIVE | Indicates that the private endpoint is approved and Atlas can or is using it. |
| --- | --- |
| FAILED | Indicates that the private endpoint creation failed. |

### Disable Private Endpoint Connections for a Project

To disable private endpoint connections for a project, you must first [remove](https://www.mongodb.com/docs/atlas/security/aws-kms-over-private-endpoint.md#std-label-aws-remove-reject-pvt-endpoint) all private endpoints, associated with the project, regardless of their state. Atlas doesn't disable private endpoint connections for a project if the project is associated with active private endpoints.

After you remove all private endpoints for a project, you can disable private endpoint connections for the project by using the Atlas UI and the Atlas Administration API.

### Atlas UI

1. In Atlas, go to the Advanced page for your project.

   If it's not already displayed, select the organization that contains your project from the  Organizations menu in the navigation bar.

   If it's not already displayed, select your project from the Projects menu in the navigation bar.

   In the sidebar, click Database & Network Access under the Security heading.

   In the sidebar, click Advanced.

   The [Advanced](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fsecurity%2Fadvanced) page displays.

2. Disable private networking.

   Under Encryption at Rest using your Key Management, select AWS KMS.

   Under Network Settings, toggle the button next to Require Private
   Networking to  Off.

   Click Save.

## Related Topics

- To enable Encryption at Rest using your Key Management when deploying an Atlas cluster, see [Manage Your Own Encryption Keys.](https://www.mongodb.com/docs/atlas/cluster-additional-settings.md#std-label-create-cluster-enable-encryption)

- To enable Encryption at Rest using your Key Management for an existing Atlas cluster, see [Enable Encryption at Rest.](https://www.mongodb.com/docs/atlas/scale-cluster.md#std-label-scale-cluster-enable-encryption)

- To learn more about Encryption at Rest using your Key Management in Atlas, see [Encryption at Rest using Customer Key Management.](https://www.mongodb.com/docs/atlas/security-kms-encryption.md#std-label-security-kms-encryption)

- To learn more about MongoDB Encryption at Rest, see [Encryption at Rest](https://www.mongodb.com/docs/manual/core/security-encryption-at-rest/) in the MongoDB server documentation.

- To learn more about Encryption at Rest with Cloud Backups, see [Storage Engine and Cloud Backup Encryption.](https://www.mongodb.com/docs/atlas/backup/cloud-backup/cloud-backup-encryption.md#std-label-encrypted-cloud-provider-snapshot)

- To enable customer key Management for Search Nodes, see [Enable Search Node Data Encryption.](https://www.mongodb.com/docs/atlas/security-kms-encryption.md#std-label-enable-search-node-encryption)
