How to Configure AlloyDB Encryption at REST

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up alloydb encryption at rest by selecting a key during cluster creation. Google Cloud encrypts all stored database files with platform keys or customer keys. Most teams rely on default platform keys when they start building a cluster. Later, security rules often push teams to switch to keys they manage themselves. Still, teams often pair strict disk encryption with broad database roles for engineers. When engineers share wide database roles, disk encryption does not protect live data.

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up alloydb encryption at rest by selecting a key during cluster creation. Google Cloud encrypts all stored database files with platform keys or customer keys. Most teams rely on default platform keys when they start building a cluster. Later, security rules often push teams to switch to keys they manage themselves. Still, teams often pair strict disk encryption with broad database roles for engineers. When engineers share wide database roles, disk encryption does not protect live data.

How alloydb encryption at rest works in Google Cloud

Google Cloud encrypts all database data before writing it to disk storage. The platform splits data into chunks and encrypts each chunk with its own key. You do not need to turn on a special setting for basic protection. Platform keys handle this work without any manual setup from your team.

Some teams need direct control over key rotation, location, and destruction. For this need, you can bring customer-managed encryption keys from the cloud key service. You must grant the database service account permission to use your chosen key. Then, you select that key when you create the cluster and its instances.

The key covers active database files, backups, and temporary storage files on disk. If you revoke access to your key, the database stops reading stored blocks. You must also pick a matching key setup for any read pool instances. Cross-region replicas need their own key in the destination region as well. Once you create a cluster with a specific key type, that choice stays permanent. Moving from default keys to customer keys requires a backup restore to a new cluster.

What storage encryption solves and what it leaves open

Storage encryption protects your company if someone steals a physical drive from a data center. It also gives you a kill switch by letting you revoke your encryption key. These controls satisfy core audit checks for data protection on disk drives.

Still, storage encryption only guards data while it sits idle on the disk. The database engine decrypts blocks into memory as soon as a valid user queries them. If an engineer logs in with a broad role, the database returns plain text. Storage keys cannot tell the difference between an app and a human user. They also do not check what an individual SQL query does in flight.

Encryption at Rest + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

A careless script or a curious user can still pull thousands of customer rows. Disk encryption will not block a bad delete statement during an active debugging session. It also will not hide emails, phone numbers, card numbers, or national IDs in results. To close this gap, teams need controls that check queries and users at runtime. You must pair storage keys with strict checks on every live database session.

Managing key lifecycles and admin separation

Good key hygiene requires clear separation between cloud admins and database users. The person who controls the key should not hold broad database login rights. If one admin holds both roles, a single compromised account puts everything at risk. You should place your encryption keys in a separate cloud project from the database.

This split ensures that database admins cannot delete or disable the keys by mistake. You also need a clear plan for regular key rotation schedules. When a key rotates, new data uses the new key version right away. Existing backups and old data blocks keep using the prior version until rewritten. You must keep old key versions active so the cluster can read older data. Disabling an old key version too soon can break restores from past backups.

Check every Postgres query on the wire

Database roles and network rules decide who can open a session. They do not read what each SQL statement does after login. With hoop.dev, you run an open-source proxy, a sidecar for your Postgres, inline in the Postgres wire protocol. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review. Your apps and agents keep their login details and change only the host and port in the connection string their tool uses.

Before a query runs, hoop.dev guardrails refuse bad deletes or drops with a real Postgres error, or hold risky queries for approval. On the way back, hoop.dev data masking rewrites sensitive values in returned rows in memory, and every verdict goes to the audit trail. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and generates evidence for HIPAA, GDPR, and PCI DSS. See the code on GitHub.

Frequently asked questions

Does AlloyDB encrypt database backups at rest too?

Yes, the service encrypts all automated and manual backups on disk by default. You can use default platform keys or assign your own customer-managed key to backups.

Can I switch an existing cluster to customer-managed keys later?

No, you must pick your key management method when you first create the cluster. To switch later, you must restore a backup into a brand new cluster.

Does encryption at rest hide sensitive columns from logged-in engineers?

No, the database decrypts data transparently for any user who logs in and runs queries. You need query controls and data masking to rewrite sensitive fields in query results.

The query runs. The emails stay hidden.