SkillSprout
Chapter 7 · Lesson 3
Advanced
6 min read

Data Protection: Encryption, ACM, CloudHSM and Macie

Overview

Protecting data means encrypting it at rest and in transit, controlling who can use keys, and knowing where sensitive data lives. AWS Key Management Service (KMS) is the default key service, AWS Certificate Manager (ACM) provisions and renews TLS certificates, CloudHSM provides dedicated hardware modules when you need single-tenant control, and Amazon Macie discovers sensitive data in S3.

Imagine a bank vault. KMS is the managed vault service with audited key checkouts, CloudHSM is your own private vault with only you holding the master key, ACM is the passport office that renews credentials automatically, and Macie is the auditor that walks the shelves looking for documents marked confidential.

In the exam you must choose the right key model (AWS owned, AWS managed, customer managed, external key store), automate certificate and key rotation, and wire alerts for sensitive data findings.

Key Concepts

  • Envelope encryption encrypts data with a data key, which is encrypted by a KMS key; GenerateDataKey returns both the plaintext and encrypted copies.
  • Key types: AWS owned keys, AWS managed keys (aws/s3, rotated yearly), customer managed keys (policy control, optional annual rotation) and imported or external key store keys.
  • A KMS key policy is the primary authority; IAM policies and grants only work if the key policy allows them. Cross-account use needs both sides to allow.
  • Multi-Region keys share key material across Regions so ciphertext is decryptable in a DR Region without re-encrypting.
  • ACM issues public certificates free for integrated services (ALB, CloudFront, API Gateway) and renews them automatically when DNS validation remains in place; ACM Private CA issues internal certificates.
  • CloudHSM gives dedicated FIPS 140-2 Level 3 HSMs in your VPC for customer-controlled keys, SSL offload and PKCS#11/JCE/CNG access; AWS cannot see the keys.
  • Macie uses managed and custom data identifiers to detect PII and credentials in S3 and posts findings to Security Hub and EventBridge.
  • Encryption in transit is enforced with TLS listeners, aws:SecureTransport bucket conditions, and ACM-managed certificates.

Detailed Notes

Choosing a key model

RequirementChoice
Default encryption, no managementAWS owned or AWS managed key
Control the key policy, audit usage, cross-account sharingCustomer managed KMS key
Same key in several Regions for DR or global tablesMulti-Region KMS key
Regulatory demand for dedicated single-tenant HSMCloudHSM (optionally as a KMS custom key store)
Keys must stay outside AWSExternal key store (XKS)
Immediate key deletionNot possible; schedule deletion with a 7-30 day waiting period

Key policy for cross-account use

json
{
  "Sid": "AllowAuditAccountDecrypt",
  "Effect": "Allow",
  "Principal": { "AWS": "arn:aws:iam::999988887777:root" },
  "Action": ["kms:Decrypt", "kms:DescribeKey"],
  "Resource": "*"
}

The consuming account must also grant its role kms:Decrypt on the key ARN. Common pipeline failure: an encrypted AMI, snapshot or S3 object shared to another account fails because the key policy was not shared too.

Rotation and lifecycle

  • Automatic rotation of customer managed keys is optional (configurable period 90-2560 days); old key material remains to decrypt older data and the key ID/ARN does not change.
  • AWS managed keys rotate automatically every year.
  • Imported key material and asymmetric keys need manual rotation by creating a new key and updating an alias.
  • Use aliases so applications reference alias/app-data and switching keys does not need code changes.
bash
aws kms create-key --description "app data" --multi-region
aws kms enable-key-rotation --key-id alias/app-data --rotation-period-in-days 180
aws kms replicate-key --key-id mrk-1234abcd --replica-region us-west-2

Encryption in transit and certificates

ItemACMImported certificate
RenewalAutomatic (DNS validation keeps working)Manual; ACM only sends expiry events
Export private keyPublic certs: noYes, you already have it
Use withALB, NLB TLS, CloudFront, API Gateway, App RunnerSame
RegionRegional; CloudFront needs us-east-1Same

Automate expiry monitoring with the ACM DaysToExpiry metric or the ACM Certificate Approaching Expiration EventBridge event, and use the Config rule acm-certificate-expiration-check. ACM Private CA supports internal TLS and mutual TLS; it integrates with IoT, App Mesh and Kubernetes cert-manager.

Force HTTPS on S3 with a bucket policy:

json
{ "Effect": "Deny", "Principal": "*", "Action": "s3:*",
  "Resource": ["arn:aws:s3:::my-bucket", "arn:aws:s3:::my-bucket/*"],
  "Condition": { "Bool": { "aws:SecureTransport": "false" } } }

Discovering sensitive data with Macie

  1. Enable Macie in the organisation with a delegated administrator.
  2. Configure automated sensitive data discovery (sampling across buckets) or scheduled classification jobs.
  3. Add custom data identifiers (regex and keywords) for internal IDs.
  4. Send findings to Security Hub and EventBridge, then trigger a Lambda to tag, move or lock down the object.

Macie also reports bucket-level posture: public access, unencrypted buckets and shared-outside-organisation buckets.

Defense for data stores

Encrypt EBS, RDS, DynamoDB, EFS and S3 using KMS; enable default encryption at the account level for EBS; require encryption with SCPs or Config rules (encrypted-volumes, rds-storage-encrypted); use S3 Block Public Access at the account and organisation level; and apply S3 Object Lock for write-once protection.

Real World Example

Scenario: a healthcare provider stores patient documents in S3 and must prove encryption and detect accidental PHI exposure. All buckets use SSE-KMS with a customer managed multi-Region key, bucket policies deny non-TLS requests, and an SCP blocks disabling S3 Block Public Access.

Macie runs automated discovery across the organisation. A high-severity finding for an unencrypted bucket containing medical record numbers triggers EventBridge, which invokes a Lambda function to enable default encryption, tag the owner and open a ticket. ACM certificates on all ALBs renew automatically with DNS validation.

Architecture Diagram

Data protection pipeline
Architecture
AWS Cloud
KMS keyMulti-Region
Encrypted S3SSE-KMS + TLS
MacieSensitive data scan
EventBridge
Remediation

Keys, certificates and classification working together.

  1. 1Objects are encrypted at write time with a customer managed KMS key.
  2. 2ACM certificates secure traffic in transit and renew automatically.
  3. 3Macie scans buckets for PII and flags misconfigured buckets.
  4. 4Findings are published to EventBridge and Security Hub.
  5. 5A Lambda or SSM Automation runbook remediates and notifies the owner.

Best Practices

  • ✓Use customer managed keys where you need audit, sharing or custom policy, and reference them through aliases.
  • ✓Enable automatic rotation and alarm on key deletion and disabled keys through CloudTrail events.
  • ✓Keep DNS-validated ACM certificates so renewal is hands-off; alert on imported certificate expiry.
  • ✓Enforce TLS and encryption with bucket policies, SCPs and Config rules.
  • ✓Run Macie organisation-wide and route findings to Security Hub for response.

Common Interview Questions

Exam Tips

DOP-C02 focus

  • "Discover PII in S3 at scale" = Macie.
  • "Dedicated HSM, customer-only key access" = CloudHSM.
  • "Certificate renews itself" = ACM public certificate with DNS validation; CloudFront certificates must be in us-east-1.
  • "KMS key cannot be deleted immediately" - deletion has a 7 to 30 day waiting period; disable first if unsure.

Finished this lesson?

0 of 44 lessons done · 0% of the course