Enhanced Data Encryption
Enhanced Data Encryption adds database-layer encryption on top of the cloud provider's default storage-layer encryption to protect your TiDB Cloud Premium database data and backup data at rest. With a Customer-Managed Encryption Key (CMEK), you control master key authorization, rotation, and lifecycle in your own cloud account.
You register a key once at the TiDB Cloud organization level and reuse it across TiDB Cloud Premium instances in the same cloud provider and region. Key material stays in your cloud KMS; TiDB Cloud stores only the key reference and the metadata needed to manage its authorization, status, and usage.
Overview
Before you begin
- Prepare a symmetric encryption key in AWS KMS or Alibaba Cloud KMS in the same cloud provider and region as your target TiDB Cloud Premium instances, and ensure that you have permission to update its key policy.
- For AWS, see Create a symmetric encryption KMS key.
- For Alibaba Cloud, see Understanding KMS keys. You must also be able to share your KMS instance through Alibaba Cloud Resource Directory (Resource Sharing) and enable Alibaba Cloud Gateway for the shared TiDB Cloud account.
- Ensure that you have the required TiDB Cloud role. For more information, see User roles.
- Manage and view organization keys (Organization Settings > CMEK):
Organization Owner. - Select a registered key when creating, enabling encryption on, or restoring an instance: the role required for that resource operation (
Organization Owner,Project Owner, orInstance Manager).
- Manage and view organization keys (Organization Settings > CMEK):
Register a key
You can register and authorize a key before creating any TiDB Cloud Premium instance. Registering a key makes it available to your organization; it does not enable encryption on an instance.
In the TiDB Cloud console, switch to your target organization, navigate to Organization Settings > CMEK, and start adding a key.
Select the cloud provider and region, and copy all generated authorization statements (and on Alibaba Cloud, note the displayed TiDB Cloud account).
Configure access in your cloud provider console:
- AWS KMS: Open the key policy of the selected symmetric key and append all generated statements to the existing
Statementarray. Preserve the generatedPrincipal,Action, andConditionfields as well as your existing key administration statements. For more information, see Key policies in AWS KMS. - Alibaba Cloud KMS:
- In Alibaba Cloud Resource Directory (Resource Sharing), share the KMS instance with the TiDB Cloud account displayed in the TiDB Cloud console.
- In the shared list, enable Alibaba Cloud Gateway for that TiDB Cloud account.
- Open the key policy of the selected symmetric key and append all generated statements to the existing
Statementarray, preserving existing key administration statements. For more information, see Manage Keys in Alibaba Cloud KMS.
- AWS KMS: Open the key policy of the selected symmetric key and append all generated statements to the existing
Return to the TiDB Cloud console, enter the key ARN, run the access check to verify that TiDB Cloud can perform the required KMS operations, and save the key.
Confirm that the key appears in Organization Settings > CMEK with status Idle. Eligible instances in the same organization, cloud provider, and region can now select this key.
Enable Enhanced Data Encryption
You can enable Enhanced Data Encryption when creating a TiDB Cloud Premium instance or on an existing instance. Once enabled, CMEK cannot be disabled or switched to a different key in place.
Reusing a registered key requires no additional changes to your cloud KMS key policy.
Enable encryption during instance creation
- On the My TiDB page, click Create Resource, select Premium, and choose the cloud provider and region.
- In the Enhanced Data Encryption section, enable CMEK and select a registered key in the selected cloud provider and region.
- If no suitable key is registered, an
Organization Ownercan open the CMEK page from the creation flow (opens in a new tab) to register one, and then return to instance creation to select the new key. - Complete the remaining settings and click Create. TiDB Cloud verifies key access before enabling CMEK.
Enable encryption for an existing instance
- In the TiDB Cloud console, open your target TiDB Cloud Premium instance, click Security in the left navigation pane, and then click Enable in the Enhanced Data Encryption section.
- Select a registered key in the instance's cloud provider and region. If no suitable key is registered, an
Organization Ownercan register one in Organization Settings > CMEK first. - Confirm the configuration and check the encryption status after enablement completes.
View encryption and key status
- Instance level: Open the instance Overview or Security page to view whether Enhanced Data Encryption is enabled and which encryption key protects the instance.
- Organization level: Open Organization Settings > CMEK (requires
Organization Owner) to view each registered key's status, cloud provider, region, and associated instances and backups.
Manage registered keys
Handle unavailable keys
If a registered key changes to Error or access fails:
- Review the affected key and resources in Organization Settings > CMEK.
- Restore the required key state, policy, or (on Alibaba Cloud) KMS instance sharing and Alibaba Cloud Gateway configuration in your cloud KMS.
- Verify that the key recovers from Error and review any affected instances or restore operations.
Because the database caches internal keys in memory for local data operations, disabling or revoking a CMEK does not necessarily affect ongoing operations immediately. The database might continue using cached keys until it next needs to call KMS to unwrap a protected key. All instances and backups using the same CMEK share this availability dependency.
Remove a key
- In Organization Settings > CMEK, review the key's associated instances and backup snapshots.
- Remove the key registration. TiDB Cloud blocks removal while any instance, backup snapshot, or in-progress restore still depends on the key, even when the key status is Error.
- If removal is blocked, clear all dependent resources first, and then retry and confirm removal.
Restore from an encrypted backup
When you restore a TiDB Cloud Premium backup, TiDB Cloud checks its encryption metadata and applies the corresponding key requirements in the target region:
For a CMEK-protected TiDB Cloud Premium backup, you cannot select another key or disable CMEK for the restored instance, and the restore must stay in the original cloud provider and region.
When restoring a CMEK-protected TiDB Cloud Dedicated backup to a new TiDB Cloud Premium instance (cross-plan restore) in the same cloud provider and region, TiDB Cloud uses the original TiDB Cloud Dedicated key to decrypt the source backup and re-encrypts the data with a registered TiDB Cloud Premium key for the new instance. Keep the original TiDB Cloud Dedicated key active and authorized for decryption, and select a registered TiDB Cloud Premium key in the same cloud provider and region (which can be the same key or a different key). For more information about supported restore sources and steps, see Backup and Restore for TiDB Cloud Premium.
Rotate a Customer-Managed Encryption Key (CMEK)
Configure key material rotation directly in your cloud KMS. In AWS KMS and Alibaba Cloud KMS, rotating key material keeps the key ID and ARN unchanged, so no configuration update is needed in TiDB Cloud.
Key material rotation updates the underlying material of the same CMEK. It does not switch the instance to a different CMEK, re-encrypt existing data, or remediate an already compromised data encryption key (DEK).
- For AWS, see Rotate AWS KMS keys.
- For Alibaba Cloud, see Key rotation in Alibaba Cloud KMS.
How encryption protects your data
Encryption mechanism
By default, the cloud provider encrypts data at rest at the storage layer (for example, EBS volume encryption and S3 server-side encryption on AWS). Enhanced Data Encryption adds an independent database encryption layer that encrypts database data and backup data before writing it to storage.
Because storage access and database-layer key permissions are managed separately, obtaining a storage object (such as an S3 file after server-side decryption) is not enough to read the data—the database-layer protected contents remain encrypted without the corresponding key chain and KMS authorization.
Enhanced Data Encryption protects data at rest. Because the database processes plaintext during query execution, use TLS connections and database access controls to protect data in transit and control query access.
Key hierarchy
The database encryption layer uses envelope encryption with a three-tier key hierarchy. The two encryption layers describe where encryption is applied, while the key hierarchy describes how encryption keys protect one another. A keyspace is the logical storage namespace for an instance.
Each instance maintains its own internal key chain, and a single DEK can encrypt multiple files. The database encrypts and decrypts data locally using internal keys cached in memory, while calling your cloud KMS to protect and unwrap upper-level keys.
For symmetric keys generated by AWS KMS, plaintext master key material remains within the KMS hardware security module (HSM) boundary. For more information, see Data protection in AWS KMS.
Key authorization on AWS
On AWS, the generated key policy grants the displayed TiDB Cloud principal access to your key under an encryption-context condition containing your organization's External ID. AWS KMS evaluates this condition on cryptographic operations and binds the encryption context to the encrypted key material, requiring the exact same context for decryption.
Because TiDB Cloud derives the External ID from your authenticated organization, requests from another organization carry a different context and are rejected by AWS KMS even if the request includes your key ARN.
The External ID is an organization identifier, not a secret. Preserve the generated Principal, Action, and Condition fields when appending the statements to your key policy. For more information, see Encryption context in the AWS KMS documentation.
Key authorization on Alibaba Cloud
On Alibaba Cloud, cross-account access requires sharing your KMS instance with the displayed TiDB Cloud account through Alibaba Cloud Resource Directory (Resource Sharing), enabling Alibaba Cloud Gateway for that account in the shared list, and appending the generated statements to the key policy of the selected symmetric key.
Like AWS, the generated key policy grants the displayed TiDB Cloud principal access to your key under an encryption-context condition tied to your organization's External ID, preventing other organizations from using your key. Preserve the generated Principal, Action, and Condition fields when appending the statements to your key policy. For more information, see Manage Keys in Alibaba Cloud KMS.
Audit key usage
- Key management in TiDB Cloud: Enable console audit logging to track key management and instance encryption actions in the TiDB Cloud console.
- KMS API activity: On AWS, use AWS CloudTrail to review KMS key operations. Cross-account requests rejected for access denial are logged only in the calling account, and KMS events record key operations rather than individual SQL queries.
- Database access: Enable database audit logging to audit SQL queries and database user activity.
Limitations
- Enhanced Data Encryption for TiDB Cloud Premium supports AWS KMS and Alibaba Cloud KMS.
- A registered key is selectable only within its organization, cloud provider, and region. Cross-region restore of CMEK-protected backups is not supported, and restoring a CMEK-protected TiDB Cloud Premium backup cannot switch to another key.
- Once enabled, CMEK cannot be disabled or replaced with another key on the same instance.
- Exported data and downstream systems are not covered by the instance CMEK and must be encrypted separately.
- Deleting an instance does not remove its retained backup snapshots or their key dependencies. Permanently losing the required key material makes the dependent encrypted data unrecoverable.
Troubleshoot key access verification
- Key registration or verification fails:
- Confirm that the key is a symmetric encryption key in the selected cloud provider and region.
- Confirm that the key is enabled (not disabled or pending deletion) in your cloud KMS.
- Verify that all generated statements were appended to the key policy without modifying the
Principal,Action, orConditionfields. - Alibaba Cloud only: Confirm that the KMS instance is shared with the displayed TiDB Cloud account through Resource Directory (Resource Sharing) and that Alibaba Cloud Gateway is enabled for that account in the shared list.
- Correct the configuration in your cloud KMS and run the access check again.
- Registration succeeds, but instance creation, enablement, or restore fails:
- Review the error message. If your key policy adds restrictions (such as VPC, IP, or service conditions) that block access, update the policy and retry.
- Unresolved issues:
- Contact TiDB Cloud Support with the cloud provider, region, key ARN, operation timestamp, and error message.