How to Set up Automatic Key Rotation in GCP
Reduce security risks with automatic key rotation in GCP. Learn how to set up and configure automated key rotation for enhanced security.
Reduce security risks with automatic key rotation in GCP. Learn how to set up and configure automated key rotation for enhanced security.
It’s a good security practice to regularly rotate your keys to mitigate the risk if a key becomes compromised. In GCP, you can either rotate keys manually or by enabling automatic periodic rotations.
While you should do manual rotations if you know a key is compromised, automatic rotations provide a security boost by reducing your risk since your primary keys will not have been in use as long.
In this guide, we’ll show you how to configure automatic key rotation in GCP using the GCP console and the gCloud CLI. To do these steps, you will need the permissions granted by the Cloud KMS Admin role.
You can set up automatic key rotation for existing keys by using either the GCP Console or the gCloud CLI.
You configure automatic key rotation in the GCP Console for existing keys by following these steps:
Just like that, you have enabled automatic key rotations. These automatic rotations do not automatically re-encrypt data that was using a prior key version, so you will need to do this manually when the time comes. We have a guide that shows how to do that here. [link to manual rotation blog]
To run Cloud KMS on the command line, you’ll first need to install the latest version of gCloud CLI. Once you’ve done that, you can run this command to set up automatic key rotation in the gCloud CLI for existing keys:
Here’s is the information you need to specify for each flag:
Here’s an example:
You can also enable automatic key rotation when you are creating new keys.
Here are the steps to enabling automatic key rotation when creating new keys:
Here are the steps to configure automatic key rotation in the gCloud CLI for new keys:
You can create a key with automatic rotations enabled by running the following command:
These are the same flags we described in the CLI section earlier in this post. --rotation-period and --next-rotation-time are the flags that enable automatic rotation.
Here’s an example:
By running this command, you’ll have create a new key with automatic rotation enabled.
Enabling automatic key rotation is a useful way to ensure that your keys are kept up to date. Unfortunately, it doesn’t fully solve the outcomes of key rotation.
You still need to re-encrypt data that relies on prior key versions with your new primary key instead. How about disabling or removing old key versions?
With Blink, you can create automations that extend your flows further. When your keys are rotated automatically, you can trigger a Blink automation that handles re-encrypting files that are using the prior key version and disabling the prior key version.
Blink also allows you schedule disabled keys for destruction after a certain period of time. Ensure that your keys are cleaned up while also giving your team time to validate that you no longer need the old versions.
Get started with Blink today and see how easy it can be to rotate your GCP keys.
Blink is secure, decentralized, and cloud-native. Get modern cloud and security operations today.