devHọc Dev
Bài học

Tuần 7 - Ngày 4: Encryption và Compliance

Tuần 7 – Ngày 4

Mục tiêu học tập

  • Nắm các option encryption at rest/in transit của từng service chính
  • Phân biệt KMS vs CloudHSM đúng theo hiện trạng 2026 (cả hai đều FIPS 140-3 L3)
  • Biết các compliance program và tool (Artifact, Config conformance packs, Audit Manager)

1. Encryption at Rest

ENCRYPTIONATRESTOPTIONSS3:SSE-S3(AWSmanaged)SSE-KMS(KMSmanaged)SSE-C(Customerprovided)Client-sideencryptionEBS:KMSencryption(defaultorCMK)RDS/Aurora:KMSencryption(atcreation)DynamoDB:AWSownedCMK(default)CustomermanagedCMKEFS:KMSencryption

2. Encryption in Transit

TLS/SSL everywhere:
- ALB/NLB HTTPS listeners
- CloudFront HTTPS
- RDS SSL connections
- S3 HTTPS endpoints
- API Gateway HTTPS

ACM (AWS Certificate Manager):
- Free public certificates
- Auto-renewal
- Integration with ALB, CloudFront, API GW

3. CloudHSM

CloudHSMvsKMSFeatureKMSCloudHSMManagementAWSmanagedCustomermanagedComplianceFIPS140-3L3FIPS140-3L3(t02/2025;(hsm2m.medium;trưc:140-2hsm1legacy:L3t2023)140-2L3)KeyaccessMulti-tenantSingle-tenantKeycontrolAWSqunlýBngitoànquynHSMfleetkeymaterialAPIAWSKMSAPIPKCS#11,JCE,CNGPricingPerkey/usePerhourIntegrationAWSservicesCustomappsUsecaseMostcasesDedicatedHSM,tqunkey,SQLServerTDE...Lưuý2026:FIPS140-3Level3KHÔNGcònlàđimphânbitKMSvsCloudHSM(chaiđuđt).DifferentiatorthtscaCloudHSM:single-tenantdedicatedHSM,fullcontrolkeymaterial(AWSkhôngtruycpđưc),PKCS#11/JCE/CNGchoapptviết,vàcustomkeystorechoKMS.

4. Compliance Programs

AWS Compliance:
- SOC 1, 2, 3
- PCI DSS Level 1
- HIPAA
- FedRAMP
- GDPR
- ISO 27001, 27017, 27018

Tools:
- AWS Artifact (compliance reports)
- AWS Config (conformance packs)
- AWS Audit Manager (assessment)

5. AWS Artifact

Download compliance reports:
- SOC reports
- PCI reports
- ISO certifications
- Agreements (BAA, GDPR DPA)

Use for:
- Audits
- Due diligence
- Compliance evidence

6. Câu hỏi ôn tập

  1. SSE-S3 vs SSE-KMS vs SSE-C khác nhau như thế nào?

    Xem đáp án

    SSE-S3: AWS quản lý key hoàn toàn (AES-256), mặc định cho object mới, không audit trail per-key. SSE-KMS: key trong KMS — có CloudTrail audit cho key usage, key policy kiểm soát ai decrypt được, có thể dùng customer managed key + rotation; chịu KMS API quota (dùng S3 Bucket Key để giảm call). SSE-C: bạn gửi key trong từng request, AWS không lưu key — hiếm dùng, chỉ khi bắt buộc tự giữ key mà vẫn muốn S3 encrypt. Keyword "audit key usage / control who can decrypt" → SSE-KMS.

  2. Khi nào chọn CloudHSM thay vì KMS?

    Xem đáp án

    Khi cần: (1) single-tenant dedicated HSM — AWS không có quyền truy cập key material, (2) app dùng PKCS#11/JCE/CNG trực tiếp (Oracle TDE, SQL Server TDE, custom crypto, SSL offload), (3) KMS custom key store backed by CloudHSM, (4) yêu cầu contractual "key không do cloud provider quản lý". KHÔNG còn chọn CloudHSM chỉ vì FIPS 140-3 L3 — KMS cũng đạt level này từ 02/2025 (140-2 L3 từ 2023). Với hầu hết use case tích hợp AWS services → KMS.

  3. ACM cấp certificate như thế nào và có giới hạn gì?

    Xem đáp án

    ACM cấp public certificate miễn phí với DNS/email validation, tự động renew — tích hợp ALB/NLB, CloudFront, API Gateway. Giới hạn: certificate không export private key được (bản public); dùng cho CloudFront phải ở us-east-1; không cài lên EC2/on-prem trực tiếp (cần ACM Private CA hoặc certificate exportable trả phí). Keyword "eliminate certificate renewal overhead" → ACM.

  4. AWS Artifact khác AWS Audit Manager như thế nào?

    Xem đáp án

    Artifact: portal download báo cáo compliance của AWS (SOC, PCI, ISO) và ký agreements (BAA cho HIPAA, GDPR DPA) — evidence về phía AWS trong shared responsibility. Audit Manager: tự động thu thập evidence từ chính workload của bạn (Config, CloudTrail, Security Hub) theo framework (PCI, HIPAA...) để chuẩn bị audit phía khách hàng. Đề hỏi "cung cấp SOC 2 report của AWS cho auditor" → Artifact; "tự động thu thập evidence cho internal audit" → Audit Manager.

7. Bài tập thực hành

  1. SSE-KMS + Bucket Key: tạo customer managed KMS key, bucket bật SSE-KMS default encryption với Bucket Key; upload/download object rồi xem CloudTrail event Decrypt — giải thích vì sao Bucket Key giảm chi phí KMS.

  2. Key policy cross-account: viết key policy cho phép account B decrypt (kèm điều kiện kms:ViaService), test từ role account B — hiểu key policy + IAM policy phối hợp thế nào.

  3. ACM + ALB: request public certificate với DNS validation qua Route 53, gắn vào HTTPS listener của ALB, bật security policy TLS 1.3 và verify bằng openssl s_client.


Tài liệu tham khảo chính thức


Ngày tiếp theo: Quiz tổng kết Tuần 7