Ngân hàng đề — AWS Certified Solutions Architect Associate
Tìm thấy 2194 câu.
Which solution will resolve this issue with the LEAST operational overhead?
- A Create a proxy in RDS Proxy. Configure the users’ applications to use the DB instance through RDS Proxy.
- B Deploy Amazon ElastiCache for Memcached between the users’ applications and the DB instance.
- C Migrate the DB instance to a different instance class that has higher I/O capacity. Configure the users’ applications to use the new DB instance.
- D Configure Multi-AZ for the DB instance. Configure the users’ applications to switch between the DB instances.
Xem giải thích
🧩 Phân tích chi tiết nội dung câu hỏi
Câu hỏi tập trung vào một tình huống thực tế trên AWS: Một công ty đã triển khai Amazon RDS for MySQL DB instance. Hầu hết các kết nối đến cơ sở dữ liệu (DB) đến từ các ứng dụng serverless (như AWS Lambda). Lưu lượng ứng dụng đến DB thay đổi mạnh mẽ và ngẫu nhiên theo thời gian, dẫn đến tình trạng lỗi từ chối kết nối database (connection rejection errors) vào các thời điểm cao điểm.
Vấn đề cốt lõi ở đây là RDS không xử lý tốt số lượng kết nối đột ngột từ serverless apps, vì mỗi Lambda invocation tạo kết nối mới, gây quá tải connection pool của DB instance. Yêu cầu giải pháp phải có LEAST operational overhead (ít nỗ lực vận hành nhất), nghĩa là tự động hóa cao, dễ triển khai, ít can thiệp thủ công và bảo trì.
✅ Đáp án đúng: Create a proxy in RDS Proxy. Configure the users’ applications to use the DB instance through RDS Proxy.
Lý do lựa chọn: RDS Proxy là dịch vụ fully managed của AWS, chuyên xử lý connection pooling và multiplexing cho RDS (bao gồm MySQL). Nó giúp tái sử dụng kết nối, giảm số lượng kết nối thực tế đến DB instance lên đến 90%, chịu tải traffic biến động từ serverless apps mà không cần thay đổi DB instance. Triển khai chỉ cần tạo proxy endpoint và cập nhật connection string trong app – overhead thấp nhất (không migrate DB, không scale thủ công). Đây là giải pháp khuyến nghị chính thức từ AWS cho vấn đề này (cập nhật đến 2026).
🔍 Giải thích chi tiết tất cả các phương án (sử dụng kiến thức AWS mới nhất 2026)
-
✅ Create a proxy in RDS Proxy. Configure the users’ applications to use the DB instance through RDS Proxy.
Phân tích đúng: RDS Proxy (ra mắt 2020, cập nhật liên tục đến 2026 với hỗ trợ IAM auth, secrets rotation) tự động quản lý kết nối, failover, và multiplexing. Hoàn hảo cho serverless traffic biến động, giảm connection errors mà không cần thay đổi hạ tầng DB. Overhead thấp: AWS quản lý hết, chỉ config endpoint. Giải quyết chính xác vấn đề connection rejection. -
❌ Deploy Amazon ElastiCache for Memcached between the users’ applications and the DB instance.
Phân tích sai: ElastiCache for Memcached là in-memory caching layer, giúp cache dữ liệu đọc để giảm tải query đến DB, nhưng KHÔNG giải quyết vấn đề connection pooling hoặc rejection. Nó chỉ giảm I/O query, không quản lý kết nối TCP từ apps. Deploy Memcached đòi hỏi overhead cao: config cluster, handle failover, scale thủ công – không phù hợp với serverless và traffic ngẫu nhiên. -
❌ Migrate the DB instance to a different instance class that has higher I/O capacity. Configure the users’ applications to use the new DB instance.
Phân tích sai: Chuyển sang instance class lớn hơn (như từ db.t3.micro lên db.m5.large) tăng CPU/IOPS/storage, nhưng connection limit vẫn bị ràng buộc bởimax_connectionsparameter (dựa trên instance size, nhưng không scale vô hạn). Vấn đề gốc là quá nhiều kết nối ngắn hạn từ serverless, không phải I/O. Migrate đòi hỏi downtime, backup/restore, test apps – overhead vận hành rất cao, không giải quyết gốc rễ. -
❌ Configure Multi-AZ for the DB instance. Configure the users’ applications to switch between the DB instances.
Phân tích sai: Multi-AZ RDS cung cấp high availability qua standby replica, tự động failover (RTO <60s), nhưng KHÔNG tăng connection pool hoặc xử lý traffic peak. Apps phải switch manual (hoặc dùng Route53), vẫn gặp rejection nếu primary overload. Overhead cao: config DNS logic, handle switchover – chỉ cải thiện resilience, không fix connection issue.
📘 Tài liệu tham khảo (AWS docs cập nhật 2026)
- RDS Proxy chính thức: Amazon RDS Proxy – Chi tiết connection multiplexing cho Lambda.
- Best practices serverless + RDS: AWS Well-Architected Framework - Reliability Pillar (phần Database scalability).
- Exam guide DOP-C02: AWS Certified DevOps Engineer Professional – Domain 3: Automation & Implementation (RDS Proxy ví dụ điển hình).
- Release notes 2024-2026: RDS Proxy hỗ trợ MySQL 8.0+, tích hợp Lambda IAM auth (không thay đổi cơ bản).
🛠️ Khuyến nghị thực tế: Luôn test với CloudWatch metrics (DatabaseConnections, FreeableMemory) trước/sau triển khai RDS Proxy để verify!
Which solution achieves these goals MOST efficiently?
- A Use a scheduled AWS Lambda function and run a script remotely on all EC2 instances to send data to the audit system.
- B Use EC2 Auto Scaling lifecycle hooks to run a custom script to send data to the audit system when instances are launched and terminated.
- C Use an EC2 Auto Scaling launch configuration to run a custom script through user data to send data to the audit system when instances are launched and terminated.
- D Run a custom script on the instance operating system to send data to the audit system. Configure the script to be invoked by the EC2 Auto Scaling group when the instance starts and is terminated.
Xem giải thích
🧩 Giải thích nội dung câu hỏi
Câu hỏi tập trung vào việc triển khai một hệ thống kiểm toán (auditing system) để thu thập thông tin tập trung về phiên bản hệ điều hành, tình trạng vá lỗi (patching) và phần mềm đã cài đặt trên các Amazon EC2 instances trong EC2 Auto Scaling Groups (ASG).
📌 Yêu cầu chính:
- Tất cả instances được provision (khởi tạo) qua ASG phải gửi báo cáo ngay lập tức đến hệ thống kiểm toán khi launched (khởi chạy) và terminated (kết thúc).
- Giải pháp phải hiệu quả nhất (MOST efficiently), nghĩa là tự động, đáng tin cậy, không lãng phí tài nguyên và phù hợp với quy trình lifecycle của ASG.
🛠️ Bối cảnh AWS: ASG tự động scale instances dựa trên nhu cầu, nên cần hook vào các giai đoạn lifecycle cụ thể (launch/terminate) để chạy script gửi dữ liệu mà không can thiệp thủ công. Điều này đảm bảo tính nhất quán và real-time, tránh polling hoặc schedule không cần thiết.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Use EC2 Auto Scaling lifecycle hooks to run a custom script to send data to the audit system when instances are launched and terminated.
Lý do 🏆:
- Lifecycle hooks là tính năng chuyên biệt của ASG, cho phép tạm dừng (pause) quy trình launch hoặc terminate tại các điểm cụ thể (như
InstanceLaunchinghoặcInstanceTerminating), chạy custom script (qua SNS, SQS, Lambda hoặc script trực tiếp), rồi tiếp tục. - ✅ Hỗ trợ cả launch VÀ terminate một cách tự động, real-time, không cần can thiệp OS hoặc user data.
- Hiệu quả nhất: Không tốn tài nguyên (không schedule, không remote execution), tích hợp native với ASG, dễ scale. Theo tài liệu AWS mới nhất (2024-2026), lifecycle hooks vẫn là best practice cho custom actions trong ASG lifecycle (Launch Templates thay thế Launch Configurations nhưng hooks không thay đổi).
- 📘 Nguồn tham khảo: AWS Documentation - Lifecycle Hooks (cập nhật 2024).
📋 Phân tích tất cả các phương án
Dưới đây là phân tích chi tiết từng lựa chọn, với văn bản gốc giữ nguyên bằng tiếng Anh. Tôi đánh dấu ✅ (đúng) hoặc ❌ (sai) và giải thích lý do bằng tiếng Việt rõ ràng.
-
❌ Use a scheduled AWS Lambda function and run a script remotely on all EC2 instances to send data to the audit system.
Tại sao sai? Phương án này sử dụng Lambda chạy theo lịch (scheduled), kết hợp remote script (qua SSM hoặc SSH), không đảm bảo "as soon as launched/terminated" vì phụ thuộc lịch trình (có thể delay vài phút/giờ). Không efficient cho scale lớn (phải scan tất cả instances), tốn chi phí Lambda invocations và kém real-time so với hooks native. Không xử lý terminate tốt vì instances đã shutdown. -
✅ Use EC2 Auto Scaling lifecycle hooks to run a custom script to send data to the audit system when instances are launched and terminated.
Tại sao đúng? Như đã giải thích ở trên, đây là giải pháp native, tự động hook vào lifecycle events của ASG, chạy script ngay lập tức cho cả launch (autoscaling:EC2_INSTANCE_LAUNCHING) và terminate (autoscaling:EC2_INSTANCE_TERMINATING). Có thể gửi dữ liệu qua HTTP/SNS trước khi instance hoàn tất lifecycle. Hỗ trợ hoàn hảo yêu cầu "MOST efficiently" với zero overhead. -
❌ Use an EC2 Auto Scaling launch configuration to run a custom script through user data to send data to the audit system when instances are launched and terminated.
Tại sao sai? User data trong Launch Configuration (hoặc Launch Template mới) chỉ chạy một lần lúc launch (qua cloud-init), không hỗ trợ terminate vì instance đã shutdown. Không cover "terminated" phase. Lưu ý: Launch Configurations deprecated từ 2021, AWS khuyến nghị Launch Templates nhưng vẫn fail ở terminate (xem AWS Deprecation Notice). -
❌ Run a custom script on the instance operating system to send data to the audit system. Configure the script to be invoked by the EC2 Auto Scaling group when the instance starts and is terminated.
Tại sao sai? ASG không có cơ chế invoke script trực tiếp trên OS của instance lúc start/terminate. Phải tự config script trong OS (như systemd service), nhưng không tự động "invoked by ASG" – dẫn đến không reliable (instance có thể fail boot, script crash). Không efficient, phức tạp config AMI cho mọi ASG, và không real-time cho terminate vì OS shutdown.
🧠 Kết luận nhanh: Lifecycle hooks là "vũ khí bí mật" của ASG cho custom actions! Nếu apply thực tế, test với CompleteLifecycleAction API để resume sau script. 🚀
Which solution should a solutions architect recommend?
- A Use Amazon Route 53 for traffic distribution and Amazon Aurora Serverless for data storage.
- B Use a Network Load Balancer for traffic distribution and Amazon DynamoDB on-demand for data storage.
- C Use a Network Load Balancer for traffic distribution and Amazon Aurora Global Database for data storage.
- D Use an Application Load Balancer for traffic distribution and Amazon DynamoDB global tables for data storage.
Xem giải thích
🧩 Giải thích nội dung câu hỏi một cách chi tiết
Câu hỏi mô tả một công ty đang phát triển trò chơi multiplayer thời gian thực sử dụng giao thức UDP để giao tiếp giữa client và các server nằm trong Auto Scaling group. Họ dự đoán lượng truy cập tăng đột biến (spikes) vào ban ngày, nên nền tảng server game cần tự động mở rộng theo nhu cầu. Ngoài ra, các lập trình viên muốn lưu trữ điểm số người chơi (gamer scores) và dữ liệu không quan hệ (non-relational) vào một giải pháp cơ sở dữ liệu tự động scale mà không cần can thiệp thủ công.
🛠️ Yêu cầu chính từ solutions architect:
- Phân phối lưu lượng (traffic distribution): Phải hỗ trợ UDP và tích hợp tốt với Auto Scaling group để xử lý spikes.
- Lưu trữ dữ liệu: Non-relational, scale tự động (serverless hoặc on-demand), không cần quản lý capacity thủ công.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Use a Network Load Balancer for traffic distribution and Amazon DynamoDB on-demand for data storage.
Lý do chi tiết:
- Network Load Balancer (NLB): Hoàn hảo cho UDP vì hỗ trợ TCP, UDP, TLS ở Layer 4 (Network layer), xử lý hàng triệu request/giây với độ trễ thấp, tự động scale theo traffic spikes và tích hợp mượt mà với Auto Scaling group. Không cần session affinity phức tạp như ALB. ✅
- Amazon DynamoDB on-demand: Là dịch vụ NoSQL serverless hoàn toàn, tự động scale throughput đọc/ghi theo nhu cầu thực tế mà không cần provision capacity hay can thiệp thủ công – lý tưởng cho dữ liệu non-relational như scores người chơi. Hỗ trợ spikes đột biến mà không downtime. (Cập nhật 2026: DynamoDB On-Demand vẫn là lựa chọn hàng đầu cho workload biến động cao). 🏆
📋 Phân tích tất cả các phương án (đúng và sai)
Dưới đây là phân tích từng lựa chọn, giữ nguyên văn bản gốc bằng tiếng Anh. Mỗi phương án được đánh giá ✅ (đúng) hoặc ❌ (sai), kèm giải thích rõ ràng:
-
Use Amazon Route 53 for traffic distribution and Amazon Aurora Serverless for data storage.
❌ Sai: Route 53 chỉ là dịch vụ DNS routing (không phải load balancer Layer 4), không hỗ trợ phân phối UDP traffic real-time đến Auto Scaling group – chỉ route domain-based, không xử lý spikes UDP hiệu quả. Aurora Serverless là relational DB (SQL), không phù hợp non-relational data và dù scale tự động nhưng vẫn kém linh hoạt hơn NoSQL cho scores game. 🛑 -
Use a Network Load Balancer for traffic distribution and Amazon DynamoDB on-demand for data storage.
✅ Đúng: Như đã giải thích ở trên, NLB lý tưởng cho UDP + Auto Scaling, DynamoDB on-demand scale vô can thiệp cho non-relational data. Kết hợp hoàn hảo cho multiplayer game real-time. 🎯 -
Use a Network Load Balancer for traffic distribution and Amazon Aurora Global Database for data storage.
❌ Sai: NLB đúng cho UDP traffic, nhưng Aurora Global Database là relational (PostgreSQL/MySQL) multi-region replication, không dành cho non-relational data như gamer scores. Nó yêu cầu quản lý schema và kém scale tự động so với NoSQL serverless. Không phù hợp workload game spikes. 📉 -
Use an Application Load Balancer for traffic distribution and Amazon DynamoDB global tables for data storage.
❌ Sai: Application Load Balancer (ALB) chỉ hỗ trợ HTTP/HTTPS/TCP ở Layer 7, không hỗ trợ UDP – sẽ fail hoàn toàn cho game multiplayer UDP. DynamoDB global tables đúng cho multi-region replication nhưng vẫn cần provision capacity (không "without intervention" như on-demand), kém tối ưu cho spikes đơn vùng. 🚫
📘 Tài liệu tham khảo (cập nhật mới nhất AWS đến 2026)
- Network Load Balancer: AWS NLB Documentation – Xác nhận hỗ trợ UDP/TCP, scale tự động.
- DynamoDB On-Demand: DynamoDB On-Demand Capacity Mode – Serverless scaling without provisioning.
- So sánh Load Balancers: Elastic Load Balancing Features – ALB vs NLB rõ ràng về protocol support.
- Exam Guide DOP-C02: AWS Certified DevOps Engineer Professional – Chủ đề Scalable Architectures & Serverless (phiên bản 2026 không thay đổi core features này).
Hy vọng phân tích giúp bạn nắm vững! 🚀 Nếu cần thêm ví dụ thực tế, hãy hỏi nhé!
Which solution will meet these requirements?
- A Establish a connection between the frontend application and the database to make queries faster by bypassing the API.
- B Configure provisioned concurrency for the Lambda function that handles the requests.
- C Cache the results of the queries in Amazon S3 for faster retrieval of similar datasets.
- D Increase the size of the database to increase the number of connections Lambda can establish at one time.
Xem giải thích
🧩 Phân tích nội dung câu hỏi
Câu hỏi mô tả một kiến trúc AWS điển hình: Frontend application sử dụng Amazon API Gateway làm backend, tích hợp với AWS Lambda. Khi nhận request, Lambda function phải load nhiều thư viện (libraries), sau đó kết nối Amazon RDS database, xử lý dữ liệu và trả về cho frontend.
Mục tiêu: Giảm response latency (độ trễ phản hồi) xuống mức thấp nhất có thể cho tất cả users, đồng thời yêu cầu ít thay đổi nhất trong operations (vận hành) của công ty.
🔍 Vấn đề chính: Độ trễ cao chủ yếu từ cold starts của Lambda (thời gian khởi tạo function lần đầu, load libraries và kết nối DB), vì Lambda scale theo nhu cầu và có thể "ngủ" khi không dùng. Cần giải pháp tối ưu latency mà không thay đổi lớn kiến trúc hiện tại (API Gateway + Lambda + RDS).
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Configure provisioned concurrency for the Lambda function that handles the requests.
Lý do:
- Provisioned Concurrency (PC) là tính năng Lambda giữ một số lượng execution environments warm (sẵn sàng) liên tục, loại bỏ cold starts hoàn toàn cho các request đầu tiên.
- Điều này trực tiếp giảm latency cho tất cả users, đặc biệt khi load libraries nặng và connect RDS.
- Ít thay đổi nhất: Chỉ config PC trên Lambda hiện tại qua Console/CLI/CDK/Terraform, không động kiến trúc (không thêm cache, thay DB, bypass API).
- Theo AWS 2026: PC hỗ trợ SnapStart cho Java (giảm cold start 2-10x), tích hợp tốt với API Gateway, billing theo provisioned amount + requests.
🛠️ Cách triển khai nhanh: Sử dụng AWS Console > Lambda > Function > Configuration > Concurrency > Add provisioned concurrency, set desired amount dựa trên peak traffic (dùng CloudWatch metrics dự đoán).
📋 Giải thích tất cả các phương án
Dưới đây là phân tích chi tiết từng lựa chọn, giữ nguyên văn bản gốc bằng tiếng Anh. Mỗi phương án được đánh giá đúng/sai với lý do cụ thể:
-
❌ SAI: Establish a connection between the frontend application and the database to make queries faster by bypassing the API.
Phương án này yêu cầu frontend trực tiếp connect RDS, bỏ qua API Gateway + Lambda. Sai vì:- Thay đổi lớn operations (phải rewrite frontend code, expose DB publicly - rủi ro bảo mật cao, vi phạm least privilege).
- Không giải quyết cold starts/load libraries của Lambda; RDS connect vẫn chậm nếu traffic cao (connection pooling limit).
- Vi phạm best practice AWS: Frontend không nên direct DB access (dùng API layer cho security/scalability). Latency có thể tệ hơn do frontend handle DB logic.
-
✅ ĐÚNG: Configure provisioned concurrency for the Lambda function that handles the requests.
Như đã giải thích ở phần đáp án đúng: Giảm cold starts tối ưu, giữ environments warm, latency thấp nhất với thay đổi minimum. Hoàn hảo cho workload API Gateway + Lambda + RDS. -
❌ SAI: Cache the results of the queries in Amazon S3 for faster retrieval of similar datasets.
Phương án lưu cache query results vào S3. Sai vì:- S3 là object storage chậm hơn (latency ~100-200ms + GET API), không phù hợp real-time queries động từ RDS.
- Phải thay đổi code Lambda lớn (check cache trước query DB, handle cache invalidation - complex ops).
- Không giải quyết gốc rễ: Load libraries + initial DB connect vẫn chậm cho mọi request (cache chỉ hit cho "similar datasets"). ElastiCache (Redis/Memcached) tốt hơn, nhưng không "ít thay đổi nhất".
-
❌ SAI: Increase the size of the database to increase the number of connections Lambda can establish at one time.
Phương án scale up RDS instance size. Sai vì:- RDS connection limit phụ thuộc instance class (ví dụ db.t4g.medium ~100 connections), nhưng scale up chỉ tăng connections, không giảm Lambda cold starts/load libraries (nguyên nhân latency chính).
- Thay đổi ops lớn: Downtime resize, chi phí cao hơn (scale vertically kém hiệu quả so với Aurora Serverless/Proxy).
- Latency vẫn cao nếu Lambda cold; AWS recommend RDS Proxy cho connection pooling, nhưng không phải giải pháp "ít thay đổi nhất".
📘 Tài liệu tham khảo (AWS cập nhật 2026)
- AWS Lambda Provisioned Concurrency: docs.aws.amazon.com/lambda/latest/dg/provisioned-concurrency.html - Hướng dẫn config + metrics CloudWatch.
- Lambda Cold Starts Best Practices: aws.amazon.com/blogs/compute/operating-lambda-provisioned-concurrency/ - Case study latency reduction 90%.
- API Gateway + Lambda + RDS Architecture: docs.aws.amazon.com/apigateway/latest/developerguide/getting-started-with-lambda-integration.html.
- RDS Connection Management: docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToInstance.html - Lý do không scale size cho Lambda connects.
🧑💻 Tips DevOps: Monitor với CloudWatch Lambda Insights + X-Ray tracing để confirm cold starts trước/ sau PC!
Which solution will meet these requirements?
- A Scale the EC2 instances by using elastic resize. Scale the DB instances to zero outside of business hours.
- B Explore AWS Marketplace for partner solutions that will automatically start and stop the EC2 instances and DB instances on a schedule.
- C Launch another EC2 instance. Configure a crontab schedule to run shell scripts that will start and stop the existing EC2 instances and DB instances on a schedule.
- D Create an AWS Lambda function that will start and stop the EC2 instances and DB instances. Configure Amazon EventBridge to invoke the Lambda function on a schedule.
Xem giải thích
🧩 Phân tích nội dung câu hỏi
Câu hỏi mô tả một công ty đang chuyển đổi workload từ on-premises sang AWS Cloud, nơi họ đã sử dụng Amazon EC2 instances (máy ảo) và Amazon RDS DB instances (cơ sở dữ liệu quan hệ). Yêu cầu chính là xây dựng giải pháp tự động khởi động (start) và dừng (stop) các instances này ngoài giờ làm việc (ví dụ: ban đêm hoặc cuối tuần). Giải pháp phải tối ưu hóa chi phí (minimize cost) bằng cách tránh chạy liên tục và giảm thiểu bảo trì hạ tầng (minimize infrastructure maintenance), nghĩa là không cần quản lý server thủ công hay phần mềm phức tạp.
📘 Nguồn tham khảo: AWS Well-Architected Framework (Pillar: Cost Optimization & Operational Excellence), tài liệu EC2/RDS APIs (cập nhật 2024-2026 tại docs.aws.amazon.com/ec2 và docs.aws.amazon.com/rds).
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Create an AWS Lambda function that will start and stop the EC2 instances and DB instances. Configure Amazon EventBridge to invoke the Lambda function on a schedule.
Lý do:
- 🛠️ AWS Lambda là dịch vụ serverless, chạy code theo sự kiện mà không cần quản lý server, tự động scale và chỉ tính phí theo thời gian thực thi (pay-per-use), giúp minimize cost (chỉ chạy vài giây mỗi lần schedule).
- Amazon EventBridge (trước là CloudWatch Events, cập nhật mới nhất 2024-2026) hỗ trợ lập lịch cron-like chính xác (ví dụ: hàng ngày 18h stop, 8h start), invoke Lambda tự động.
- Lambda có thể gọi AWS SDK APIs như
start_instances/stop_instancescho EC2 vàstart_db_instance/stop_db_instancecho RDS, hoàn hảo cho automation mà zero maintenance. - Đây là best practice serverless, phù hợp migrate workload, theo AWS Compute Optimizer và Savings Plans (2026 updates).
📘 Nguồn: AWS Lambda Developer Guide, EventBridge Schedules.
🔍 Phân tích chi tiết tất cả các phương án
Dưới đây là phân tích từng lựa chọn giữ nguyên văn bản gốc tiếng Anh. Mỗi phương án được đánh giá đúng/sai với lý do cụ thể dựa trên yêu cầu minimize cost/maintenance và tính khả thi trên AWS (cập nhật 2026).
-
Scale the EC2 instances by using elastic resize. Scale the DB instances to zero outside of business hours.
❌ Sai:- EC2 không hỗ trợ elastic resize để scale xuống 0 instances (elastic resize chỉ áp dụng cho EBS volumes hoặc một số instance types cụ thể, không phải start/stop toàn bộ).
- RDS không thể scale instance size xuống zero (DB instance luôn cần minimum size, stop/start mới đúng cách tiết kiệm). Giải pháp này không khả thi, không tự động hóa đúng và vẫn tốn cost/maintenance cao.
🧩 Vấn đề: Không khớp API thực tế của AWS.
-
Explore AWS Marketplace for partner solutions that will automatically start and stop the EC2 instances and DB instances on a schedule.
❌ Sai:- AWS Marketplace có thể có third-party tools (như schedulers), nhưng chúng thường yêu cầu deploy EC2 riêng hoặc license phí, tăng cost (subscription + EC2 runtime) và maintenance (update software, manage AMI).
- Không phải native AWS, vi phạm yêu cầu minimize infrastructure maintenance; AWS khuyến nghị dùng managed services như Lambda/EventBridge thay vì partner solutions phức tạp.
🧩 Vấn đề: Tăng chi phí dài hạn, không serverless.
-
Launch another EC2 instance. Configure a crontab schedule to run shell scripts that will start and stop the existing EC2 instances and DB instances on a schedule.
❌ Sai:- Phải launch EC2 thêm luôn chạy 24/7 để chạy crontab, tăng cost đáng kể (EC2 billable ngay cả idle) và maintenance cao (patch OS, monitor uptime, handle failures).
- Crontab là Linux scheduler cơ bản, không resilient (EC2 crash thì schedule fail); AWS CLI scripts gọi API được nhưng không hiệu quả bằng serverless.
🧩 Vấn đề: Chống lại nguyên tắc Well-Architected (tránh always-on infra).
-
Create an AWS Lambda function that will start and stop the EC2 instances and DB instances. Configure Amazon EventBridge to invoke the Lambda function on a schedule.
✅ Đúng: Như đã giải thích ở phần đáp án đúng. Giải pháp serverless 100%, cost thấp (~$0.00001667/giây execution), zero maintenance, scale tự động. Hoàn hảo cho DevOps automation.
📘 Sample code: Lambda Python vớiboto3.client('ec2').start_instances(InstanceIds=['i-xxx']).
🛠️ Best Practice 2026: Tích hợp IAM roles least-privilege cho Lambda.
The reporting process takes a few hours with the use of relational queries. The reporting process must not prevent any document modifications or the addition of new documents. A solutions architect needs to implement a solution to speed up the reporting process.
Which solution will meet these requirements with the LEAST amount of change to the application code?
- A Set up a new Amazon DocumentDB (with MongoDB compatibility) cluster that includes a read replica. Scale the read replica to generate the reports.
- B Set up a new Amazon Aurora PostgreSQL DB cluster that includes an Aurora Replica. Issue queries to the Aurora Replica to generate the reports.
- C Set up a new Amazon RDS for PostgreSQL Multi-AZ DB instance. Configure the reporting module to query the secondary RDS node so that the reporting module does not affect the primary node.
- D Set up a new Amazon DynamoDB table to store the documents. Use a fixed write capacity to support new document entries. Automatically scale the read capacity to support the reports.
Xem giải thích
🧩 Giải thích nội dung câu hỏi
Câu hỏi mô tả một công ty đang chạy ứng dụng web 3-tier với cơ sở dữ liệu PostgreSQL lưu trữ metadata của các tài liệu (documents). Các tài liệu thực tế được lưu ở Amazon S3, thường chỉ viết một lần nhưng cập nhật thường xuyên. Quy trình báo cáo hàng tháng tìm kiếm metadata theo key terms để lấy documents, sử dụng relational queries (truy vấn quan hệ) và mất vài giờ. Yêu cầu chính:
- Tăng tốc quy trình báo cáo (speed up reporting).
- Không làm gián đoạn việc chỉnh sửa documents hoặc thêm mới (must not prevent modifications/additions).
- Thay đổi code ứng dụng ÍT NHẤT (LEAST amount of change to the application code).
Vấn đề cốt lõi: Truy vấn báo cáo nặng (read-intensive) đang chạy trên primary DB, gây chậm và có thể ảnh hưởng writes. Giải pháp cần offload reads sang replica, giữ tương thích PostgreSQL để code không thay đổi nhiều. 📈
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Set up a new Amazon Aurora PostgreSQL DB cluster that includes an Aurora Replica. Issue queries to the Aurora Replica to generate the reports.
Lý do:
- Aurora PostgreSQL hoàn toàn tương thích với PostgreSQL (binary compatibility), nên ứng dụng có thể dùng cùng SQL queries mà không cần thay đổi code (least change). 🛠️
- Aurora Replica là read replica tự động replicate dữ liệu từ primary, hỗ trợ read-heavy workloads như báo cáo (scale reads lên đến 15 replicas/cluster).
- Performance cao: Aurora tối ưu hóa storage (shared storage), replicate nhanh (sub-second), và hỗ trợ serverless v2 (cập nhật 2023-2026) để auto-scale reads mà không ảnh hưởng writes.
- Không cản trở modifications: Reports chạy trên replica riêng, primary chỉ xử lý writes/updates. Thời gian báo cáo giảm nhờ parallel queries trên replicas. 🚀
📋 Phân tích tất cả các phương án
Dưới đây là phân tích chi tiết từng lựa chọn, giữ nguyên văn bản gốc bằng tiếng Anh. Mỗi phương án được đánh giá đúng/sai với lý do cụ thể dựa trên kiến thức AWS mới nhất (Aurora PostgreSQL 15.x, 2024-2026 features như Global Databases và Data API).
-
❌ SAI: Set up a new Amazon DocumentDB (with MongoDB compatibility) cluster that includes a read replica. Scale the read replica to generate the reports.
Lý do sai: DocumentDB tương thích MongoDB (NoSQL document model), không hỗ trợ relational queries PostgreSQL gốc. Phải viết lại code từ SQL sang Mongo queries (aggregation pipelines), vi phạm "least change". Replica chỉ scale reads nhưng schema khác biệt hoàn toàn. Không phù hợp metadata relational. 🗑️ -
✅ ĐÚNG: Set up a new Amazon Aurora PostgreSQL DB cluster that includes an Aurora Replica. Issue queries to the Aurora Replica to generate the reports.
Lý do đúng: Như đã giải thích ở trên. Tương thích 100% PostgreSQL, offload reads hiệu quả, least code change. Hỗ trợ Aurora Serverless v2 (2023+) để auto-scale reads cho reports nặng vài giờ. 💯 -
❌ SAI: Set up a new Amazon RDS for PostgreSQL Multi-AZ DB instance. Configure the reporting module to query the secondary RDS node so that the reporting module does not affect the primary node.
Lý do sai: RDS PostgreSQL Multi-AZ dùng synchronous standby cho HA/failover, không thiết kế cho read workloads (secondary không accessible cho queries reads thông thường). Phải dùng read replicas riêng (khác Multi-AZ). Code cần thay đổi endpoint, và performance kém hơn Aurora (không shared storage). Vi phạm least change và speed up. ⚠️ -
❌ SAI: Set up a new Amazon DynamoDB table to store the documents. Use a fixed write capacity to support new document entries. Automatically scale the read capacity to support the reports.
Lý do sai: DynamoDB là NoSQL key-value, không hỗ trợ relational queries phức tạp như joins/search PostgreSQL trên metadata. Phải refactor toàn bộ schema/app sang partition keys/GSI, thay đổi code lớn (vi phạm least change). Documents ở S3 rồi, DynamoDB không cần thiết và kém cho complex reporting. Dù on-demand capacity (2026 updates), vẫn không relational. 🚫
📘 Tài liệu tham khảo
- AWS Documentation: Amazon Aurora PostgreSQL Features (tương thích PostgreSQL, read replicas).
- Aurora Best Practices: Offloading Reads with Replicas (cập nhật 2024, serverless scaling).
- RDS vs Aurora Comparison: AWS Whitepaper: Database Blog - Migrating to Aurora (2023-2026 posts về performance gains 3-5x cho reads).
- Exam Topic DOP-C02: Read replicas và least operational overhead (AWS Certified DevOps Engineer - Professional, version 2024). 🔗
Giải pháp này đảm bảo high availability, performance, và minimal disruption! Nếu cần demo CDK/Terraform, hỏi thêm nhé. 😊
What should a solutions architect do to improve the security of the data in transit?
- A Configure a TLS listener. Deploy the server certificate on the NLB.
- B Configure AWS Shield Advanced. Enable AWS WAF on the NLB.
- C Change the load balancer to an Application Load Balancer (ALB). Enable AWS WAF on the ALB.
- D Encrypt the Amazon Elastic Block Store (Amazon EBS) volume on the EC2 instances by using AWS Key Management Service (AWS KMS).
Xem giải thích
🧩 Giải thích nội dung câu hỏi
Câu hỏi mô tả một ứng dụng ba tầng (three-tier) trên AWS, nơi dữ liệu cảm biến (sensor data) từ thiết bị người dùng được thu thập và xử lý. Luồng traffic diễn ra như sau:
- Từ client (thiết bị người dùng) → Network Load Balancer (NLB) (lớp load balancing đầu vào).
- Sau đó → EC2 instances cho web tier (xử lý web).
- Tiếp theo → EC2 instances cho application tier (xử lý logic ứng dụng).
- Cuối cùng → Database (lưu trữ dữ liệu).
Mục tiêu là cải thiện bảo mật dữ liệu đang truyền (data in transit), tức là mã hóa traffic giữa các thành phần để tránh bị nghe lén hoặc tấn công man-in-the-middle. Đây là vấn đề phổ biến trong kiến trúc AWS, đặc biệt với NLB (Layer 4 load balancer) xử lý traffic TCP/UDP hiệu suất cao. Theo tài liệu AWS mới nhất (2024-2026), NLB hỗ trợ TLS termination để mã hóa end-to-end từ client đến backend.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Configure a TLS listener. Deploy the server certificate on the NLB.
Lý do:
- Để bảo mật data in transit, cần mã hóa traffic ngay từ client đến NLB bằng TLS listener trên NLB (hỗ trợ từ năm 2018 và vẫn là best practice đến 2026).
- Triển khai server certificate (từ ACM hoặc tự upload) trên NLB sẽ terminate TLS tại đây, mã hóa toàn bộ traffic đầu vào mà không ảnh hưởng hiệu suất (NLB xử lý Layer 4 nhanh hơn ALB).
- Điều này trực tiếp giải quyết vấn đề, vì traffic hiện tại có thể đang plaintext (không mã hóa), dẫn đến rủi ro lộ dữ liệu sensor nhạy cảm. 🛡️ Hiệu quả cao, chi phí thấp và phù hợp với kiến trúc NLB hiện tại.
📋 Phân tích tất cả các phương án
Dưới đây là phân tích chi tiết từng lựa chọn, với nội dung gốc giữ nguyên tiếng Anh. Tôi đánh dấu ✅ cho đúng và ❌ cho sai, kèm giải thích bằng tiếng Việt:
-
✅ Configure a TLS listener. Deploy the server certificate on the NLB.
🛠️ Đúng vì: TLS listener trên NLB mã hóa traffic từ client đến load balancer ngay lập tức. Certificate deploy trên NLB (qua AWS Certificate Manager - ACM) hỗ trợ TLS 1.2/1.3, offload decryption cho backend EC2. Đây là giải pháp chuẩn AWS cho NLB, giảm tải CPU cho EC2 và bảo vệ data in transit end-to-end (client → NLB → web tier). Không cần thay đổi kiến trúc. -
❌ Configure AWS Shield Advanced. Enable AWS WAF on the NLB.
🛡️ Sai vì: AWS Shield Advanced chống DDoS Layer 3/4/7, còn WAF (Web Application Firewall) bảo vệ chống SQL injection/XSS (chỉ hỗ trợ NLB từ 2020 với limited rules). Chúng tập trung vào bảo vệ availability và application attacks, không mã hóa data in transit (traffic vẫn plaintext nếu không có TLS). -
❌ Change the load balancer to an Application Load Balancer (ALB). Enable AWS WAF on the ALB.
🔄 Sai vì: Chuyển sang ALB (Layer 7) thêm WAF đầy đủ hơn, nhưng không trực tiếp cải thiện data in transit (ALB cũng cần TLS listener riêng). Việc thay đổi NLB → ALB làm phức tạp hóa (NLB phù hợp sensor data cao throughput), và WAF chỉ chống web exploits, không mã hóa traffic. -
❌ Encrypt the Amazon Elastic Block Store (Amazon EBS) volume on the EC2 instances by using AWS Key Management Service (AWS KMS).
💾 Sai vì: EBS encryption với KMS chỉ bảo vệ data at rest (dữ liệu lưu trữ trên disk EC2). Hoàn toàn không ảnh hưởng data in transit (traffic giữa client/NLB/EC2/database vẫn plaintext, dễ bị sniff).
📘 Tài liệu tham khảo (AWS cập nhật đến 2026)
- NLB TLS Listeners: AWS Docs - Network Load Balancers – Hướng dẫn cấu hình TLS 1.3 và certificate management.
- Data in Transit Best Practices: AWS Well-Architected Framework - Security Pillar – Nhấn mạnh TLS termination tại edge (NLB/ALB).
- Shield/WAF vs Encryption: AWS Security Best Practices – Phân biệt transit (TLS) vs at-rest (KMS/EBS).
- ACM cho NLB: ACM Integration – Free certs cho load balancers.
Hy vọng phân tích này giúp bạn ôn thi DOP-C02 hiệu quả! 🚀 Nếu cần ví dụ code Terraform/CloudFormation, hãy hỏi thêm.
Which Amazon EC2 pricing option is the MOST cost-effective?
- A Dedicated Reserved Hosts
- B Dedicated On-Demand Hosts
- C Dedicated Reserved Instances
- D Dedicated On-Demand Instances
Xem giải thích
🧩 Phân tích nội dung câu hỏi
Câu hỏi tập trung vào việc chọn mô hình giá EC2 tối ưu chi phí nhất cho một công ty đang migrate ứng dụng commercial off-the-shelf (COTS) từ on-premises sang AWS. Ứng dụng có software licensing model dựa trên sockets và cores (số lượng ổ cắm CPU và lõi vật lý), với yêu cầu capacity và uptime predictable (dự đoán được). Quan trọng nhất, công ty muốn sử dụng existing licenses đã mua đầu năm nay (BYOL - Bring Your Own License).
🛠️ Lý do cần Dedicated Hosts: License kiểu này yêu cầu visibility vào physical hardware (số cores/sockets thực tế), chỉ Dedicated Hosts mới cung cấp điều này trên AWS, giúp tuân thủ license mà không cần mua mới. Đồng thời, cần mô hình giá cost-effective (tiết kiệm nhất) cho commitment dài hạn vì capacity predictable.
📘 Tài liệu tham khảo:
- AWS EC2 Dedicated Hosts Documentation (cập nhật 2024-2026): https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts.html
- AWS Pricing for Dedicated Hosts: https://aws.amazon.com/ec2/dedicated-hosts/pricing/
✅ Đáp án đúng: Dedicated Reserved Hosts
Lý do lựa chọn:
- ✅ Phù hợp hoàn hảo với BYOL dựa trên sockets/cores: Dedicated Hosts cung cấp server vật lý riêng biệt, cho phép xem chi tiết allocation cores/sockets, giúp dùng existing licenses mà không vi phạm (license on-prem thường bind với hardware cụ thể).
- ✅ Cost-effective nhất: Reserved Hosts (1-3 năm commitment) tiết kiệm đến 70% so với On-Demand, lý tưởng cho workload predictable/uptime cao. Không cần mua license mới, tối ưu chi phí tổng thể.
- 🛠️ Ưu điểm bổ sung (cập nhật 2026): Hỗ trợ Attribute-based instances, Socket Filters cho license compliance, và Savings Plans/Reserved có thể apply linh hoạt hơn.
📋 Giải thích chi tiết tất cả các phương án
-
Dedicated Reserved Hosts
✅ Đúng: Như phân tích trên, đây là lựa chọn tối ưu vì kết hợp physical isolation + reservation discount. Phù hợp migrate COTS với BYOL sockets/cores, tiết kiệm cao nhất cho predictable workload. (Tiết kiệm ~40-70% vs On-Demand theo AWS Pricing Calculator 2026). -
Dedicated On-Demand Hosts
❌ Sai: Mặc dù cung cấp Dedicated Hosts cho BYOL sockets/cores, nhưng On-Demand pay-as-you-go đắt đỏ (không discount), không cost-effective cho capacity predictable. Chỉ phù hợp workload ngắn hạn/unpredictable. -
Dedicated Reserved Instances
❌ Sai: Reserved Instances (RI) dành cho virtual instances, không cung cấp visibility physical cores/sockets cần thiết cho license BYOL kiểu này. Dedicated RI vẫn chạy trên shared hardware (multi-tenant), có thể vi phạm license on-prem yêu cầu dedicated physical. -
Dedicated On-Demand Instances
❌ Sai: On-Demand Instances (kể cả Dedicated) chỉ là virtual machines trên hardware riêng, không expose sockets/cores vật lý đầy đủ cho licensing compliance. Giá cao (no commitment discount), không tối ưu chi phí và không hỗ trợ BYOL hiệu quả như Hosts.
🧩 Tóm tắt so sánh: Dedicated Hosts > Instances cho BYOL hardware-bound; Reserved > On-Demand cho tiết kiệm dài hạn. Chọn Dedicated Reserved Hosts là chiến lược DevOps chuẩn! 🚀
Which solution will meet these requirements MOST cost-effectively?
- A Use the Amazon S3 Standard storage class. Create an S3 Lifecycle policy to move infrequently accessed data to S3 Glacier.
- B Use the Amazon S3 Standard storage class. Create an S3 Lifecycle policy to move infrequently accessed data to S3 Standard-Infrequent Access (S3 Standard-IA).
- C Use the Amazon Elastic File System (Amazon EFS) Standard storage class. Create a lifecycle management policy to move infrequently accessed data to EFS Standard-Infrequent Access (EFS Standard-IA).
- D Use the Amazon Elastic File System (Amazon EFS) One Zone storage class. Create a lifecycle management policy to move infrequently accessed data to EFS One Zone-Infrequent Access (EFS One Zone-IA).
Xem giải thích
🧩 Phân tích nội dung câu hỏi
Câu hỏi yêu cầu tìm giải pháp storage layer cho ứng dụng chạy trên Amazon EC2 Linux instances trải rộng qua nhiều Availability Zones (AZ). Các yêu cầu chính bao gồm:
- Highly available: Phải khả dụng cao, hỗ trợ multi-AZ để tránh downtime.
- POSIX-compliant: Tuân thủ chuẩn POSIX để ứng dụng Linux có thể mount và sử dụng như file system thông thường (hỗ trợ read/write đồng thời).
- Maximum data durability: Độ bền dữ liệu cao nhất (ít nhất 99.999999999% - 11 9's).
- Shareable across EC2 instances: Có thể chia sẻ giữa nhiều EC2 instances cùng lúc.
- Access pattern: Truy cập frequently trong 30 ngày đầu, sau đó infrequently.
- MOST cost-effectively: Giải pháp tiết kiệm chi phí nhất, tận dụng lifecycle policy để chuyển dữ liệu ít truy cập sang lớp rẻ hơn.
🛠️ Điểm then chốt: Cần một file system chia sẻ (không phải object storage như S3), hỗ trợ multi-AZ, POSIX, và tối ưu chi phí với IA class. AWS EFS là lựa chọn phù hợp nhất vì đáp ứng đầy đủ.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Use the Amazon Elastic File System (Amazon EFS) Standard storage class. Create a lifecycle management policy to move infrequently accessed data to EFS Standard-Infrequent Access (EFS Standard-IA).
Lý do:
- EFS Standard là lớp lưu trữ multi-AZ, đảm bảo highly available và maximum durability (99.999999999% theo tài liệu AWS mới nhất 2024-2026).
- POSIX-compliant đầy đủ, cho phép shareable giữa nhiều EC2 instances qua NFS protocol.
- Lifecycle management policy (ra mắt 2023 và cập nhật liên tục) tự động chuyển file ít truy cập (sau 30 ngày) sang EFS Standard-IA, giảm chi phí ~70-80% so với Standard mà vẫn giữ multi-AZ.
- Cost-effective nhất: Kết hợp frequent access ban đầu (Standard) + infrequent sau (IA), vượt trội hơn các lựa chọn khác về tính chia sẻ và HA.
📋 Giải thích chi tiết tất cả các phương án
-
❌ [SAI] Use the Amazon S3 Standard storage class. Create an S3 Lifecycle policy to move infrequently accessed data to S3 Glacier.
S3 không POSIX-compliant (là object storage, không mount như file system), không shareable đồng thời giữa EC2 (chỉ dùng qua SDK/API). Glacier quá chậm cho infrequent access (retrieval days), không phù hợp. Không đáp ứng highly available POSIX shareable. -
❌ [SAI] Use the Amazon S3 Standard storage class. Create an S3 Lifecycle policy to move infrequently accessed data to S3 Standard-Infrequent Access (S3 Standard-IA).
Tương tự, S3 không POSIX-compliant và không shareable như file system (EC2 không mount trực tiếp). Lifecycle tốt cho cost-saving, nhưng vi phạm yêu cầu POSIX và multi-AZ sharing. -
✅ [ĐÚNG] Use the Amazon Elastic File System (Amazon EFS) Standard storage class. Create a lifecycle management policy to move infrequently accessed data to EFS Standard-Infrequent Access (EFS Standard-IA).
Hoàn hảo: Multi-AZ HA, POSIX-compliant, shareable, max durability. Lifecycle policy (tính năng Intelligent-Tiering tương tự) tối ưu chi phí cho access pattern 30 ngày frequent + sau IA. -
❌ [SAI] Use the Amazon Elastic File System (Amazon EFS) One Zone storage class. Create a lifecycle management policy to move infrequently accessed data to EFS One Zone-Infrequent Access (EFS One Zone-IA).
One Zone chỉ trong 1 AZ, không highly available qua multiple AZ (rủi ro mất dữ liệu nếu AZ fail). Rẻ hơn Standard nhưng vi phạm yêu cầu HA và ứng dụng multi-AZ.
📘 Tài liệu tham khảo (cập nhật AWS 2024-2026)
- AWS EFS Documentation: Amazon EFS Storage Classes - Chi tiết Standard vs One Zone, lifecycle policy (ra mắt 2023).
- EFS Durability & HA: Performance and Availability - Xác nhận 11 9's durability cho Standard.
- S3 vs EFS Comparison: Choosing between EBS, EFS, and S3 - Nhấn mạnh POSIX chỉ EFS.
- Lifecycle for EFS: Managing file system data with EFS Lifecycle Management.
- Exam Prep DOP-C02: AWS re:Post và A Cloud Guru (phiên bản 2024) xác nhận pattern này cho DevOps Professional.
💡 Lời khuyên DevOps: Trong thực tế, dùng EFS với IAM policy và mount targets multi-AZ để scale. Test với dd command kiểm tra POSIX compliance! 🚀
Which additional configuration strategy should the solutions architect use to meet these requirements?
- A Create a security group for the web servers and allow port 443 from 0.0.0.0/0. Create a security group for the MySQL servers and allow port 3306 from the web servers security group.
- B Create a network ACL for the web servers and allow port 443 from 0.0.0.0/0. Create a network ACL for the MySQL servers and allow port 3306 from the web servers security group.
- C Create a security group for the web servers and allow port 443 from the load balancer. Create a security group for the MySQL servers and allow port 3306 from the web servers security group.
- D Create a network ACL for the web servers and allow port 443 from the load balancer. Create a network ACL for the MySQL servers and allow port 3306 from the web servers security group.
Xem giải thích
🧩 Phân tích chi tiết nội dung câu hỏi
Câu hỏi này thuộc chủ đề thiết kế VPC trên AWS (Virtual Private Cloud), tập trung vào việc áp dụng nguyên tắc least privilege (quyền truy cập tối thiểu) cho các tài nguyên trong kiến trúc đa tầng (multi-tier architecture). Cụ thể:
- Kiến trúc VPC: Có 2 public subnets cho Load Balancer (LB, thường là ALB/NLB), 2 private subnets cho web servers (chỉ sử dụng HTTPS - port 443), và 2 private subnets cho MySQL databases.
- Tình huống hiện tại: Solutions Architect đã tạo Security Group (SG) cho LB, cho phép inbound traffic trên port 443 từ 0.0.0.0/0 (toàn internet, phù hợp vì LB public-facing).
- Yêu cầu chính: Cấu hình thêm để đảm bảo mỗi tài nguyên chỉ có quyền truy cập tối thiểu cần thiết (least access required), tránh mở rộng không cần thiết (ví dụ: web servers không nên nhận traffic trực tiếp từ internet).
- Mục tiêu: Bảo mật luồng traffic: Internet → LB (443) → Web servers (443) → MySQL (3306). Không có traffic trực tiếp từ internet đến web hoặc DB.
🛠️ Nguyên tắc AWS liên quan (cập nhật đến 2024-2026):
- Security Groups (SG): Stateful (tự động allow return traffic), hoạt động ở instance level, chỉ cho phép inbound rules, có thể reference ID của SG khác (không cần IP cụ thể).
- Network ACLs (NACL): Stateless (cần rule inbound/outbound riêng), hoạt động ở subnet level, chỉ chấp nhận IP/CIDR (không reference SG).
- Best practice: Ưu tiên SG cho instance-level control, NACL làm lớp bảo vệ bổ sung (deny all nếu cần).
📘 Tài liệu tham khảo:
- AWS VPC Security Best Practices: https://docs.aws.amazon.com/vpc/latest/userguide/vpc-security-best-practices.html
- Security Groups vs. NACLs: https://docs.aws.amazon.com/vpc/latest/userguide/vpc-security-groups.html
- ALB Security: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-security.html (không thay đổi lớn đến 2026).
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Create a security group for the web servers and allow port 443 from the load balancer. Create a security group for the MySQL servers and allow port 3306 from the web servers security group.
Lý do:
- Áp dụng least privilege hoàn hảo:
- Web servers chỉ nhận traffic HTTPS (443) từ SG của LB (không từ 0.0.0.0/0, tránh expose trực tiếp).
- MySQL chỉ nhận traffic (3306) từ SG của web servers (chỉ web tier truy cập DB).
- Sử dụng SG thay vì NACL vì SG stateful, reference SG dễ dàng (traffic chỉ từ LB/web), và granular hơn (instance-level).
- Tuân thủ AWS best practices cho VPC multi-tier (2024+): SG chính cho app servers/DB, NACL optional cho subnet deny-all.
📋 Phân tích tất cả các phương án (đúng/sai)
-
❌ Phương án SAI: Create a security group for the web servers and allow port 443 from 0.0.0.0/0. Create a security group for the MySQL servers and allow port 3306 from the web servers security group.
Giải thích: Mặc dù dùng SG đúng cách cho MySQL (reference SG web), nhưng web servers mở port 443 từ 0.0.0.0/0 vi phạm least privilege (cho phép internet trực tiếp truy cập web, dù private subnet). Web chỉ cần từ LB! -
❌ Phương án SAI: Create a network ACL for the web servers and allow port 443 from 0.0.0.0/0. Create a network ACL for the MySQL servers and allow port 3306 from the web servers security group.
Giải thích:- NACL không hỗ trợ reference SG (chỉ IP/CIDR), nên "from web servers security group" không khả thi.
- Web mở 443 từ 0.0.0.0/0 vi phạm least privilege.
- NACL stateless cần rule outbound tương ứng, phức tạp hơn SG không cần thiết.
-
✅ Phương án ĐÚNG: Create a security group for the web servers and allow port 443 from the load balancer. Create a security group for the MySQL servers and allow port 3306 from the web servers security group.
Giải thích:- Web: Inbound 443 chỉ từ LB SG (least privilege, traffic chain đúng: Internet→LB→Web).
- MySQL: Inbound 3306 từ web SG (chỉ web tier truy cập).
- SG stateful + reference ID lý tưởng cho kiến trúc này, không cần IP hardcode.
-
❌ Phương án SAI: Create a network ACL for the web servers and allow port 443 from the load balancer. Create a network ACL for the MySQL servers and allow port 3306 from the web servers security group.
Giải thích:- NACL không reference được SG của LB/web ("from load balancer" hoặc "web servers SG" lỗi syntax).
- Phải dùng IP/CIDR của LB/web subnets → kém linh hoạt, không scale (nếu instance thay đổi).
- NACL subnet-level kém granular so với SG instance-level, không ưu tiên cho trường hợp này.
🧠 Lời khuyên DevOps: Trong DOP-C02 exam (2024+), luôn ưu tiên SG cho least privilege ở app/DB tier. Kết hợp NACL nếu cần macro-control (e.g., deny RDP). Test bằng AWS VPC Flow Logs để verify! 🚀