Cloud Encryption and Key Management

Protect cloud data at rest and in transit with managed keys, understand envelope encryption and control who can use keys.

Intermediate · about 5 hours · difficulty 3/5

Learn first: Cloud IAM, Symmetric and Asymmetric Encryption

Encryption in the cloud is usually easy to switch on. The real security question is who controls the keys and who can use them.

At rest and in transit

  • At rest: most storage and database services encrypt by default; confirm it and choose the key type.
  • In transit: enforce TLS on endpoints, block plain HTTP to storage, and use private connectivity for internal services where possible.

Key management services

AWS KMS, Azure Key Vault and Google Cloud KMS store keys in hardware-backed systems and log every use.

  • Provider-managed keys: zero effort, but limited control and visibility.
  • Customer-managed keys (CMK): you control the key policy, rotation and can disable the key, which effectively revokes access to the data.
  • Bring or hold your own key (BYOK, HYOK): for strict regulatory needs, with more operational burden.

Envelope encryption

Services encrypt data with a data key, then encrypt that data key with a key encryption key held in KMS. The master key never leaves KMS, and you can revoke access by controlling the master key.

Good practice

  • Separate duties: people who administer keys should not automatically read the data.
  • Enable automatic rotation.
  • Alert on key disabling, deletion scheduling and policy changes.
  • Classify data so the most sensitive stores use customer-managed keys.

Pitfalls

  • Key policies granting kms:* to broad roles, which makes encryption meaningless as an access control.
  • Deleting a key and permanently losing the data it protected.

Good enough to move on: you can create a customer-managed key, use it for a bucket, restrict its policy to one role and show the key usage in audit logs.

Key concepts

  • Encryption at rest and in transit
  • KMS, Key Vault and Cloud KMS
  • Provider vs customer-managed keys
  • Envelope encryption
  • Key policies and separation of duties
  • Rotation and deletion safeguards
  • BYOK and HYOK

Mini project

Create a customer-managed KMS key, use it to encrypt a storage bucket, restrict the key policy to a single role, then show in the audit logs that another role's read attempt failed.

Check yourself

Explain envelope encryption and why the master key never needs to leave the key management service.

Free resources