Ensuring data protection · Topic 4 of 5

Encryption Use Cases, Object Lifecycle and Confidential Computing

Match encryption at rest, in transit and in use to each use case, set Cloud Storage lifecycle and retention rules, and enable Confidential VMs.

  • 5 min
In a nutshell
  • At rest and in transit are encrypted by default; in use needs Confidential Computing.
  • Use CMEK for key control and application-layer encryption for specific fields.
  • Lifecycle rules delete or downgrade objects by age, version or class.

What it is

Data exists in three states, and each needs its own protection. At rest it sits on disk, in transit it moves across a network, and in use it is in memory while being processed. Google encrypts the first two by default; Confidential Computing covers the third.

Lifecycle rules decide how long stored data exists at all, which is also a protection: data that has been deleted cannot leak.

At restdefault, CMEK, EKMIn transitTLS, ALTS, IPsec, MACsecIn useConfidential ComputingLifecycleretain then delete

How it works

Applying encryption methods to use cases

Use caseMethod
Any stored data, no special requirementGoogle default encryption at rest
Control and revoke keys for BigQuery, Cloud Storage, disksCMEK with Cloud KMS
A few sensitive fields inside recordsApplication-layer encryption with Cloud KMS or Tink, or SDP deterministic encryption
Kubernetes Secrets in GKEApplication-layer secrets encryption with a Cloud KMS key
Clients to your appTLS at the load balancer with an SSL policy setting the minimum version
Service to serviceMutual TLS, for example with Cloud Service Mesh
Data center to VPCHA VPN (IPsec) or MACsec for Cloud Interconnect
Data being processed by a third party or in a shared environmentConfidential VMs or Confidential Space

Inside Google's network, traffic between Google services is protected with Application Layer Transport Security (ALTS), and traffic from users to Google services terminates TLS at the Google Front End.

Encrypting at the application layer

When only some values need extra protection, encrypt them before storage with a Cloud KMS key. Use envelope encryption: generate a local data key, encrypt the data with it, and store the data key wrapped by Cloud KMS.

gcloud kms encrypt --key=app-key --keyring=app-ring --location=europe-west1 \
  --plaintext-file=card.txt --ciphertext-file=card.enc

Direct KMS encryption suits small values; the Tink library handles envelope encryption for larger data.

Object lifecycle policies for Cloud Storage

Lifecycle rules apply actions to objects when conditions are met.

ActionExample
DeleteDelete logs older than 365 days
SetStorageClassMove objects to Coldline after 90 days
AbortIncompleteMultipartUploadClean up abandoned uploads
ConditionMeaning
ageDays since the object was created
isLiveFalse for noncurrent versions when versioning is on
numNewerVersionsKeep only a number of older versions
matchesPrefix, matchesStorageClassLimit the rule to some objects
{
  "lifecycle": {
    "rule": [
      {"action": {"type": "SetStorageClass", "storageClass": "COLDLINE"},
       "condition": {"age": 90, "matchesStorageClass": ["STANDARD"]}},
      {"action": {"type": "Delete"}, "condition": {"age": 365}}
    ]
  }
}
gcloud storage buckets update gs://audit-exports --lifecycle-file=lifecycle.json

Lifecycle deletes data; retention keeps it. A retention policy stops deletion or overwrite until objects reach a minimum age, and Bucket Lock makes that policy permanent. Object holds pause deletion for specific objects, and soft delete keeps deleted objects recoverable for a set period.

Confidential Computing

Confidential Computing encrypts data in memory, with keys generated and held by the CPU, so even the host cannot read it.

ProductWhat it protects
Confidential VMA Compute Engine VM with memory encryption using AMD SEV, AMD SEV-SNP or Intel TDX
Confidential GKE NodesGKE nodes running as Confidential VMs
Confidential SpaceA hardened environment where several parties share data with a workload, verified by attestation, without seeing each other's data
Confidential options for data servicesSome services, such as Dataflow and Dataproc, can run workers on Confidential VMs
gcloud compute instances create secure-vm \
  --zone=europe-west4-a --machine-type=n2d-standard-4 \
  --confidential-compute-type=SEV --maintenance-policy=TERMINATE \
  --shielded-secure-boot --shielded-vtpm

Only some machine series support each technology, so choose the type and region first. The organization policy compute.restrictNonConfidentialComputing can require Confidential VMs for listed services.

Attestation proves to a remote party that a workload runs on genuine confidential hardware with the expected software, and is the basis for releasing keys to it.

A worked example

Two banks want to train a fraud model on their combined transactions without either seeing the other's data. The engineer uses Confidential Space: each bank encrypts its data with its own Cloud KMS key and lets only a workload whose attested image matches the agreed one decrypt it, through a workload identity pool with attestation conditions.

The combined results go to a bucket with a 7-year retention policy, locked, and a lifecycle rule moving objects to Archive after one year.

Bank A dataown keyConfidential Spaceattested workloadModel resultsBucketlocked retention, lifecycleBank B dataown keyConfidential Spaceattested workload

How the exam asks about this

  • "Data must remain encrypted while it is being processed in memory." Confidential VMs or Confidential GKE Nodes.
  • "Delete objects automatically 30 days after creation." A lifecycle rule with action Delete and condition age 30.
  • "Records must not be deleted or changed for seven years, even by administrators." A retention policy with Bucket Lock.

What to remember for the exam

  • At rest and in transit are encrypted by default; in use needs Confidential Computing.
  • Use CMEK for key control and application-layer encryption for specific fields.
  • Lifecycle rules delete or downgrade objects by age, version or class.
  • Retention policies with Bucket Lock prevent deletion; lifecycle cannot override them.
  • Confidential VMs use AMD SEV, SEV-SNP or Intel TDX; Confidential Space adds attestation for shared data.
Watch out

Bucket Lock is irreversible. Once locked, the retention period cannot be shortened or removed, and the bucket cannot be deleted until every object has met it.

Common mistakes

Using lifecycle rules for compliance retention. Lifecycle only deletes or moves objects. Stopping deletion needs a retention policy, locked if required.

Choosing CMEK for "encrypted in memory". CMEK protects stored data. Memory encryption is Confidential Computing.

Assuming every machine type is confidential capable. Confidential VM support depends on the machine series and technology, so check before designing.

Check yourself

  • Which product protects data in use on Compute Engine?

    Confidential VM, which encrypts memory with keys held by the CPU using AMD SEV, SEV-SNP or Intel TDX.

  • What does a locked retention policy do?

    It permanently stops objects being deleted or overwritten until they reach the retention age, and the policy cannot be removed.

  • Which lifecycle condition targets old versions when Object Versioning is on?

    isLive set to false, or numNewerVersions, to act on noncurrent versions.

Topic 4 of 5 in Ensuring data protection

Test yourself on Ensuring data protection

The full Google Cloud Professional Cloud Security Engineer question bank has 749 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Google Cloud. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.