# 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. Free notes, key concepts, resources...

Canonical: https://www.internhack.in/roadmaps/tracks/cybersecurity/cloud-encryption-kms
Last updated: 2026-11-28

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](https://www.internhack.in/roadmaps/tracks/cybersecurity/cloud-iam), [Symmetric and Asymmetric Encryption](https://www.internhack.in/roadmaps/tracks/cybersecurity/crypto-fundamentals)

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

- [AWS KMS concepts](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html) (AWS)
- [Azure Key Vault overview](https://learn.microsoft.com/en-us/azure/key-vault/general/overview) (Microsoft Learn)
- [OWASP Key Management Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Key_Management_Cheat_Sheet.html) (OWASP)

Previous: [Misconfiguration Prevention and CSPM](https://www.internhack.in/roadmaps/tracks/cybersecurity/cspm-misconfiguration) · Next: [Endpoint Detection and Response](https://www.internhack.in/roadmaps/tracks/cybersecurity/edr)

## More in Cloud Security

- [Shared Responsibility in the Cloud](https://www.internhack.in/roadmaps/tracks/cybersecurity/shared-responsibility)
- [Cloud IAM](https://www.internhack.in/roadmaps/tracks/cybersecurity/cloud-iam)
- [Cloud Logging and Monitoring](https://www.internhack.in/roadmaps/tracks/cybersecurity/cloud-logging)
- [Misconfiguration Prevention and CSPM](https://www.internhack.in/roadmaps/tracks/cybersecurity/cspm-misconfiguration)
- [Cloud Encryption and Key Management](https://www.internhack.in/roadmaps/tracks/cybersecurity/cloud-encryption-kms)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Cybersecurity Roadmap](https://www.internhack.in/roadmaps/tracks/cybersecurity)
