devHọc Dev
EN
Bài học

Tuần 1 - Ngày 4: Well-Architected Performance Efficiency, Cost Optimization và Sustainability

Tuần 1 – Ngày 4

Bài này gộp 3 chủ đề: Performance Efficiency Pillar, Cost Optimization Pillar, Sustainability Pillar (Trụ cột Bền vững).

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

  • Hiểu design principles của Performance Efficiency
  • Nắm vững 5 focus areas và các selection strategies cho resources
  • Biết cách optimize performance trên AWS
  • Hiểu design principles của Cost Optimization
  • Nắm vững các pricing models và cách tối ưu
  • Biết tools và techniques để manage costs
  • Hiểu design principles của Sustainability Pillar và vị trí của nó trong 6 pillars
  • Nhận diện các pattern giảm tác động môi trường: Graviton, serverless, lifecycle, region selection
  • Biết các tool đo lường (Customer Carbon Footprint Tool, Compute Optimizer) và exam keyword liên quan

Phần 1: Performance Efficiency Pillar

1. Định nghĩa Performance Efficiency Pillar

Khả năng sử dụng computing resources hiệu quả để đáp ứng system requirements và duy trì efficiency khi demand thay đổi và technologies evolve.

5 Focus Areas (best practice areas, bản whitepaper hiện hành)

  1. Architecture selection — chọn pattern và service phù hợp (đánh giá option, dùng managed service, quyết định dựa trên data/benchmark)
  2. Compute and hardware — instance type/family, Graviton, accelerator, container vs serverless, elasticity
  3. Data management — chọn data store theo access pattern (relational, key-value, in-memory, analytics), caching, partitioning
  4. Networking and content delivery — vị trí (Region, Local Zones), CloudFront, Global Accelerator, giao thức, load balancing
  5. Process and culture — KPI hiệu năng, load test, monitoring, review định kỳ khi có service/instance mới

Bản whitepaper cũ chia thành Selection / Review / Monitoring / Trade-offs. Các ý đó vẫn còn nhưng đã được gộp vào 5 area trên (Review và Monitoring nằm trong Process and culture; Trade-offs nằm rải rác, đặc biệt ở Data management với caching và consistency).

2. Design Principles

1. Democratize advanced technologies

Trước:                          Sau (AWS):
- Hire ML experts               - Use SageMaker
- Build infrastructure          - Use managed services
- Maintain and update           - AWS handles it

→ Focus on business value, not infrastructure

2. Go global in minutes

Deploygloballywithafewclicks:┌─────────────┐┌─────────────┐┌─────────────┐│us-east-1││eu-west-1││ap-southeast││┌───┐││┌───┐││┌───┐│││App││││App││││App│││└───┘││└───┘││└───┘│└─────────────┘└─────────────┘└─────────────┘│││└───────────────┴───────────────┘│CloudFrontCDN│EndUsers

3. Use serverless architectures

  • No server management
  • Automatic scaling
  • Pay for value

4. Experiment more often

  • Easy to test new configurations
  • A/B testing
  • Compare performance

5. Consider mechanical sympathy

Hiểu cách resources hoạt động để sử dụng hiệu quả nhất

Ví dụ:

  • SSD vs HDD cho random I/O
  • GPU vs CPU cho ML workloads
  • Memory-optimized vs Compute-optimized

3. Compute Selection

Decision Tree

┌─────────────────┐│Computeneeded?│└────────┬────────┘│┌─────────────────┼─────────────────┐│││▼▼▼┌──────────┐┌──────────┐┌──────────┐│Virtual││Container││Serverless││Machines│││││└────┬─────┘└────┬─────┘└────┬─────┘│││▼▼▼EC2,LightsailECS,EKS,Lambda,FargateFargate

EC2 Instance Type Selection

WorkloadInstance FamilyWhy
Web serversM (General)Balanced
Batch processingC (Compute)High CPU
In-memory cacheR (Memory)High RAM
Data warehouseI (Storage)High I/O
Machine LearningP, GGPU
Variable loadT (Burstable)Cost-effective

Lambda Optimization

Memory↑=CPU↑=Cost↑=Duration↓┌─────────────────────────────────────────────┐│Memory:128MB→Duration:10s→Cost:$X││Memory:512MB→Duration:3s→Cost:$X││Memory:1024MB→Duration:1.5s→Cost:$X│└─────────────────────────────────────────────┘→Testtofindoptimalmemorysetting→UseAWSLambdaPowerTuning

4. Storage Selection

Storage Decision Matrix

CharacteristicS3EBSEFSFSx
AccessObjectBlockFileFile
Latencymssub-msmssub-ms
Durability11 9s99.999%11 9svaries
SharingUnlimitedSingle EC2Multi EC2Multi EC2

EBS Volume Types

PerformanceRequirements:HighIOPS(Database):├──io2(BlockExpress):Upto256,000IOPS,4,000MiB/s,64TiB│(từ04/2025mọiio2đềulàBlockExpress—khôngcòn"io2thường")└──io1:Upto64,000IOPS,1,000MiB/s,16TiBHighThroughput(BigData):├──st1:Upto500MB/s└──sc1:Upto250MB/sGeneralPurpose:└──gp3:Upto80,000IOPS,2,000MiB/s,64TiB(09/2025)

S3 Performance Optimization

Baseline: 3,500 PUT + 5,500 GET per prefix per second

Strategies:
1. Use multiple prefixes
   bucket/images/user1/
   bucket/images/user2/
   → Each prefix = separate throughput

2. S3 Transfer Acceleration
   → Use CloudFront edge for uploads

3. Multi-part upload
   → Parallel upload chunks

4. Byte-range fetches
   → Parallel download chunks

5. Database Selection

Database Decision Tree

┌─────────────────┐│DataStructure│└────────┬────────┘│┌───────────────────┼───────────────────┐│││▼▼▼RelationalKey-ValueDocument│││▼▼▼RDS,AuroraDynamoDBDocumentDB

Database Performance Patterns

PatternSolutionUse Case
Read replicasAurora, RDSRead-heavy
CachingElastiCacheFrequent reads
ShardingDynamoDBHigh throughput
Connection poolingRDS ProxyMany connections

Caching Strategy

┌─────────────────────────────────────────────┐│Cache-AsidePattern││││Application││││││1.Readfromcache││▼││┌────────┐Miss┌────────┐│││Cache│────────►│Database││││(Redis)│2.Read└───┬────┘││└────────┘│││▲│3.Returndata││││││└──────────────────┘││4.Storeincache│└─────────────────────────────────────────────┘

6. Network Selection

CloudFront Optimization

UserRequest│▼EdgeLocation(closest)│├──CacheHit?→Returncachedcontent│└──CacheMiss→OriginFetch│┌─────┴─────┐││S3OriginCustomOrigin(ALB,EC2)

Global Accelerator vs CloudFront

FeatureCloudFrontGlobal Accelerator
ContentStatic + DynamicTCP/UDP traffic
CachingYesNo
Use caseWeb contentGaming, IoT, VoIP
Entry pointsEdge locationsEdge locations

VPC Optimization

Within Region:
- Use VPC Endpoints for AWS services
- Avoid NAT Gateway when possible
- Use Placement Groups for low latency

Cross Region:
- Use Transit Gateway
- Consider AWS backbone vs internet

7. Monitoring Performance

Key Metrics

LayerMetrics
ComputeCPU, Memory, Network
StorageIOPS, Throughput, Latency
DatabaseConnections, Query time
NetworkLatency, Packet loss
ApplicationResponse time, Error rate

CloudWatch Dashboards

┌─────────────────────────────────────────────┐│PerformanceDashboard│├──────────────┬──────────────┬───────────────┤│EC2CPU│RDSIOPS│ALBLatency││████████│████│████████││70%│5000│150ms│├──────────────┼──────────────┼───────────────┤│Lambda│S3Requests│CloudFront││Duration││HitRatio││████│████████│████████████││200ms│10K/min│95%│└──────────────┴──────────────┴───────────────┘

8. Trade-offs

Performance vs Cost

Higher Performance = Higher Cost

Example decisions:
- Provisioned IOPS vs GP3
- Reserved capacity vs On-demand
- More memory (Lambda) vs longer duration

Consistency vs Latency

Strong Consistency:
- Higher latency
- Data always current
- Example: Financial transactions

Eventual Consistency:
- Lower latency
- Data may be stale
- Example: Social media feeds

Phần 2: Cost Optimization Pillar

1. Định nghĩa Cost Optimization Pillar

Khả năng chạy systems để deliver business value với giá thấp nhất.

5 Focus Areas

  1. Practice Cloud Financial Management
  2. Expenditure and Usage Awareness
  3. Cost-Effective Resources
  4. Manage Demand and Supply Resources
  5. Optimize Over Time

2. Design Principles

1. Implement Cloud Financial Management

TraditionalIT:Cloud:┌─────────────────┐┌─────────────────┐│CapExupfront││OpExmonthly││Fixedcapacity││Variable││Longplanning││Agile│└─────────────────┘└─────────────────┘→Newskillsneeded:FinOps

2. Adopt a consumption model

Payonlyforwhatyouuse:On-Premises:AWS:┌────────────────┐PeakTraffic│████████████████│┌───┐│████████████████││││████████████████│→││AutoScale│████████████████│││││Idlecapacity│└───┘│└────────────────┘└───────┘AlwayspayingPayperuse

3. Measure overall efficiency

Business Metrics:
- Cost per transaction
- Cost per user
- Cost per revenue dollar

Not just:
- Total AWS bill

4. Stop spending money on undifferentiated heavy lifting

BuildvsBuy:┌───────────────────────────────────────────────┐│Don'tBuild:│Build:││-Databaseengines│-Businesslogic││-MLplatforms│-Uniquefeatures││-Monitoringtools│-Competitive││-Securitytools│advantages│└───────────────────────────────────────────────┘

5. Analyze and attribute expenditure

TaggingStrategy:┌─────────────────────────────────────────────┐│ResourceTags││││Environment:Production││Project:WebApp││CostCenter:Engineering││Owner:team-a@company.com│└─────────────────────────────────────────────┘→Enablecostallocationbytags→Generatereportsperproject/team

3. AWS Pricing Models Deep Dive

EC2 Pricing Comparison

Cost Comparison (minh hoạ, số làm tròn — % so với On-Demand):

On-Demand:          ████████████████████████  100%
1yr Standard RI:    ███████████████           ~60%  (giảm ~40%)
3yr Standard RI:    ███████                   ~28%  (giảm tới 72%)
Compute SP (3yr):   ████████                  ~34%  (giảm tới 66%)
Spot Instance:      ███                       ~10-30% (giảm tới 90%)

Bộ số này dùng thống nhất toàn khoá — chi tiết ở Tuần 3 Ngày 1 (Phần 1).

Reserved Instance vs Savings Plans

AspectReserved InstanceSavings Plans
CommitmentSpecific instance$ amount/hour
FlexibilityLimitedHigh
ServicesEC2, RDS, etc.EC2, Lambda, Fargate
DiscountUp to 72%Up to 72%
Best forStable workloadsFlexible workloads

Savings Plans Types

Compute Savings Plans:
- Most flexible
- Apply to EC2, Lambda, Fargate
- Any region, instance family, OS
- Up to 66% discount

EC2 Instance Savings Plans:
- Specific instance family in a region
- Any size, tenancy, OS within family
- Up to 72% discount

SageMaker Savings Plans:
- Specific to SageMaker
- Up to 64% discount

Spot Instances Strategies

Strategy0:price-capacity-optimized(AWSKHUYẾNNGHỊ)-Chọnpoolcócapacitydồidàonhất,rồilấypoolrẻnhấttrongsốđó-Cânbằnggiávàrủirointerruption→mặcđịnhnênchọn-(chitiết5allocationstrategyởTuần3Ngày1,Phần1)Strategy1:DiversifiedAllocation┌─────────────────────────────────────────────┐│SpotFleet││││c5.large(30%)││c5.xlarge(20%)││m5.large(25%)││m5.xlarge(25%)││││→Reducesinterruptionrisk│└─────────────────────────────────────────────┘Strategy2:Capacity-Optimized-AWSselectspoolswithmostcapacity-LowerchanceofinterruptionStrategy3:LowestPrice-Lowestcostbuthigherinterruptionrisk

4. Storage Cost Optimization

S3 Cost Analysis

Storage Costs (per GB/month, us-east-1):
Standard:            $0.023  ████████████████████████
Intelligent-Tiering: $0.023  ████████████████████████ (auto-optimize)
Standard-IA:         $0.0125 █████████████
One Zone-IA:         $0.01   ██████████
Glacier Instant:     $0.004  ████
Glacier Flexible:    $0.0036 ███
Glacier Deep:        $0.00099 █

S3 Lifecycle Optimization

{
  "Rules": [{
    "ID": "Optimize-Costs",
    "Status": "Enabled",
    "Transitions": [
      {"Days": 30, "StorageClass": "STANDARD_IA"},
      {"Days": 90, "StorageClass": "GLACIER"},
      {"Days": 365, "StorageClass": "DEEP_ARCHIVE"}
    ],
    "NoncurrentVersionTransitions": [
      {"NoncurrentDays": 30, "StorageClass": "GLACIER"}
    ],
    "NoncurrentVersionExpiration": {
      "NoncurrentDays": 90
    }
  }]
}

EBS Cost Optimization

gp2vsgp3:┌─────────────────────────────────────────────┐│gp2(100GB):││$10/month+IOPStiedtosize││││gp3(100GB):││$8/month+independentIOPSconfig││││→gp3is20%cheaperbaseline││→gp3allowsmoreIOPSwithoutmorestorage│└─────────────────────────────────────────────┘Actions:-Migrategp2→gp3-DeleteunusedEBSvolumes-Deleteoldsnapshots

5. Database Cost Optimization

RDS Optimization

1. Right-size instances
   - Use Performance Insights
   - Check CPU/Memory utilization

2. Reserved Instances
   - 1-year or 3-year commitment
   - Up to 69% discount

3. Aurora Serverless v2
   - Auto-scales 0 ACU to 256 ACU
     (min 0 ACU auto-pause từ 11/2024;
      trước đó min 0.5, max 128)
   - Pay per ACU-hour

4. Read Replicas
   - Offload reads from primary
   - May reduce primary instance size

DynamoDB Cost Modes

On-Demand:
- Pay per request
- No capacity planning
- Good for: Unpredictable traffic

Provisioned:
- Provision RCU/WCU
- Lower cost if predictable
- Can use Reserved Capacity

Reserved Capacity:
- Upfront payment
- Up to 77% discount
- 1-year or 3-year

6. Cost Management Tools

AWS Cost Explorer

Features:
- Visualize costs over time
- Forecast future spending
- Identify cost drivers
- Savings Plans recommendations

Reports:
- Monthly costs by service
- Daily costs
- Reserved Instance utilization
- Savings Plans utilization

AWS Budgets

BudgetTypes:┌─────────────────────────────────────────────┐│CostBudget:││Alertwhenspendingexceeds$1000││││UsageBudget:││AlertwhenEC2hoursexceed1000││││ReservationBudget:││AlertwhenRIutilization<80%││││SavingsPlansBudget:││AlertwhenSPutilization<80%│└─────────────────────────────────────────────┘Actions:-SendSNSnotification-RunLambdafunction-ApplySCPorIAMpolicy

AWS Cost Anomaly Detection

ML-powereddetection:┌─────────────────────────────────────────────┐│Normalspendingpattern││││████████████████████████││████████████████████████││▲│││Anomalydetected!│││││████████████││████████████││││→Alert:EC2spend300%higherthannormal│└─────────────────────────────────────────────┘

Trusted Advisor

Cost Optimization Checks:
- Idle EC2 instances
- Underutilized EBS volumes
- Unassociated Elastic IPs
- Idle RDS instances
- Low utilization EC2
- Reserved Instance optimization

7. Right-Sizing

Process

1.Collectmetrics(CloudWatch)│▼2.Analyzeutilization-CPU<40%?Downsize-Memory<40%?Downsize│▼3.Testsmallerinstance│▼4.Monitorafterchange│▼5.Repeatregularly

Tools

  • Compute Optimizer: ML recommendations
  • Cost Explorer: Right-sizing recommendations
  • CloudWatch: Custom metrics analysis

Phần 3: Sustainability Pillar (Trụ cột Bền vững)

Tổng quan

Sustainability Pillar là trụ cột thứ 6 được AWS thêm vào Well-Architected Framework năm 2021, tập trung vào việc giảm thiểu tác động môi trường của workloads.

┌─────────────────────────────────────────────────────────────┐│SUSTAINABILITYPILLAR││││"Minimizeenvironmentalimpactofrunning││cloudworkloads"││││6BestPracticeAreas:││├──Regionselection││├──Alignmenttodemand││├──Softwareandarchitecture││├──Datamanagement││├──Hardwareandservices││└──Processandculture│└─────────────────────────────────────────────────────────────┘

Design Principles

1. Understand Your Impact

Đo lường và hiểu tác động của workload:
- Sử dụng AWS Customer Carbon Footprint Tool
- Monitor resource utilization metrics
- Track energy consumption patterns

2. Establish Sustainability Goals

Thiết lập mục tiêu bền vững:
- Define sustainability KPIs
- Set improvement targets
- Regular progress reviews

3. Maximize Utilization

Tối đa hóa sử dụng tài nguyên:
- Right-size resources
- Avoid over-provisioning
- Use Auto Scaling effectively

4. Anticipate and Adopt New, More Efficient Hardware and Software Offerings

Liên tục đánh giá và chuyển sang công nghệ hiệu quả hơn:
- Graviton processors (hiệu năng/watt tốt hơn)
- Instance generation mới, accelerator chuyên dụng (Inferentia, Trainium)
- Thiết kế đủ linh hoạt để đổi nhanh khi có offering mới

5. Use Managed Services

Chia sẻ hạ tầng để tăng utilization trung bình:
- Serverless (Lambda, Fargate), managed DB/analytics
- AWS tối ưu vận hành và utilization ở quy mô lớn
- Ví dụ: S3 Lifecycle, Auto Scaling, Fargate thay EC2 tự quản

6. Reduce the Downstream Impact of Your Cloud Workloads

Giảm năng lượng/tài nguyên khách hàng cần để dùng dịch vụ:
- Giảm kích thước payload, nén dữ liệu, cache ở edge
- Giảm nhu cầu khách hàng phải nâng cấp thiết bị
- Đo và test tác động phía client (device farm)

Đây là đúng 6 design principles trong whitepaper chính thức. Phân biệt với 6 best practice areas ở sơ đồ trên (Region selection, Alignment to demand, ...).

Best Practices

1. Region Selection

┌─────────────────────────────────────────────────────────────┐│REGIONSUSTAINABILITY││││Factorstoconsider:││├──Carbonintensityofpowergrid││├──Renewableenergyavailability││├──Dataresidencyrequirements││└──Latencytousers││││AWSSustainabilityRegions:││-Stockholm(eu-north-1):100%renewable││-Ireland(eu-west-1):100%renewable││-Frankfurt(eu-central-1):Highrenewable%│└─────────────────────────────────────────────────────────────┘

2. Compute Optimization

┌─────────────────────────────────────────────────────────────┐│EFFICIENTCOMPUTE││││Option│EnergyEfficiency││─────────────────┼─────────────────────││Graviton│Upto60%moreefficient││Fargate│Shared,optimizedinfra││Lambda│Payperuse,noidle││SpotInstances│Usesparecapacity││AutoScaling│Matchdemand,avoidwaste│└─────────────────────────────────────────────────────────────┘GravitonProcessors:-ARM-based,designedbyAWS-Betterperformanceperwatt-Supportedbymostservices-Lowercost+lowercarbon

3. Storage Optimization

DataLifecycleManagement:┌────────────────────────────────────────────────────────────┐│││HOTDATA→WARMDATA→COLDDATA→DELETE││(S3Standard)(S3IA)(Glacier)││││Strategies:││-S3Lifecyclepolicies││-Intelligent-Tiering││-Deleteunuseddata││-Compressdata││-Useefficientformats(Parquet,ORC)│└────────────────────────────────────────────────────────────┘

4. Data Transfer Optimization

MinimizeDataMovement:├──UseCloudFrontcaching├──Compressbeforetransfer├──Batchoperations├──Chooseregionsclosetousers└──UseVPCEndpoints(avoidNAT)

5. Development Practices

SustainableDevelopment:├──Efficientalgorithms├──Optimizedcode├──Removedeadcode├──Usecompiledlanguageswhenpossible├──Asyncprocessingfornon-urgenttasks└──Cachefrequentlyaccesseddata

AWS Tools for Sustainability

1. Customer Carbon Footprint Tool

Dashboard showing:
- Carbon emissions by service
- Emissions by region
- Historical trends
- Forecast emissions

Access: AWS Billing Console → Carbon Footprint

2. Compute Optimizer

Recommendations for:
- EC2 instances (right-sizing)
- EBS volumes
- Lambda functions
- Auto Scaling groups

3. Cost Explorer

Identify waste:
- Unused resources
- Idle instances
- Over-provisioned services

Sustainability Metrics

┌─────────────────────────────────────────────────────────────┐│KEYMETRICS││││ResourceEfficiency:││├──CPUutilization%││├──Memoryutilization%││└──Storageutilization%││││EnvironmentalImpact:││├──Carbonemissions(tCO2e)││├──Energyconsumption(kWh)││└──Resourcespertransaction││││Optimization:││├──Right-sizingsavings││├──Idleresourcereduction││└──Datareductionfromlifecycle│└─────────────────────────────────────────────────────────────┘

Exam Tips

Khi gặp câu hỏi về Sustainability:

1. EFFICIENCY FIRST
   - Right-size resources
   - Use Auto Scaling
   - Avoid over-provisioning

2. GRAVITON PROCESSORS
   - Better energy efficiency
   - Lower cost
   - ARM-based workloads

3. SERVERLESS = SUSTAINABLE
   - Lambda, Fargate
   - No idle resources
   - Pay only for what you use

4. DATA MANAGEMENT
   - Lifecycle policies
   - Delete unused data
   - Compress and optimize

5. MANAGED SERVICES
   - AWS optimizes infrastructure
   - Better utilization
   - Shared resources

Tóm tắt 6 Pillars

┌─────────────────────────────────────────────────────────────┐│WELL-ARCHITECTEDFRAMEWORK││6PILLARS││││1.OperationalExcellence││→Automate,Document,Learn││││2.Security││→Protectdata,Leastprivilege││││3.Reliability││→Recoverfromfailures││││4.PerformanceEfficiency││→Useresourcesefficiently││││5.CostOptimization││→Avoidunnecessarycosts││││6.Sustainability││→Minimizeenvironmentalimpact│└─────────────────────────────────────────────────────────────┘

