AWS Data Protection: KMS Encryption, Envelope Encryption, Secrets Manager, Parameter Store and Certificate Manager

AWS Solutions Architect 40 min min read Updated: Nov 17, 2026 Intermediate
AWS Data Protection: KMS Encryption, Envelope Encryption, Secrets Manager, Parameter Store and Certificate Manager
Intermediate Topic 3 of 3

Two Kinds of Encryption

TypeProtectsExamples
At restData stored on disks and in servicesS3 encryption, EBS encryption, RDS encryption, DynamoDB encryption
In transitData moving across a networkHTTPS/TLS, VPN, TLS to RDS

AWS KMS: Key Management Service

AWS KMS creates and controls encryption keys and is integrated with most AWS services. Keys never leave KMS in plain form, and every use is logged in CloudTrail.

Key typeWho managesCostNotes
AWS owned keysAWS (hidden)FreeUsed by default in some services. You cannot see or audit them
AWS managed keys (aws/s3, aws/ebs)AWS creates, you can viewFree per key, small usage chargeRotated automatically on a schedule set by AWS. Cannot change policy
Customer managed keys (CMK)YouMonthly per key plus requestsOwn key policy, enable/disable, rotation, cross-account use, deletion with waiting period
Imported key material / custom key store (CloudHSM)YouHigherStrict compliance needs
Key kindDescription
Symmetric (AES-256)One key encrypts and decrypts. Default. Most AWS services use this. Data never leaves KMS if you call Encrypt directly (up to 4 KB)
Asymmetric (RSA, ECC)Public/private pair. For signing or encrypting outside AWS
HMAC keysGenerate and verify message authentication codes
Multi-Region keysSame key material replicated in several Regions, so you can decrypt in another Region without re-encrypting

Key Policies and Grants

json { "Version": "2012-10-17", "Id": "app-key-policy", "Statement": [ {"Sid": "EnableIAMPolicies", "Effect": "Allow", "Principal": {"AWS": "arn:aws:iam::123456789012:root"}, "Action": "kms:*", "Resource": "*"}, {"Sid": "AllowAppRoleUse", "Effect": "Allow", "Principal": {"AWS": "arn:aws:iam::123456789012:role/AppRole"}, "Action": ["kms:Decrypt", "kms:GenerateDataKey"], "Resource": "*"} ] }
  • The key policy is the main access control for a KMS key. Without the root statement, IAM policies cannot grant access to it
  • A caller needs permission in the key policy (or IAM policy) and often permission on the service (for example S3 plus KMS)
  • Grants give temporary, delegated use of a key (used by services like EBS and RDS)
  • Key rotation: enable automatic yearly rotation for customer managed symmetric keys; the key ID and alias stay the same
bash aws kms create-key --description "app data key" aws kms create-alias --alias-name alias/app-data --target-key-id 1234abcd-12ab-34cd-56ef-1234567890ab aws kms enable-key-rotation --key-id alias/app-data aws kms encrypt --key-id alias/app-data --plaintext fileb://secret.txt --query CiphertextBlob --output text | base64 -d > secret.enc aws kms decrypt --ciphertext-blob fileb://secret.enc --query Plaintext --output text | base64 -d aws kms schedule-key-deletion --key-id alias/old --pending-window-in-days 7 # 7 to 30 days waiting period

Envelope Encryption

KMS directly encrypts only small data (up to 4 KB). For large data AWS uses envelope encryption: a data key encrypts the data, and the KMS key encrypts the data key.

text 1. App asks KMS: GenerateDataKey (using KMS key K) 2. KMS returns: plaintext data key + encrypted data key 3. App encrypts the big file with the plaintext data key, then ERASES it from memory 4. App stores: encrypted file + encrypted data key together To decrypt: send the encrypted data key to KMS (Decrypt) -> plaintext data key -> decrypt the file

S3 Encryption Choices

OptionKey managed byNotes
SSE-S3S3 (AES-256)Default for all new objects. No extra cost
SSE-KMSKMS keyAudit trail in CloudTrail, key policy control. Request costs and KMS quotas apply (use S3 Bucket Keys to reduce them)
DSSE-KMSKMS, two layersDual-layer for strict requirements
SSE-CYou send the key with each requestAWS does not store the key
Client-side encryptionYou, before uploadAWS never sees plain data
bash aws s3api put-bucket-encryption --bucket acme-data --server-side-encryption-configuration '{ "Rules":[{"ApplyServerSideEncryptionByDefault":{"SSEAlgorithm":"aws:kms","KMSMasterKeyID":"alias/app-data"},"BucketKeyEnabled":true}]}' # Deny uploads without HTTPS (bucket policy statement) # "Condition": {"Bool": {"aws:SecureTransport": "false"}} with Effect Deny

