devHọc Dev
Bài học

Tuần 2 - Ngày 3: Security Pillar

Tuần 2 – Ngày 3

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

  • Hiểu design principles của Security pillar
  • Nắm vững 6 focus areas của Security
  • Biết các AWS services cho security

1. Định nghĩa Security Pillar

Khả năng bảo vệ data, systems, và assets để tận dụng cloud technologies và cải thiện security posture.

6 Focus Areas

  1. Security Foundations
  2. Identity and Access Management
  3. Detection
  4. Infrastructure Protection
  5. Data Protection
  6. Incident Response

2. Design Principles

1. Implement a strong identity foundation

Best Practice:
- Least privilege access
- Centralized identity management (IAM Identity Center)
- No long-term credentials
- Regular permission review

2. Enable traceability

┌─────────────────────────────────────────────┐│Logging&Monitoring││┌───────────┐┌───────────┐┌─────────┐│││CloudTrail││VPCFlow││Config││││││Logs││││││APIcalls││Network││Changes│││└─────┬─────┘└─────┬─────┘└────┬────┘││└──────────────┼─────────────┘││▼││┌─────────────────┐│││Centralized││││LogAnalysis││││(CloudWatch)│││└─────────────────┘│└─────────────────────────────────────────────┘

3. Apply security at all layers

Edge Security       → CloudFront, WAF, Shield
Network Security    → VPC, Security Groups, NACLs
Compute Security    → EC2 Instance Profile, Inspector
Application         → Secrets Manager, Parameter Store
Data Security       → KMS, S3 Encryption

4. Automate security best practices

  • Security as Code
  • Automated patching
  • Automated response to incidents
  • Compliance checks

5. Protect data in transit and at rest

InTransit:AtRest:┌─────────┐┌─────────┐│TLS││KMS││1.2/1.3││Keys│└─────────┘└─────────┘││HTTPSEncryptedVPN/IPSecStorage

6. Keep people away from data

  • Automate processing
  • Reduce direct access
  • Audit when access is needed

7. Prepare for security events

  • Incident response plan
  • Regular drills
  • Forensic capabilities

3. Security Foundations

Shared Responsibility Model

┌─────────────────────────────────────────────┐│CustomerResponsibility││(SecurityINtheCloud)││-CustomerData││-Platform,Applications,IAM││-OperatingSystem,NetworkConfig││-Client-side&Server-sideEncryption│├─────────────────────────────────────────────┤│AWSResponsibility││(SecurityOFtheCloud)││-Hardware,Software,Networking││-Compute,Storage,Database,Networking││-Regions,AZs,EdgeLocations│└─────────────────────────────────────────────┘

Account Structure

┌─────────────────┐│Management││Account│└────────┬────────┘│┌────────────────────┼────────────────────┐│││▼▼▼┌──────────────┐┌──────────────┐┌──────────────┐│Security││Production││Dev││Account││Account││Account││││││││-GuardDuty││-Workloads││-Sandbox││-Security││-Data││-Testing││Hub│││││└──────────────┘└──────────────┘└──────────────┘

4. Identity and Access Management

IAM Identity Center (AWS SSO)

┌────────────────────────────────────────┐│IAMIdentityCenter││││┌──────────────┐┌──────────────┐│││Built-in││External││││Directory││IdP││││││(Okta,AD)│││└──────┬───────┘└──────┬───────┘││└──────────────────┘│││││▼││┌──────────────────┐│││PermissionSets││││(Roles)│││└──────────────────┘│││││┌───────────────┼───────────────┐││▼▼▼││Account1Account2AccountN│└────────────────────────────────────────┘

Service Control Policies (SCPs)

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyRootUser",
      "Effect": "Deny",
      "Action": "*",
      "Resource": "*",
      "Condition": {
        "StringLike": {
          "aws:PrincipalArn": "arn:aws:iam::*:root"
        }
      }
    }
  ]
}

5. Detection

Detective Controls

ServiceFunction
GuardDutyThreat detection using ML
Security HubAggregated security findings
DetectiveSecurity investigation
InspectorVulnerability assessment
MacieSensitive data discovery
ConfigConfiguration compliance

GuardDuty Findings

FindingTypes:├──EC2Findings│├──UnauthorizedAccess:EC2/SSHBruteForce│└──CryptoCurrency:EC2/BitcoinTool.B├──S3Findings│├──Policy:S3/AccountBlockPublicAccessDisabled│└──Exfiltration:S3/ObjectRead.Unusual└──IAMFindings├──Persistence:IAMUser/AnomalousBehavior└──UnauthorizedAccess:IAMUser/MaliciousIPCaller

Security Hub

┌─────────────────┐│SecurityHub│└────────┬────────┘│┌──────────────┬─────────┼─────────┬──────────────┐│││││▼▼▼▼▼┌────────┐┌────────┐┌────────┐┌────────┐┌────────┐│GuardDuty││Inspector││Macie││Config││Firewall││││││││││Manager│└────────┘└─────────┘└────────┘└────────┘└────────┘Standards:-AWSFoundationalSecurityBestPractices-CISAWSFoundationsBenchmark-PCIDSS

