Professional Cloud Security Engineer
Customer-Managed Encryption Keys (CMEK) allow you to take control of the encryption keys used by Secret Manager. Instead of using Google's default encryption, you create and manage your own keys in Cloud Key Management Service (Cloud KMS). You first create a key ring and a key in the same region as your secret. This gives you control over key rotation schedules and access permissions. If you disable or destroy a CMEK key, any secret encrypted with it becomes inaccessible, which acts as a powerful way to revoke access.
Replication policies are used to meet data residency and compliance rules. The location of your Cloud KMS key must match the region where your secret is stored. For services that work across multiple regions, you might need separate keys for each location. This ensures your sensitive data stays within the geographic boundaries required by your organization's policies or regulations.
Cloud Audit Logs are essential for monitoring and detecting unusual access to your secrets. Cloud KMS logs every encrypt or decrypt request, showing who accessed your data and when. You can set up alerts for suspicious patterns, like many failed decryption attempts, to quickly respond to potential security issues. These logs also provide evidence for compliance with standards like HIPAA.
Key lifecycle management is a key part of using CMEK. When you rotate a key to a new version, secrets encrypted with the old version remain accessible as long as that old version is still enabled. You should not disable the old key version until it is no longer in use. To fully revoke access, you can remove IAM permissions, disable the key, or destroy it. Permission changes happen quickly, but enabling or disabling a key can take up to three hours to fully apply across Google Cloud.
Secret Manager is a central service for storing and accessing sensitive information like passwords and API keys, preventing the need to hardcode them in applications. Access to secrets is controlled through Identity and Access Management (IAM). You assign specific roles, like secretmanager.secretAccessor, to grant only the necessary permissions to users or service accounts. To add more precise rules, you can use IAM Conditions, which can limit access based on attributes like the source network or the time of day.
To add a strong layer of network defense, you integrate Secret Manager with VPC Service Controls. This lets you create a security perimeter around your projects. Inside this perimeter, you can restrict secret access to only come from authorized networks and trusted service accounts. This control blocks requests from outside the perimeter, helping to prevent data exfiltration even if IAM credentials are compromised.
For automation, Secret Manager supports secret rotation. You can also enable secret synchronization for Google Kubernetes Engine (GKE). This feature automatically injects secrets from Secret Manager into your pods as Kubernetes Secrets, ensuring applications always use the latest version without manual updates. For large-scale deployments, you should integrate with tools like Policy Intelligence to find unused permissions and use organization policies to enforce secure practices, such as blocking the creation of less-secure service account keys.
Managing a secret's lifecycle involves setting time-to-live (TTL) durations and expiration schedules. You can configure a mandatory retention delay, called version-destroy-ttl, which forces a waiting period of 1 to 1,000 days before a secret version is permanently deleted. This prevents accidental data loss and systematically retires old credentials. Setting these policies requires the Secret Manager Admin IAM role.
For automated secret rotation, you can design event-driven workflows. Secret Manager can send notifications to a Cloud Pub/Sub topic when it's time to rotate a secret. A Cloud Function triggered by this event can then generate a new secret version, update the system that uses the secret, and disable the old version. This decoupled design makes the rotation process resilient and auditable.
For workloads running in Google Kubernetes Engine (GKE), the Secret Manager add-on automatically synchronizes secrets. It pushes the latest secret versions directly to your running pods, so applications get updated credentials without needing a restart or redeployment. This ensures workload continuity, automates operations, and maintains credential hygiene by phasing out expired keys. To enforce these standards across an organization, you can use organization policy custom constraints to require that all secrets have proper rotation topics and minimum destruction times defined when they are created.
Gauge your current knowledge
Gauge your current knowledge