Data Protection and Encryption
Overview
Encryption scrambles data so only someone with the right key can read it. There are two states to protect: data at rest (stored in S3, EBS, databases) and data in transit (moving over a network). AWS offers services that make both straightforward.
Picture a locked box: the data is the contents, the encryption algorithm is the lock and the key is what opens it. A key management service is like a tightly guarded key vault where keys are stored, rotated and audited, so you never leave them under the doormat.
The exam expects you to recognise which service handles keys (KMS, CloudHSM), secrets (Secrets Manager), and certificates (ACM), and understand when encryption is the customer's choice.
Key Concepts
- AWS Key Management Service (KMS) creates and controls cryptographic keys and integrates with most AWS services (S3, EBS, RDS and more).
- KMS keys can be AWS managed, customer managed (you control policy and rotation) or imported; usage is logged in CloudTrail.
- AWS CloudHSM gives you a dedicated, single-tenant hardware security module (FIPS 140-3 Level 3) that you control.
- AWS Secrets Manager stores and automatically rotates secrets such as database passwords and API keys.
- AWS Systems Manager Parameter Store stores configuration and secrets values at low or no cost, with fewer rotation features.
- AWS Certificate Manager (ACM) provisions and renews public TLS/SSL certificates for services like CloudFront and load balancers.
- Encryption in transit uses TLS; encryption at rest uses services like KMS-backed SSE for S3 or EBS encryption.
- Amazon Macie uses ML to discover and protect sensitive data such as PII in S3.
Detailed Notes
Encryption at rest and in transit
| State | Threat | AWS approach |
|---|---|---|
| At rest | Stolen disks, unauthorised access to storage | S3 server-side encryption, EBS and RDS encryption with KMS |
| In transit | Eavesdropping on the network | HTTPS/TLS endpoints, ACM certificates, VPN |
Amazon S3 now encrypts all new objects by default with SSE-S3, and you can choose SSE-KMS for key-level control and audit.
KMS essentials
- Keys never leave KMS unencrypted; applications ask KMS to encrypt or decrypt (or request a data key via envelope encryption).
- A key policy controls who may use or administer each key.
- Automatic rotation for customer managed keys is supported (default yearly).
- Every use is logged in CloudTrail, supporting audits.
# Create a customer managed key and encrypt a small file
aws kms create-key --description "app-data-key"
aws kms encrypt --key-id alias/app-data-key --plaintext fileb://secret.txt \
--query CiphertextBlob --output text
KMS versus CloudHSM
| Feature | KMS | CloudHSM |
|---|---|---|
| Tenancy | Multi-tenant managed service | Single-tenant dedicated hardware |
| Control | AWS manages hardware; you manage keys and policies | You manage keys and the HSM; AWS cannot access them |
| Integration | Native with 100+ AWS services | Standard APIs (PKCS#11, JCE, CNG) |
| Use when | Most encryption needs | Strict regulatory or contractual need for dedicated HSM |
Secrets and certificates
| Service | Stores | Highlight |
|---|---|---|
| Secrets Manager | DB credentials, API keys | Automatic rotation (for example RDS) |
| Parameter Store | Config values and secrets | Simpler, cheaper, integrates with Systems Manager |
| ACM | TLS certificates | Free public certificates for integrated services; auto-renewal |
Discovering sensitive data
Amazon Macie scans S3 buckets for PII and sensitive data, reports findings and highlights publicly accessible buckets. It supports data classification requirements.
Encryption in transit versus at rest
| State | Meaning | AWS tools |
|---|---|---|
| At rest | Data stored on disk or in a service | KMS-managed keys with S3, EBS, RDS, DynamoDB |
| In transit | Data moving over a network | TLS/HTTPS, ACM certificates, VPN |
| Client-side | Encrypted before upload | AWS Encryption SDK |
Most services let you tick one box to encrypt at rest, but you must decide to do so for many of them; this is part of the customer's security in the cloud.
Customer responsibility
Under shared responsibility, you choose whether to encrypt, which keys to use and who can use them. AWS provides the tools and secure infrastructure; configuring them is up to you.
{
"Effect": "Deny",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::secure-bucket/*",
"Condition": { "Bool": { "aws:SecureTransport": "false" } }
}
This bucket policy statement forces HTTPS by denying any request sent without TLS.
Real World Example
A healthcare start-up stores patient files in S3 and records in RDS. They encrypt both with a customer managed KMS key, so access to the data requires access to the key, and every decryption shows up in CloudTrail for auditors.
Database credentials live in Secrets Manager with 30-day automatic rotation, and the public website uses a free ACM certificate on CloudFront. Macie runs weekly to confirm no unencrypted PII has landed in the wrong bucket.
Architecture Diagram
- 1An application or AWS service asks KMS for a data key.
- 2KMS checks the key policy and IAM permissions, then returns the key.
- 3The service encrypts data and stores only the encrypted version.
- 4CloudTrail records each KMS key use for auditing.
Best Practices
- ✓Encrypt everything at rest and in transit by default.
- ✓Use customer managed KMS keys when you need control over policy, rotation and auditing.
- ✓Keep secrets in Secrets Manager with automatic rotation; never hardcode them.
- ✓Use ACM for TLS certificates so renewals are automatic.
- ✓Use Macie to find sensitive data in S3 and confirm it is protected.
Common Interview Questions
Exam Tips
CLF-C02 focus
- "Create and control encryption keys" = KMS; "dedicated hardware" = CloudHSM.
- "Rotate database passwords" = Secrets Manager.
- "Discover PII in S3" = Macie.
- "TLS certificates" = AWS Certificate Manager.
Finished this lesson?
0 of 43 lessons done · 0% of the course

