Description
Ensure that Cloud SQL instances use a customer-managed encryption key (CMEK) from Cloud Key Management Service (KMS), instead of relying solely on Google-managed default encryption, for encrypting data at rest.
Rationale
Cloud SQL encrypts all data at rest by default using Google-managed keys, but organizations with strict compliance, data sovereignty, or key-lifecycle requirements often need direct control over the encryption key, including the ability to rotate, disable, or destroy it independently of Google. Using CMEK ensures that the organization retains control over the cryptographic key material and can revoke access to data at rest by disabling or destroying the key, which is important for regulatory frameworks that require demonstrable control over encryption keys.
Impact
Gives the organization direct control over the lifecycle of the encryption key protecting database data at rest
Enables the ability to revoke access to data by disabling or destroying the KMS key
Supports compliance requirements that mandate customer-managed encryption keys
Requires careful key management, since destroying the CMEK key renders the instance's data permanently inaccessible
Default Value
By default, new Cloud SQL instances are encrypted at rest using Google-managed encryption keys; CMEK must be explicitly configured at instance creation time.
Pre-Requisites
A Cloud KMS key ring and key created in the same region as the Cloud SQL instance
The Cloud SQL service agent granted the Cloud KMS CryptoKey Encrypter/Decrypter role on the key
IAM permissions to create Cloud SQL instances and manage Cloud KMS keys
Test Plan
Sign in to the Google Cloud Console at https://console.cloud.google.com.
Select the relevant project.
Navigate to Cloud SQL and select the instance to review.
Open the Configuration or Overview section and review the Data Protection / Customer-managed encryption key details.
Verify that the instance shows a customer-managed key rather than Google-managed encryption.
Verify the referenced Cloud KMS key exists, is enabled, and the Cloud SQL service agent has the required Encrypter/Decrypter permission on it.
If the instance uses Google-managed encryption instead of CMEK, follow the implementation steps.
Implementation Steps
Sign in to the Google Cloud Console at https://console.cloud.google.com.
Navigate to Security > Key Management (Cloud KMS) and create a key ring and key in the same region as the target Cloud SQL instance, if one does not already exist.
Grant the Cloud SQL service agent ([email protected]) the Cloud KMS CryptoKey Encrypter/Decrypter role on the key.
Note that CMEK can only be set at instance creation time; it cannot be applied retroactively to an existing instance.
Navigate to Cloud SQL > Create instance.
Configure the instance settings, and under Data Protection / Customer-managed encryption, select Customer-managed and choose the key created above.
Complete the instance creation.
If an existing instance must be converted to CMEK, plan a migration: create a new CMEK-encrypted instance, migrate the data (for example, via export/import or Cloud SQL replication), redirect application connections, and decommission the old instance.
Backout Plan
Sign in to the Google Cloud Console at https://console.cloud.google.com.
Navigate to Cloud SQL and identify the CMEK-encrypted instance.
Because the encryption key cannot be changed on an existing instance, reverting to Google-managed encryption requires creating a new instance without CMEK and migrating data back to it.
Export the data from the CMEK-encrypted instance and import it into a newly created Google-managed-encryption instance.
Redirect application connections to the new instance.
Decommission the CMEK-encrypted instance once the migration is verified.
Reference