6. Infrastructure Protection

Network Security Layers

┌─────────────────────────────────────────────────────┐│Internet│└───────────────────────┬─────────────────────────────┘│▼┌─────────────────────────────────────────────────────┐│EdgeLayer:CloudFront+WAF+Shield│└───────────────────────┬─────────────────────────────┘│▼┌─────────────────────────────────────────────────────┐│VPCLayer:InternetGateway│└───────────────────────┬─────────────────────────────┘│▼┌─────────────────────────────────────────────────────┐│SubnetLayer:NACL(Stateless)│└───────────────────────┬─────────────────────────────┘│▼┌─────────────────────────────────────────────────────┐│InstanceLayer:SecurityGroups(Stateful)│└─────────────────────────────────────────────────────┘

AWS WAF

WAFRules:├──ManagedRules(AWS,Marketplace)│├──Commonvulnerabilities│├──Knownbadinputs│└──SQLinjection,XSS└──CustomRules├──Ratelimiting├──Geoblocking└──IPwhitelist/blacklist

7. Data Protection

Encryption Strategy

Data StateServiceKey Management
At Rest (S3)SSE-S3, SSE-KMSKMS
At Rest (EBS)EBS EncryptionKMS
At Rest (RDS)RDS EncryptionKMS
In TransitTLS 1.2+ACM

AWS KMS

KeyHierarchy:┌─────────────────────────────────────┐│CustomerMasterKey(CMK)││(neverleavesKMS)│└─────────────────┬───────────────────┘││Encrypts▼┌─────────────────────────────────────┐│DataEncryptionKey││(DEK)│└─────────────────┬───────────────────┘││Encrypts▼┌─────────────────────────────────────┐│YourData│└─────────────────────────────────────┘

Secrets Management

  • Secrets Manager: Automatic rotation, database credentials
  • Parameter Store: Configuration, less frequent rotation

8. Incident Response

Response Automation

Detection→Analysis→Containment(GuardDuty)(Detective)(Lambda+SSM)│││└───────────────────────┴────────────────────┘│EventBridgeRules│▼AutomatedResponse-Isolateinstance-Revokecredentials-Captureforensics

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

  1. Shared Responsibility Model: AWS chịu trách nhiệm gì?

    Xem đáp án

    AWS chịu trách nhiệm "Security OF the cloud": physical security của data centers, hardware, network infrastructure, hypervisor/host OS, managed service software. Khách hàng chịu trách nhiệm "Security IN the cloud": OS (patch, update), applications, data (encryption, access), network configuration (SG, NACL), IAM (users, roles, policies). Shared model thay đổi theo service type: IaaS (EC2) → khách hàng nhiều hơn; SaaS/Managed (RDS, Lambda) → AWS nhiều hơn.

  2. GuardDuty khác Security Hub như thế nào?

    Xem đáp án

    GuardDuty: threat detection service — phân tích VPC Flow Logs, DNS, CloudTrail để tìm anomalies và known threats (compromised credentials, coin mining, port scanning). Tự generate findings. Security Hub: aggregation và compliance service — thu thập findings từ GuardDuty, Inspector, Macie, Config, IAM Access Analyzer, và third-party tools vào một dashboard. GuardDuty detects threats; Security Hub consolidates và prioritizes across services.

  3. Tại sao nên dùng IAM Identity Center thay vì IAM users?

    Xem đáp án

    IAM Identity Center (SSO) cho: (1) Centralized access nhiều AWS accounts từ 1 portal — không cần riêng IAM users per account, (2) Integration với existing IdP (Active Directory, Okta, Azure AD) — dùng corporate credentials, (3) Consistent MFA và access policies across organization, (4) Temporary credentials tự động — không cần manage long-term access keys, (5) Audit trail centralized. IAM users per account = messy với 100+ accounts.

  4. WAF có thể block những loại attacks nào?

    Xem đáp án

    WAF block Layer 7 attacks: SQL injection, XSS (Cross-Site Scripting), CSRF, HTTP flood, bad bots, request smuggling. Dùng managed rule groups (AWS hay third-party) hoặc custom rules. Rate-based rules block volumetric Layer 7 DDoS. Geo-blocking theo country. IP reputation lists. WAF không protect Layer 3/4 (volumetric DDoS) — cần Shield cho đó. WAF deploy trên CloudFront, ALB, API GW, AppSync, Cognito.

  5. Secrets Manager khác Parameter Store như thế nào?

    Xem đáp án

    Secrets Manager: tự động rotation của secrets (built-in support cho RDS, Redshift, DocumentDB, custom Lambda rotator), chi phí $0.40/secret/month. Parameter Store: không có built-in auto-rotation, free (Standard tier), simple key-value. Dùng Secrets Manager cho database credentials cần rotation; Parameter Store cho application config, feature flags, non-rotating secrets. Lambda và ECS tích hợp tốt với cả hai.

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

  • Enable GuardDuty trong account
  • Setup Security Hub
  • Tạo KMS key và encrypt S3 bucket
  • Configure WAF với managed rules

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


Ngày tiếp theo: Reliability Pillar