Encrypt EBS, RDS and Others

  • EBS: turn on encryption by default per Region. Snapshots of encrypted volumes are encrypted. To encrypt an existing volume: snapshot, copy with encryption, create a new volume
  • RDS: choose encryption when creating the database. You cannot encrypt an existing unencrypted instance directly: snapshot, copy encrypted, restore
  • DynamoDB, SQS, SNS, EFS, Redshift: encryption options built in
bash aws ec2 enable-ebs-encryption-by-default --region ap-south-1 aws ec2 get-ebs-encryption-by-default --region ap-south-1

AWS Secrets Manager

Secrets Manager stores passwords, API keys and database credentials, encrypted with KMS, fetched at runtime by an IAM role. Its main feature is automatic rotation, especially for RDS.

bash aws secretsmanager create-secret --name prod/shop/db --secret-string '{"username":"app","password":"S3cr3t!"}' aws secretsmanager get-secret-value --secret-id prod/shop/db --query SecretString --output text aws secretsmanager rotate-secret --secret-id prod/shop/db --rotation-lambda-arn arn:aws:lambda:ap-south-1:123456789012:function:rotate-db --rotation-rules AutomaticallyAfterDays=30
python import boto3, json client = boto3.client("secretsmanager", region_name="ap-south-1") secret = json.loads(client.get_secret_value(SecretId="prod/shop/db")["SecretString"]) # connect to the database using secret["username"] and secret["password"]

Parameter Store vs Secrets Manager

FeatureSSM Parameter StoreSecrets Manager
PurposeConfiguration values and simple secretsSecrets with lifecycle
CostStandard parameters are freePer secret per month plus API calls
Automatic rotationNo (do it yourself)Yes, built-in for RDS and others
EncryptionOptional SecureString with KMSAlways with KMS
Cross-Region replicationNoYes
Value size4 KB standard, 8 KB advancedUp to 64 KB
bash aws ssm put-parameter --name /shop/prod/api-url --value https://api.example.com --type String aws ssm put-parameter --name /shop/prod/api-key --value abc123 --type SecureString --key-id alias/app-data aws ssm get-parameters-by-path --path /shop/prod/ --with-decryptio

AWS Certificate Manager (ACM)

ACM issues and renews public TLS certificates for free when used with integrated services: ELB, CloudFront, API Gateway. You cannot install ACM public certificates directly on an EC2 instance.

  • Validate by DNS (a CNAME record in Route 53, preferred, enables auto-renew) or by email
  • **CloudFront needs the certificate in us-east-1**. A load balancer needs it in its own Region
  • Use ACM Private CA for internal certificates
bash aws acm request-certificate --domain-name shop.example.com --subject-alternative-names "*.shop.example.com" --validation-method DNS --region us-east-1 aws acm describe-certificate --certificate-arn arn:aws:acm:us-east-1:123456789012:certificate/abcd --query Certificate.DomainValidationOptions

CloudHSM

  • A dedicated hardware security module in your VPC, FIPS 140-2 Level 3, you manage keys and users, AWS cannot see them
  • Use when rules demand sole control of keys. Otherwise KMS is simpler and cheaper
  • Can back a KMS custom key store

Data Protection Checklist

  1. Encrypt by default: S3, EBS, RDS, DynamoDB, EFS, SQS
  2. TLS everywhere: require HTTPS, redirect HTTP, modern TLS policy on load balancers
  3. Customer managed KMS keys for sensitive data, with tight key policies and rotation
  4. No secrets in code, AMIs, environment variables in plain text, or Git. Use Secrets Manager or Parameter Store
  5. Use Macie to find sensitive data in S3, Object Lock for immutability
  6. Control key deletion: use a waiting period and alarms on ScheduleKeyDeletion
  7. Backups are encrypted too

Practice Tasks

  1. Create a customer managed key and an alias, enable rotation, and encrypt a small file with the CLI
  2. Set a bucket to use SSE-KMS with Bucket Keys and test upload from a role that does not have kms:GenerateDataKey
  3. Store a database secret in Secrets Manager and read it from a Lambda or EC2 role
  4. Request an ACM certificate with DNS validation and attach it to a load balancer listener
  5. Turn on EBS encryption by default

Conclusion

Encrypt at rest and in transit. KMS manages keys with key policies and envelope encryption, Secrets Manager stores and rotates secrets, Parameter Store holds configuration, and ACM gives free TLS certificates for ELB, CloudFront and API Gateway. Never put secrets in code, and use roles to read them.

Quick Summary: KMS key types, policy, rotation; envelope encryption; SSE-S3/KMS/C; EBS/RDS encryption; Secrets Manager rotation; Parameter Store compare; ACM DNS validation + us-east-1; CloudHSM.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators