GCP Cloud KMS Key Rotation and Versions
You'll learn how GCP Cloud KMS automates key rotation and manages multiple key versions for continuous encryption security.
Core Concept
Cloud KMS keys don't exist as single, static entities—they're collections of versions over time. Each rotation creates a new primary version while preserving old versions for decrypting previously encrypted data. Think of it like a master key ring where you add a new key periodically, but keep the old ones so you can still unlock historical safes.
Automatic Rotation
You configure a rotation period (e.g., 90 days) when creating or updating a key. Cloud KMS automatically:
- Creates a new key version at the scheduled interval
- Sets it as the primary version (used for all new encryption operations)
- Keeps previous versions enabled for decryption
Configure rotation via:
gcloud kms keys update KEY_NAME \
--location=LOCATION \
--keyring=RING_NAME \
--rotation-period=90d \
--next-rotation-time=2024-06-01T00:00:00Z
Manual Versioning
For granular control, manually create new versions without waiting for automatic rotation:
- Generate a new version on-demand
- Immediately set it as primary or keep it disabled
- Useful for emergency rotation or compliance events
Key Version Lifecycle
Each version progresses through states:
- Enabled (primary): encrypts and decrypts
- Enabled (non-primary): decrypts only
- Disabled: temporarily unusable
- Scheduled for destruction: awaiting 24-hour minimum deletion window
- Destroyed: permanently removed
You cannot skip directly to destruction—the waiting period prevents accidental data loss.
Key Takeaway: GCP Cloud KMS rotation creates new key versions while preserving historical versions, enabling continuous security improvements without breaking access to existing encrypted data.