| Automatic Rotation | Manual Rotation | |
|---|---|---|
| Customer Managed Key | ✅ Every year (configurable) | Tạo new key, update alias |
| AWS Managed Key | ✅ Every year (by AWS) | N/A |
| Imported Key Material | ❌ Not supported | Tạo new key, re-import |
| Key ID | Giữ nguyên | Thay đổi |
| Old data | Vẫn decrypt được | Cần giữ old key hoặc re-encrypt |
Year 1: Key version 1 (active)
Year 2: Key version 2 (active), version 1 (decrypt only)
Year 3: Key version 3 (active), version 1+2 (decrypt only)
1. Tạo new KMS key
2. Update alias trỏ đến new key
3. Application dùng alias → tự động dùng new key
4. Giữ old key để decrypt old data
# Update alias to new key
aws kms update-alias \
--alias-name alias/my-app-key \
--target-key-id new-key-id
aws/s3, aws/ebs) KHÔNG thể share cross-account// Key Policy — cho phép Account B dùng key
{
"Effect": "Allow",
"Principal": {"AWS": "arn:aws:iam::222222222222:root"},
"Action": ["kms:Decrypt", "kms:GenerateDataKey"],
"Resource": "*"
}
Exam Tip: Automatic rotation giữ nguyên Key ID. Manual rotation cần alias. Cross-account encryption = CMK only (không dùng AWS managed keys). Imported keys không hỗ trợ automatic rotation.