Câu hỏi ôn tập

  1. "Mechanical sympathy" nghĩa là gì?

    Xem đáp án

    Hiểu cách hardware và software hoạt động ở low level để chọn đúng tools. Ví dụ: CPU cache lines → data locality (DynamoDB partition key design), disk seek patterns → sequential vs random I/O (HDD vs SSD vs NVMe), network latency → batch requests thay vì individual calls. Trong cloud: hiểu instance families (compute/memory/storage-optimized) để chọn đúng, hiểu storage I/O patterns để chọn EBS type đúng.

  2. Khi nào nên dùng io2 vs gp3 cho EBS?

    Xem đáp án

    io2 (Block Express): cần sub-millisecond latency ổn định, durability 99.999%, Multi-Attach (io1/io2), hoặc > 80,000 IOPS trên một volume (gp3 max từ 09/2025) — điển hình database tier khắt khe (Oracle, SQL Server, SAP HANA). gp3: hầu hết production workloads, boot volumes; IOPS cấu hình 3,000-80,000 và throughput tới 2,000 MiB/s độc lập với size. gp3 rẻ hơn io2 đáng kể — dùng io2 chỉ khi performance requirements vượt gp3 capabilities.

  3. S3 có thể xử lý bao nhiêu requests per prefix?

    Xem đáp án

    3,500 PUT/COPY/POST/DELETE + 5,500 GET/HEAD per prefix per second. Prefix trong S3 là phần của key path trước slash cuối. Để scale beyond single prefix: sử dụng multiple prefixes (random prefix hoặc hash-based prefix) để distribute requests. Ví dụ: user-photos/2024/01/ và user-photos/2024/02/ là 2 prefixes riêng biệt — không share request limit.

  4. CloudFront khác Global Accelerator như thế nào?

    Xem đáp án

    CloudFront: caches content tại Edge Locations, tối ưu cho cacheable HTTP/HTTPS (static assets, video). Global Accelerator: anycast IPs, không cache, tối ưu cho dynamic/non-cacheable traffic (APIs, gaming, IoT, any TCP/UDP). GA cũng hỗ trợ HTTP nhưng không cache. Cả hai dùng AWS edge network — GA cho low-latency routing, CloudFront cho caching + edge compute. GA cung cấp static IPs (hữu ích cho firewall whitelisting).

  5. Cache-aside pattern hoạt động như thế nào?

    Xem đáp án

    Application code handle caching: (1) Read: check cache → if hit: trả từ cache, if miss: fetch từ DB → store vào cache với TTL → trả cho client. (2) Write: write vào DB → invalidate cache entry (hoặc update cache). Application tự quản lý cache — flexible nhưng thêm code. Ngược với Write-through (write tự động update cache) hay Read-through (cache tự fetch từ DB khi miss). Cache-aside phổ biến nhất với ElastiCache Redis.

  6. Compute Savings Plans khác EC2 Instance Savings Plans như thế nào?

    Xem đáp án

    Compute SP: flexible nhất — apply cho EC2 (bất kỳ family/region/OS), Lambda, Fargate. Discount ~66%. EC2 Instance SP: chỉ cho EC2, committed cho một instance family trong một Region cụ thể. Discount cao hơn ~72% nhưng ít flexible hơn. Chọn Compute SP khi có mixed workloads (EC2 + Lambda + Fargate) hoặc cần flexibility thay đổi instance family; EC2 Instance SP khi workload EC2 ổn định và rõ ràng.

  7. S3 Intelligent-Tiering hoạt động như thế nào?

    Xem đáp án

    S3 monitor access frequency của từng object. Object không được access trong 30 ngày → tự động move xuống Infrequent Access tier (giảm storage cost). Nếu được access → move lại Frequent Access ngay. Có thể opt-in thêm Archive tiers (90 ngày, 180 ngày). Không có retrieval fee khi move giữa Frequent/Infrequent tiers. Có monitoring fee (~$0.0025/1000 objects/month) — không worth it cho objects nhỏ (<128 KB, không monitor).

  8. gp3 có ưu điểm gì so với gp2?

    Xem đáp án

    gp3: (1) Rẻ hơn ~20% for same storage size, (2) IOPS độc lập với size — 3,000 IOPS baseline kể cả volume 1 GB (gp2 chỉ có 3 IOPS/GB), (3) Provisioned IOPS lên đến 80,000 và throughput 2,000 MiB/s (từ 09/2025; baseline 3,000 IOPS / 125 MiB/s) không cần tăng size, (4) Không bị "burst credit" mechanism phức tạp như gp2. Migrate từ gp2 sang gp3 không có downtime — dùng Elastic Volume modification.

  9. AWS Budgets có thể thực hiện actions gì?

    Xem đáp án

    Budget Actions (tự động): (1) Apply IAM policy — giới hạn quyền deploy resources khi budget hit, (2) Attach SCP — block actions ở Organizations level, (3) Target specific EC2/RDS instances — stop instances. Alerts (thông báo): email notifications, SNS topics. Budget Actions giúp enforce cost controls tự động — không cần manual intervention khi budget bị vượt. Kết hợp với SNS → Lambda để custom actions.

  10. Right-sizing nên dựa trên metrics nào?

Xem đáp án

(1) CPU utilization — EC2 CPU < 40% sustained → downsize instance type, (2) Memory utilization — dùng CloudWatch Agent, (3) Network throughput — bandwidth needs, (4) Disk IOPS/throughput — EBS metrics, (5) Application-level metrics — response time, error rate. AWS Compute Optimizer analyze 14 ngày metrics và recommend optimal instance type với performance + cost trade-offs. Tránh right-size dựa trên peak only — look at P95/P99 và average.

  1. Kể tên các design principles của Sustainability Pillar.
Xem đáp án

6 principles: (1) Understand your impact — đo lường bằng Customer Carbon Footprint Tool, (2) Establish sustainability goals — KPI và target cải thiện, (3) Maximize utilization — right-size, tránh over-provisioning, (4) Anticipate and adopt new, more efficient offerings — Graviton, instance generation mới, (5) Use managed services — shared infrastructure có utilization cao hơn, (6) Reduce the downstream impact — giảm năng lượng thiết bị người dùng cuối. Trọng tâm khác Cost Optimization: mục tiêu là giảm tài nguyên tiêu thụ, dù nhiều biện pháp trùng nhau.

  1. Vì sao Graviton thường là đáp án cho scenario "reduce carbon footprint"?
Xem đáp án

Graviton là chip ARM-based do AWS thiết kế, cho performance per watt tốt hơn tới ~60% so với x86 tương đương — cùng workload tiêu thụ ít năng lượng hơn, đồng thời rẻ hơn 20-40%. Khi đề bài kết hợp "reduce cost and carbon footprint" cho web tier/container/open-source database, Graviton (m7g/m8g, Fargate Graviton, Aurora Graviton) gần như luôn là đáp án. Điều kiện: app phải chạy được trên ARM (runtime hiện đại OK; legacy x86-only binary thì không).

  1. Serverless đóng góp gì cho Sustainability?
Xem đáp án

Lambda/Fargate loại bỏ idle capacity — tài nguyên chỉ chạy khi có request, không có server bật 24/7 chờ traffic. Infrastructure là shared multi-tenant do AWS tối ưu utilization ở mức cao hơn nhiều so với EC2 tự quản (thường utilization <20%). Với Well-Architected: serverless đáp ứng cùng lúc "maximize utilization" và "use managed services". Trade-off: workload steady-state rất cao thì EC2 + RI có thể hiệu quả hơn về chi phí.

  1. Storage lifecycle giúp giảm tác động môi trường như thế nào?
Xem đáp án

Data lạnh chuyển xuống tier tiêu thụ ít tài nguyên hơn (S3 IA → Glacier), data không dùng thì xoá; kết hợp compression và format hiệu quả (Parquet/ORC giảm cả dung lượng lẫn compute khi query). S3 Lifecycle policies và Intelligent-Tiering tự động hoá việc này — vừa giảm chi phí (Cost Optimization) vừa giảm năng lượng lưu trữ (Sustainability). Đây là ví dụ điển hình một biện pháp phục vụ 2 pillars.

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

Phần 1: Performance Efficiency Pillar

  • Compare Lambda performance với different memory settings
  • Setup CloudFront distribution cho S3
  • Configure ElastiCache cluster
  • Create CloudWatch Dashboard cho performance metrics

Phần 2: Cost Optimization Pillar

  • Enable Cost Explorer và phân tích chi phí
  • Create AWS Budget với alert
  • Review Trusted Advisor cost recommendations
  • Apply S3 Lifecycle policy

Phần 3: Sustainability Pillar (Trụ cột Bền vững)

  1. Customer Carbon Footprint Tool: mở AWS Billing Console → Carbon Footprint, xem emissions theo service/region của account bạn (hoặc account sandbox). Ghi nhận service nào phát thải nhiều nhất và region nào "xanh" hơn.

  2. Right-sizing với Compute Optimizer: bật Compute Optimizer, xem recommendations cho EC2/EBS/Lambda hiện có; áp dụng 1 recommendation (downsize hoặc chuyển Graviton) và ước tính mức giảm cả chi phí lẫn năng lượng.

  3. Lifecycle policy: tạo S3 Lifecycle rule chuyển object > 30 ngày sang Standard-IA và > 90 ngày sang Glacier Flexible Retrieval, kèm rule xoá incomplete multipart uploads — giải thích rule nào phục vụ Sustainability, rule nào phục vụ Cost.

Tài liệu tham khảo


Bài tiếp theo →