Ngân hàng đề — AWS Certified Developer Associate

Tìm thấy 1356 câu.

Câu 861
A company is building a web application on AWS. When a customer sends a request, the application will generate reports and then make the reports available to the customer within one hour. Reports should be accessible to the customer for 8 hours. Some reports are larger than 1 MB. Each report is unique to the customer. The application should delete all reports that are older than 2 days.
Which solution will meet these requirements with the LEAST operational overhead?
  1. A Generate the reports and then store the reports as Amazon DynamoDB items that have a specified TTL. Generate a URL that retrieves the reports from DynamoDB. Provide the URL to customers through the web application.
  2. B Generate the reports and then store the reports in an Amazon S3 bucket that uses server-side encryption. Attach the reports to an Amazon Simple Notification Service (Amazon SNS) message. Subscribe the customer to email notifications from Amazon SNS.
  3. C Generate the reports and then store the reports in an Amazon S3 bucket that uses server-side encryption. Generate a presigned URL that contains an expiration date Provide the URL to customers through the web application. Add S3 Lifecycle configuration rules to the S3 bucket to delete old reports.
  4. D Generate the reports and then store the reports in an Amazon RDS database with a date stamp. Generate an URL that retrieves the reports from the RDS database. Provide the URL to customers through the web application. Schedule an hourly AWS Lambda function to delete database records that have expired date stamps.
Xem giải thích

🧩 Giải thích nội dung câu hỏi

Câu hỏi yêu cầu tìm giải pháp lưu trữ và quản lý báo cáo (reports) cho một ứng dụng web trên AWS với các yêu cầu cụ thể sau:

  • Khi khách hàng gửi request, ứng dụng tạo báo cáo và làm cho báo cáo có sẵn trong vòng 1 giờ.
  • Báo cáo có thể truy cập được trong 8 giờ.
  • Một số báo cáo lớn hơn 1 MB, và mỗi báo cáo unique cho từng khách hàng.
  • Xóa tất cả báo cáo cũ hơn 2 ngày.
  • Giải pháp phải có operational overhead thấp nhất (ít công quản lý nhất).

🛠️ Yêu cầu chính: Lưu trữ file lớn, bảo mật, chia sẻ URL tạm thời (expire sau 8h), tự động xóa sau 2 ngày, không cần quản lý thủ công nhiều. AWS dịch vụ phù hợp nhất là Amazon S3 vì hỗ trợ file lớn, presigned URL (URL tạm thời an toàn), và Lifecycle policies (tự động xóa).

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng:
Generate the reports and then store the reports in an Amazon S3 bucket that uses server-side encryption. Generate a presigned URL that contains an expiration date Provide the URL to customers through the web application. Add S3 Lifecycle configuration rules to the S3 bucket to delete old reports.

Lý do chọn đáp án này (theo kiến thức AWS cập nhật 2026):

  • 📦 Lưu trữ trên S3: S3 lý tưởng cho file lớn (>1MB), hỗ trợ server-side encryption (SSE) để bảo mật dữ liệu tại rest.
  • 🔗 Presigned URL: Tạo URL tạm thời expire sau 8 giờ (có thể set expiration lên đến 7 ngày, phù hợp), khách hàng truy cập qua web app mà không cần IAM credentials.
  • 🧹 S3 Lifecycle rules: Tự động xóa object sau 2 ngày (dựa trên ngày tạo hoặc tag), không cần code hay Lambda, chỉ config một lần – least operational overhead.
  • ⏱️ Đáp ứng đầy đủ: Generate trong 1h (async process), unique per customer (object key riêng), tự động hóa cao. Đây là best practice AWS Well-Architected Framework (Reliability & Security pillars).

🔍 Phân tích tất cả các phương án

  • Phương án 1 (❌ SAI):
    Generate the reports and then store the reports as Amazon DynamoDB items that have a specified TTL. Generate a URL that retrieves the reports from DynamoDB. Provide the URL to customers through the web application.
    Giải thích sai: DynamoDB giới hạn 400 KB/item (cập nhật 2026 vẫn vậy), không phù hợp file >1MB. TTL chỉ xóa item sau 2 ngày nhưng lưu binary lớn tốn chi phí cao, overhead quản lý URL retrieval lớn (cần proxy qua API Gateway/Lambda). Không phải dịch vụ lưu file.

  • Phương án 2 (❌ SAI):
    Generate the reports and then store the reports in an Amazon S3 bucket that uses server-side encryption. Attach the reports to an Amazon Simple Notification Service (Amazon SNS) message. Subscribe the customer to email notifications from Amazon SNS.
    Giải thích sai: SNS là pub/sub messaging, không lưu trữ lâu dài (attachments chỉ tạm thời). Phải subscribe email thủ công cho từng customer → overhead cao (quản lý subscriptions, opt-out). Không cung cấp URL qua web app, và không tự động xóa sau 2 ngày (cần thêm logic). Không khớp yêu cầu "accessible 8 hours via URL".

  • Phương án 3 (✅ ĐÚNG):
    Generate the reports and then store the reports in an Amazon S3 bucket that uses server-side encryption. Generate a presigned URL that contains an expiration date Provide the URL to customers through the web application. Add S3 Lifecycle configuration rules to the S3 bucket to delete old reports.
    Giải thích đúng: Như phần trên, tự động hóa hoàn toàn với presigned URL (expire 8h) và Lifecycle (delete 2 days). S3 scale vô hạn, SSE bảo mật, zero ongoing ops – phù hợp least overhead.

  • Phương án 4 (❌ SAI):
    Generate the reports and then store the reports in an Amazon RDS database with a date stamp. Generate an URL that retrieves the reports from the RDS database. Provide the URL to customers through the web application. Schedule an hourly AWS Lambda function to delete database records that have expired date stamps.
    Giải thích sai: RDS (Relational DB) không dành cho binary lớn (>1MB tốn performance/storage, best practice tránh BLOB). Cần Lambda hourly cron → overhead cao (monitor, scale, cost). URL retrieval cần app server proxy (không an toàn), không tự động như S3.

📘 Tài liệu tham khảo (AWS cập nhật 2026)

Giải pháp này đảm bảo serverless, scalable, secure! 🚀

Câu 862
A company has deployed an application on AWS Elastic Beanstalk. The company has configured the Auto Scaling group that is associated with the Elastic Beanstalk environment to have five Amazon EC2 instances. If the capacity is fewer than four EC2 instances during the deployment, application performance degrades. The company is using the all-at-once deployment policy.
What is the MOST cost-effective way to solve the deployment issue?
  1. A Change the Auto Scaling group to six desired instances.
  2. B Change the deployment policy to traffic splitting. Specify an evaluation time of 1 hour.
  3. C Change the deployment policy to rolling with additional batch. Specify a batch size of 1.
  4. D Change the deployment policy to rolling. Specify a batch size of 2.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi xoay quanh vấn đề deploy ứng dụng trên AWS Elastic Beanstalk với Auto Scaling Group (ASG) được cấu hình 5 EC2 instances.

  • Vấn đề chính: Trong quá trình deployment, nếu số lượng instances healthy (có khả năng xử lý traffic) ít hơn 4, hiệu suất ứng dụng sẽ degrade (giảm sút).
  • Deployment policy hiện tại: All-at-once – chính sách này deploy phiên bản mới lên tất cả instances cùng lúc, dẫn đến tất cả instances tạm thời unhealthy (restart, install app), khiến capacity giảm xuống 0 tạm thời → dưới 4 → performance degrade.
  • Mục tiêu: Tìm cách giải quyết cost-effective nhất (tiết kiệm chi phí nhất), nghĩa là tránh tăng capacity vĩnh viễn, chỉ tạm thời nếu cần, và đảm bảo luôn có ít nhất 4 instances healthy trong deployment.
  • Bối cảnh AWS mới nhất (2026): Elastic Beanstalk hỗ trợ các deployment policy như All-at-once, Rolling, Rolling with additional batch, Immutable, Traffic splitting (với traffic shifting dần dần qua ALB). ASG tích hợp chặt chẽ để scale tạm thời.

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Change the deployment policy to rolling with additional batch. Specify a batch size of 1.

Lý do 🛠️:

  • Chính sách Rolling with additional batch sẽ launch thêm batch size instances mới (ở đây là 1 instance) để deploy trước, đảm bảo capacity không bao giờ giảm dưới mức gốc (5 instances).
    • Quy trình: Launch 1 instance extra → deploy app mới lên nó (bây giờ total 6, healthy=6). Sau đó, thay thế dần các instance cũ theo batch size=1 (terminate 1 cũ, launch 1 mới deploy). Luôn giữ ít nhất 5 healthy instances → vượt yêu cầu (>=4).
  • Cost-effective nhất vì: Instances thêm chỉ tạm thời (khoảng 10-30 phút deployment), ASG tự scale down sau. Không tốn kém như tăng desired capacity vĩnh viễn.
  • So với các option khác, đây là cách tối ưu chi phí và an toàn nhất theo best practices AWS (tránh dip capacity mà không over-provision).

📋 Giải thích tất cả các phương án (đúng/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. Phần giải thích hoàn toàn bằng tiếng Việt:

  • ❌ [SAI] Change the Auto Scaling group to six desired instances.
    Giải thích: Tăng desired capacity ASG lên 6 vĩnh viễn → luôn có 6 instances chạy, giải quyết được dip capacity (vì all-at-once chỉ dip xuống 6-6=0? Không, vẫn dip tạm thời xuống gần 0). Nhưng không cost-effective vì tốn thêm chi phí ~20% liên tục (EC2 chạy 24/7), không tận dụng tạm thời scale. AWS khuyến nghị tránh over-provision vĩnh viễn.

  • ❌ [SAI] Change the deployment policy to traffic splitting. Specify an evaluation time of 1 hour.
    Giải thích: Traffic splitting là canary deployment, shift traffic dần từ old sang new instances qua ALB với evaluation periods (1 giờ ở đây quá dài). Nó launch replacement instances dần, nhưng trong quá trình deploy ban đầu, vẫn có dip capacity tạm thời nếu batch lớn (không chỉ định batch size). Evaluation 1h kéo dài deployment → tăng chi phí instances tạm thời cao hơn, và có thể không đảm bảo >=4 healthy ngay lập tức. Không phải "most cost-effective".

  • ✅ [ĐÚNG] Change the deployment policy to rolling with additional batch. Specify a batch size of 1.
    Giải thích: Như đã nêu ở phần đáp án đúng. Hoàn hảo cho case 5 instances cần >=4 healthy: Không dip capacity, batch nhỏ (1) đảm bảo an toàn cao, chi phí thấp chỉ tạm thời. Theo docs AWS, đây là policy lý tưởng cho high availability mà tiết kiệm.

  • ❌ [SAI] Change the deployment policy to rolling. Specify a batch size of 2.
    Giải thích: Rolling thông thường thay thế instances theo batch in-place (không thêm extra). Với batch=2 trên 5 instances: Deploy batch đầu → healthy tạm =5-2=3 (<4 → degrade). Batch sau tương tự. Không giải quyết vấn đề, vẫn dip xuống dưới 4.

📘 Tài liệu tham khảo (AWS cập nhật 2026)

Câu 863
A developer is incorporating AWS X-Ray into an application that handles personal identifiable information (PII). The application is hosted on Amazon EC2 instances. The application trace messages include encrypted PII and go to Amazon CloudWatch. The developer needs to ensure that no PII goes outside of the EC2 instances.
Which solution will meet these requirements?
  1. A Manually instrument the X-Ray SDK in the application code.
  2. B Use the X-Ray auto-instrumentation agent.
  3. C Use Amazon Macie to detect and hide PII. Call the X-Ray API from AWS Lambda.
  4. D Use AWS Distro for Open Telemetry.
Xem giải thích

🛠️ Phân tích câu hỏi trắc nghiệm AWS X-Ray bởi AWS Certified DevOps Engineer Professional

📝 Giải thích nội dung câu hỏi một cách chi tiết:
Câu hỏi xoay quanh việc tích hợp AWS X-Ray vào một ứng dụng xử lý PII (Personal Identifiable Information - thông tin nhận dạng cá nhân nhạy cảm), ứng dụng được host trên Amazon EC2 instances. Các trace messages từ ứng dụng bao gồm PII đã được mã hóa và hiện đang được gửi đến Amazon CloudWatch. Yêu cầu chính là đảm bảo không có bất kỳ PII nào rời khỏi EC2 instances, nghĩa là traces chứa PII phải được giữ hoàn toàn trong phạm vi EC2 (không truyền ra ngoài đến các service AWS như X-Ray service hoặc CloudWatch).

🧩 Bối cảnh kỹ thuật: AWS X-Ray sử dụng SDK và daemon để thu thập traces từ ứng dụng. SDK instrument code để tạo segments/subsegments, sau đó gửi đến daemon trên cùng instance, daemon forward đến X-Ray service (tích hợp với CloudWatch Logs/X-Ray service). Vấn đề là traces hiện chứa PII encrypted đang "rơi" ra ngoài EC2. Giải pháp cần kiểm soát chặt chẽ việc instrument để filter hoặc loại bỏ PII trước khi traces rời instance, tuân thủ bảo mật dữ liệu nhạy cảm (theo AWS best practices về data privacy đến 2026).

✅ Đáp án đúng: Manually instrument the X-Ray SDK in the application code.
Lý do lựa chọn: Phương án này cho phép developer tùy chỉnh code thủ công để kiểm soát chính xác dữ liệu trong traces. Developer có thể loại bỏ hoặc filter PII trước khi tạo segments/subsegments, và không gửi traces chứa PII đến X-Ray daemon (daemon chỉ forward traces ra ngoài). SDK chạy hoàn toàn trên EC2, đảm bảo PII không rời instance. Đây là cách an toàn nhất cho dữ liệu nhạy cảm, phù hợp với AWS X-Ray Developer Guide (cập nhật 2026), nơi khuyến nghị manual instrumentation cho trường hợp custom logic như filtering sensitive data.

🧩 Giải thích tất cả các phương án (đúng/sai):

  • ✅ Manually instrument the X-Ray SDK in the application code.
    Phương án ĐÚNG vì developer kiểm soát 100% code instrumentation qua X-Ray SDK (hỗ trợ Java, Node.js, Python, v.v.). Có thể sử dụng annotations/metadata để lưu PII local (không gửi), hoặc config SDK chỉ gửi traces sạch. Không phụ thuộc daemon tự động, tránh PII leak ra X-Ray service/CloudWatch.

  • ❌ Use the X-Ray auto-instrumentation agent.
    Phương án SAI vì auto-instrumentation agent (như X-Ray daemon với auto-mode) tự động capture traces từ HTTP requests, logs, v.v., mà không cho phép filter chi tiết PII ở mức code. Traces vẫn được gửi đến daemon và forward ra ngoài EC2 đến X-Ray service, vi phạm yêu cầu "no PII outside EC2".

  • ❌ Use Amazon Macie to detect and hide PII. Call the X-Ray API from AWS Lambda.
    Phương án SAI vì Amazon Macie chỉ detect PII trong S3/CloudWatch, không tích hợp trực tiếp X-Ray traces trên EC2. Hơn nữa, gọi X-Ray API từ Lambda sẽ chạy code ngoài EC2 (Lambda là serverless ngoài instance), khiến PII phải truyền ra Lambda → vi phạm nghiêm trọng yêu cầu giữ PII trong EC2.

  • ❌ Use AWS Distro for Open Telemetry.
    Phương án SAI vì AWS Distro for OpenTelemetry (ADOT) là collector thay thế X-Ray daemon, hỗ trợ OpenTelemetry protocol. Nó tự động thu thập và forward traces đến backend như X-Ray/CloudWatch ngoài EC2, không có cơ chế filter PII thủ công ở mức code, dẫn đến PII leak ra ngoài.

📘 Tài liệu tham khảo (cập nhật mới nhất AWS 2026):

Hy vọng phân tích này giúp bạn ôn thi DOP-C02 hiệu quả! 🚀 Nếu cần thêm ví dụ code, hãy hỏi nhé.

Câu 864
A developer is migrating some features from a legacy monolithic application to use AWS Lambda functions instead. The application currently stores data in an Amazon Aurora DB cluster that runs in private subnets in a VPC. The AWS account has one VPC deployed. The Lambda functions and the DB cluster are deployed in the same AWS Region in the same AWS account.
The developer needs to ensure that the Lambda functions can securely access the DB cluster without crossing the public internet.
Which solution will meet these requirements?
  1. A Configure the DB cluster's public access setting to Yes.
  2. B Configure an Amazon RDS database proxy for he Lambda functions.
  3. C Configure a NAT gateway and a security group for the Lambda functions.
  4. D Configure the VPC, subnets, and a security group for the Lambda functions.
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 xoay quanh việc di chuyển một phần tính năng từ ứng dụng monolithic cũ sang sử dụng AWS Lambda functions, trong khi dữ liệu được lưu trữ trong Amazon Aurora DB cluster nằm ở private subnets của một VPC duy nhất. Tất cả đều ở cùng Region và cùng AWS account.
Yêu cầu chính: Lambda functions phải truy cập Aurora DB một cách an toàn, không đi qua public internet.
🛠️ Vấn đề cốt lõi: Lambda mặc định chạy ngoài VPC (serverless), nên để truy cập tài nguyên private trong VPC (như Aurora ở private subnets), Lambda cần được cấu hình VPC-specific để traffic di chuyển nội bộ VPC qua private IP, sử dụng security groups kiểm soát. Không dùng public internet tránh rủi ro bảo mật và tuân thủ nguyên tắc least privilege.
📘 Kiến thức AWS cập nhật 2026: Lambda hỗ trợ VPC integration đầy đủ (từ 2019, ổn định đến nay), kết hợp ENI (Elastic Network Interface) để Lambda nhận private IP trong subnets được chỉ định.

✅ Đáp án đúng: Configure the VPC, subnets, and a security group for the Lambda functions.

Lý do lựa chọn:
Đây là giải pháp trực tiếp và an toàn nhất. Bằng cách gắn Lambda vào cùng VPC, chọn private subnets (cùng hoặc peering với subnets của DB), và cấu hình security group (SG) cho Lambda (outbound đến DB port, ví dụ 3306/5432), traffic sẽ di chuyển hoàn toàn nội bộ VPC qua private networking. Không cần NAT hay public access, đảm bảo zero public internet exposure.
🛠️ Cách triển khai:

  • Trong Lambda console/code: Chọn VPC, subnets private, và SG mới/riêng cho Lambda.
  • SG Lambda: Outbound allow đến inbound SG của Aurora.
  • Aurora SG: Inbound từ Lambda SG.
    Kết quả: Lambda tạo ENI trong subnets, truy cập DB qua private IP. Hiệu suất cao, bảo mật tốt (theo AWS Well-Architected Framework - Reliability & Security pillars).

❌ Phân tích tất cả các phương án

  • Configure the DB cluster's public access setting to Yes.
    ❌ Sai: Bật public access cho Aurora làm DB tiếp nhận kết nối từ internet (qua public endpoints). Lambda ngoài VPC vẫn phải đi qua public internet → vi phạm yêu cầu "without crossing the public internet". Rủi ro bảo mật cao (DDoS, unauthorized access), không khuyến nghị cho private data. AWS docs khuyên chỉ dùng cho testing, không production.

  • Configure an Amazon RDS database proxy for the Lambda functions.
    ❌ Sai: RDS Proxy (ra mắt 2020, cập nhật hỗ trợ Aurora/Postgres/MySQL đến 2026) giúp connection pooling, multiplexing cho Lambda (giảm cold start connections). Tuy nhiên, Proxy vẫn deploy trong VPC/private subnets, và Lambda vẫn cần VPC config để truy cập Proxy/DB private. Không giải quyết vấn đề networking chính → Lambda traffic vẫn public nếu không VPC-attached.

  • Configure a NAT gateway and a security group for the Lambda functions.
    ❌ Sai: NAT Gateway dùng cho outbound traffic từ private subnets ra internet (ví dụ Lambda gọi API public). Ở đây, Lambda cần inbound/outbound nội bộ VPC đến DB private, không liên quan NAT (thậm chí NAT làm phức tạp hóa, tốn chi phí). SG chỉ là phần phụ, thiếu VPC/subnets → Lambda không thể route đến private DB subnets.

  • Configure the VPC, subnets, and a security group for the Lambda functions.
    ✅ Đúng: Như giải thích trên, đây là giải pháp chuẩn AWS cho Lambda access VPC resources private. Traffic pure private, scalable với Lambda (ENI auto-scale).

📘 Tài liệu tham khảo (AWS cập nhật 2026)

🛡️ Lời khuyên DevOps: Test bằng CloudWatch Logs/VPC Flow Logs để verify traffic private. Scale subnets nếu Lambda concurrency cao!

Câu 865
A developer is building a new application on AWS. The application uses an AWS Lambda function that retrieves information from an Amazon DynamoDB table. The developer hard coded the DynamoDB table name into the Lambda function code. The table name might change over time. The developer does not want to modify the Lambda code if the table name changes.
Which solution will meet these requirements MOST efficiently?
  1. A Create a Lambda environment variable to store the table name. Use the standard method for the programming language to retrieve the variable.
  2. B Store the table name in a file. Store the file in the /tmp folder. Use the SDK for the programming language to retrieve the table name.
  3. C Create a file to store the table name. Zip the file and upload the file to the Lambda layer. Use the SDK for the programming language to retrieve the table name.
  4. D Create a global variable that is outside the handler in the Lambda function to store the table name.
Xem giải thích

🧩 Giải thích nội dung câu hỏi

Câu hỏi xoay quanh một lập trình viên đang phát triển ứng dụng mới trên AWS, sử dụng AWS Lambda để truy xuất dữ liệu từ bảng Amazon DynamoDB. Vấn đề là tên bảng DynamoDB đã được hard-code trực tiếp vào mã nguồn Lambda (ví dụ: viết chết trong code). Tuy nhiên, tên bảng có thể thay đổi theo thời gian, và lập trình viên không muốn sửa đổi code Lambda mỗi khi thay đổi. Yêu cầu là tìm giải pháp hiệu quả nhất (MOST efficiently) để xử lý tình huống này, đảm bảo tính linh hoạt mà không cần redeploy code.

Mục tiêu chính: Tách biệt cấu hình (table name) khỏi code logic, tuân thủ nguyên tắc configuration management trong AWS best practices, giúp dễ dàng cập nhật mà không ảnh hưởng đến deployment pipeline. 🛠️

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Create a Lambda environment variable to store the table name. Use the standard method for the programming language to retrieve the variable.

Lý do:

  • Đây là giải pháp hiệu quả nhất theo best practices AWS (cập nhật đến 2026). Lambda hỗ trợ environment variables native, cho phép lưu trữ table name như một biến môi trường (ví dụ: process.env.TABLE_NAME trong Node.js hoặc os.environ['TABLE_NAME'] trong Python).
  • Ưu điểm: Có thể thay đổi giá trị qua AWS Console, CLI, CDK/Terraform mà KHÔNG cần redeploy code Lambda. Lambda tự động inject biến này vào runtime. Hỗ trợ encryption với AWS KMS và versioning.
  • Tiết kiệm chi phí, nhanh chóng, scalable, phù hợp với 12-Factor App methodology. 🚀

📝 Phân tích tất cả các phương án (đúng và sai)

Dưới đây là phân tích chi tiết từng lựa chọn. Tôi giữ nguyên nội dung văn bản gốc bằng tiếng Anh, chỉ giải thích bằng tiếng Việt với emoji để dễ theo dõi:

  • ✅ Create a Lambda environment variable to store the table name. Use the standard method for the programming language to retrieve the variable.
    Đúng: Như đã giải thích ở trên. Giải pháp native, linh hoạt cao, không yêu cầu thêm tài nguyên. AWS khuyến nghị sử dụng cho config động. Best practice cho DevOps! 🏆

  • ❌ Store the table name in a file. Store the file in the /tmp folder. Use the SDK for the programming language to retrieve the table name.
    Sai: Thư mục /tmp trong Lambda là writable nhưng KHÔNG persistent (chỉ tồn tại tạm thời trong execution ~15 phút max). Khi Lambda cold start hoặc restart, file sẽ bị xóa, dẫn đến lỗi runtime. Không hiệu quả, không scalable, vi phạm nguyên tắc immutable deployment. Phải viết file mỗi lần invoke – tốn kém và phức tạp. 😵

  • ❌ Create a file to store the table name. Zip the file and upload the file to the Lambda layer. Use the SDK for the programming language to retrieve the table name.
    Sai: Lambda Layers dùng để chia sẻ code thư viện chung (như dependencies), không phải config động. Để thay đổi table name, phải tạo layer mới, zip lại và publish – tương đương redeploy, vi phạm yêu cầu "không sửa code". Layers immutable sau publish, khó maintain cho config thay đổi thường xuyên. Không phải best practice cho dynamic config. 🔒

  • ❌ Create a global variable that is outside the handler in the Lambda function to store the table name.
    Sai: Biến global ngoài handler vẫn là hard-code trực tiếp vào code (ví dụ: let TABLE_NAME = "myTable";). Khi table name thay đổi, phải sửa code và redeploy Lambda – hoàn toàn trái với yêu cầu. Global vars chỉ init một lần per container, nhưng vẫn không linh hoạt cho config management. Không giải quyết vấn đề gốc rễ. 📉

📘 Tài liệu tham khảo (AWS cập nhật mới nhất đến 2026)

Giải pháp này giúp ứng dụng production-ready, dễ CI/CD với CodePipeline! Nếu cần ví dụ code cụ thể, hãy hỏi thêm nhé. 💡

Câu 866
A company has a critical application on AWS. The application exposes an HTTP API by using Amazon API Gateway. The API is integrated with an AWS Lambda function. The application stores data in an Amazon RDS for MySQL DB instance with 2 virtual CPUs (vCPUs) and 64 GB of RAM.

Customers have reported that some of the API calls return HTTP 500 Internal Server Error responses. Amazon CloudWatch Logs shows errors for “too many connections.” The errors occur during peak usage times that are unpredictable.

The company needs to make the application resilient. The database cannot be down outside of scheduled maintenance hours.

Which solution will meet these requirements?
  1. A Decrease the number of vCPUs for the DB instance. Increase the max_connections setting.
  2. B Use Amazon RDS Proxy to create a proxy that connects to the DB instance. Update the Lambda function to connect to the proxy.
  3. C Add a CloudWatch alarm that changes the DB instance class when the number of connections increases to more than 1,000.
  4. D Add an Amazon EventBridge rule that increases the max_connections setting of the DB instance when CPU utilization is above 75%.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi mô tả một ứng dụng quan trọng trên AWS sử dụng Amazon API Gateway để expose HTTP API, tích hợp với AWS Lambda làm backend, và lưu trữ dữ liệu trên Amazon RDS for MySQL (instance có 2 vCPUs và 64 GB RAM). 🔍 Vấn đề chính: Khách hàng gặp lỗi HTTP 500 Internal Server Error từ một số API calls, CloudWatch Logs ghi nhận lỗi "too many connections" (quá nhiều kết nối đến DB). Lỗi xảy ra vào giờ cao điểm không dự đoán trước (unpredictable peak usage).

Yêu cầu giải pháp: Làm ứng dụng resilient (bền vững, chịu lỗi cao), DB không được downtime trừ giờ bảo trì định kỳ. 🛡️ Thách thức cốt lõi là Lambda scale nhanh chóng (serverless) gây spike connections đột ngột đến RDS, vượt quá giới hạn max_connections của DB instance. Giải pháp cần connection pooling để tái sử dụng kết nối, tránh overload DB mà không gây downtime.

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Use Amazon RDS Proxy to create a proxy that connects to the DB instance. Update the Lambda function to connect to the proxy.

Lý do chi tiết:

  • RDS Proxy (ra mắt 2020, cập nhật liên tục đến 2026) là dịch vụ fully managed connection pooler dành riêng cho RDS, hỗ trợ MySQL. Nó pool và multiplex connections từ Lambda đến DB, giảm số connections thực tế đến RDS (chỉ cần vài chục thay vì hàng nghìn từ Lambda scale).
  • Lambda connect qua Proxy thay vì trực tiếp DB → giảm latency, tăng resilience với failover tự động (nếu Multi-AZ), và zero-downtime vì Proxy không yêu cầu restart DB.
  • Hoàn hảo cho unpredictable peaks vì Proxy handle spike mà không thay đổi DB config. Theo AWS best practices (2026), đây là giải pháp chuẩn cho serverless + RDS. 🚀

📋 Phân tích tất cả các phương án (đúng/sai)

  • ❌ [SAI] Decrease the number of vCPUs for the DB instance. Increase the max_connections setting.
    Giải thích sai: Giảm vCPUs (từ 2 xuống thấp hơn) sẽ giảm giới hạn max_connections (AWS tính max_connections dựa trên instance size, công thức ≈ (vCPUs * 2500) + buffer). Tăng max_connections thủ công yêu cầu parameter group modify + restart DB → gây downtime, vi phạm yêu cầu. Không giải quyết gốc rễ spike từ Lambda, chỉ là workaround kém hiệu quả và làm performance tệ hơn. 😞

  • ✅ [ĐÚNG] Use Amazon RDS Proxy to create a proxy that connects to the DB instance. Update the Lambda function to connect to the proxy.
    Giải thích đúng: Như phần trên, RDS Proxy pool connections hiệu quả (hỗ trợ lên đến 100x multiplexing), tích hợp seamless với Lambda/API Gateway. Không downtime, auto-scale theo traffic, hỗ trợ IAM auth và secrets rotation. Giải quyết chính xác "too many connections" ở peaks unpredictable. Theo docs AWS 2026, giảm connections 66-90% trong serverless workloads. 🎯

  • ❌ [SAI] Add a CloudWatch alarm that changes the DB instance class when the number of connections increases to more than 1,000.
    Giải thích sai: Vertical scale DB instance class (thay đổi kích thước) yêu cầu downtime/reboot (trừ một số trường hợp live scaling giới hạn, nhưng không đảm bảo cho MySQL với connections cao). Alarm + modify DB không kịp với peaks unpredictable, có thể gây cascade failure. Không dùng metric connections trực tiếp cho auto-scaling (RDS dùng CPU/Memory/Connections cho alarms, nhưng scale vẫn manual-ish). Không resilient. ⚠️

  • ❌ [SAI] Add an Amazon EventBridge rule that increases the max_connections setting of the DB instance when CPU utilization is above 75%.
    Giải thích sai: max_connections là parameter dynamic nhưng giới hạn, thay đổi yêu cầu DB restart → downtime. EventBridge rule có thể trigger Lambda modify parameter group, nhưng CPU >75% không liên quan trực tiếp đến connections (lỗi là connections, không phải CPU). Peaks unpredictable → rule không kịp, và không giải quyết pooling gốc rễ. EventBridge tốt cho events, nhưng sai use case. 🚫

📘 Tài liệu tham khảo (cập nhật AWS 2026)

Giải pháp này đảm bảo zero-downtime resilience theo chuẩn DevOps Professional! 🏆

Câu 867
A company has installed smart meters in all its customer locations. The smart meters measure power usage at 1-minute intervals and send the usage readings to a remote endpoint for collection. The company needs to create an endpoint that will receive the smart meter readings and store the readings in a database. The company wants to store the location ID and timestamp information.

The company wants to give its customers low-latency access to their current usage and historical usage on demand. The company expects demand to increase significantly. The solution must not impact performance or include downtime while scaling.

Which solution will meet these requirements MOST cost-effectively?
  1. A Store the smart meter readings in an Amazon RDS database. Create an index on the location ID and timestamp columns. Use the columns to filter on the customers' data.
  2. B Store the smart meter readings in an Amazon DynamoDB table. Create a composite key by using the location ID and timestamp columns. Use the columns to filter on the customers' data.
  3. C Store the smart meter readings in Amazon ElastiCache for Redis. Create a SortedSet key by using the location ID and timestamp columns. Use the columns to filter on the customers' data.
  4. D Store the smart meter readings in Amazon S3. Partition the data by using the location ID and timestamp columns. Use Amazon Athena to filter on the customers' data.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi mô tả một tình huống thực tế trong AWS liên quan đến IoT và dữ liệu thời gian thực từ smart meters (thiết bị đo lường điện năng). Các thiết bị này thu thập dữ liệu power usage mỗi 1 phút và gửi đến một endpoint từ xa để thu thập. Yêu cầu chính bao gồm:

  • 📥 Tạo endpoint nhận dữ liệu và lưu trữ vào database với location ID (ID vị trí khách hàng) và timestamp (thời gian đo).
  • 👥 Khách hàng truy cập on-demand: Cần low-latency (truy cập nhanh, độ trễ thấp) cho current usage (sử dụng hiện tại) và historical usage (lịch sử sử dụng).
  • 🚀 Scale tự động: Demand tăng mạnh (do số lượng meters lớn), giải pháp phải scale mà không downtime, không ảnh hưởng performance.
  • 💰 MOST cost-effectively: Ưu tiên giải pháp tiết kiệm chi phí nhất, phù hợp với kiến trúc serverless và pay-per-use (cập nhật đến AWS 2026, DynamoDB hỗ trợ on-demand capacity mode với auto-scaling mạnh mẽ).

Đây là bài toán điển hình cho high-throughput writes (ghi dữ liệu liên tục từ IoT) kết hợp low-latency point queries (truy vấn theo location ID và timestamp), đòi hỏi database NoSQL hỗ trợ partitioning và auto-scaling.

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Store the smart meter readings in an Amazon DynamoDB table. Create a composite key by using the location ID and timestamp columns. Use the columns to filter on the customers' data.

Lý do chọn 🛠️:

  • DynamoDB là dịch vụ NoSQL fully managed, lý tưởng cho IoT workloads với millions of writes/sec (dữ liệu mỗi phút từ hàng triệu meters).
  • Composite key (Partition Key: location ID; Sort Key: timestamp) cho phép efficient queries theo location mà không scan toàn bộ table, đảm bảo low-latency (<10ms) cho current/historical data.
  • Auto-scaling (on-demand mode hoặc provisioned với auto-scaling) không downtime, hỗ trợ DynamoDB Global Tables cho multi-region nếu cần.
  • Cost-effective: Pay-per-request, không phí idle, tiết kiệm hơn RDS/S3 cho real-time access (theo AWS Well-Architected Framework 2026, ưu tiên DynamoDB cho IoT time-series).
  • Endpoint có thể dùng API Gateway + Lambda để ingest data vào DynamoDB.

📋 Phân tích tất cả các phương án (đúng/sai)

Dưới đây là phân tích từng lựa chọn, giữ nguyên nội dung gốc bằng tiếng Anh. Mỗi phương án được đánh giá với ✅ (đúng) hoặc ❌ (sai), kèm giải thích chi tiết bằng tiếng Việt dựa trên best practices AWS mới nhất (2026).

  • ❌ Store the smart meter readings in an Amazon RDS database. Create an index on the location ID and timestamp columns. Use the columns to filter on the customers' data.
    Phân tích sai: RDS (Relational DB như MySQL/PostgreSQL) phù hợp cho structured data nhưng kém cho high-write IoT (mỗi phút x hàng triệu records gây bottleneck). Index giúp filter nhưng scale khó (vertical scaling hoặc read replicas có downtime/pause). Latency cao (>100ms cho queries), chi phí cao (always-on instances), không auto-scale seamless như DynamoDB. Vi phạm yêu cầu low-latency và no-downtime scaling.

  • ✅ Store the smart meter readings in an Amazon DynamoDB table. Create a composite key by using the location ID and timestamp columns. Use the columns to filter on the customers' data.
    Phân tích đúng: Như đã giải thích ở trên. Composite key (PK: location ID, SK: timestamp) hỗ trợ Query API hiệu quả, kết hợp GSI (Global Secondary Index) nếu cần filter phức tạp. Hỗ trợ TTL cho historical data cũ, DynamoDB Streams cho processing real-time. Scale vô hạn, cost ~0.25$/million writes/reads (rẻ nhất cho workload này).

  • ❌ Store the smart meter readings in Amazon ElastiCache for Redis. Create a SortedSet key by using the location ID and timestamp columns. Use the columns to filter on the customers' data.
    Phân tích sai: ElastiCache Redis là in-memory caching siêu nhanh (sub-ms latency), SortedSet (ZSET) tốt cho time-series sort. Nhưng không phải persistent storage chính (dữ liệu có thể mất nếu eviction/memory pressure), chi phí cao (~gấp 5-10x DynamoDB cho large datasets). Scale cluster có downtime/replication lag, không ideal cho historical data dài hạn hoặc terabyte-scale từ IoT.

  • ❌ Store the smart meter readings in Amazon S3. Partition the data by using the location ID and timestamp columns. Use Amazon Athena to filter on the customers' data.
    Phân tích sai: S3 cost-effective storage (pennies/GB), partitioning (location/date-hour) tốt cho analytics. Nhưng Athena (serverless query trên S3) có latency cao (seconds đến phút do full scan partitions), không phù hợp low-latency on-demand (current usage cần <1s). Ingest cần thêm ETL (Firehose/Kinesis), scale OK nhưng performance không ổn định với demand spike.

📘 Tài liệu tham khảo (AWS cập nhật 2026)

  • DynamoDB Developer Guide: Composite Keys & Queries – Best for IoT time-series.
  • AWS IoT Core Best Practices: Storing Device Data – Khuyến nghị DynamoDB cho low-latency metering.
  • Well-Architected Framework (Reliability Pillar): Scaling Databases – DynamoDB no-downtime scaling.
  • AWS re:Invent 2025 Talks: DOP204 - "Scaling IoT at Planetary Scale with DynamoDB".

Giải pháp này đảm bảo serverless, resilient và economical! 🚀 Nếu cần thiết kế chi tiết hơn (như API Gateway integration), hãy hỏi thêm nhé! 😊

Câu 868
A company is building a serverless application that uses AWS Lambda functions. The company needs to create a set of test events to test Lambda functions in a development environment. The test events will be created once and then will be used by all the developers in an IAM developer group. The test events must be editable by any of the IAM users in the IAM developer group.

Which solution will meet these requirements?
  1. A Create and store the test events in Amazon S3 as JSON objects. Allow S3 bucket access to all IAM users.
  2. B Create the test events. Configure the event sharing settings to make the test events shareable.
  3. C Create and store the test events in Amazon DynamoDB. Allow access to DynamoDB by using IAM roles.
  4. D Create the test events. Configure the event sharing settings to make the test events private.
Xem giải thích

🧩 Phân tích nội dung câu hỏi

Câu hỏi xoay quanh việc xây dựng một ứng dụng serverless sử dụng AWS Lambda functions. Công ty cần tạo một bộ test events (các sự kiện thử nghiệm dưới dạng JSON payload) để kiểm tra Lambda functions trong môi trường phát triển (development environment). Các yêu cầu chính bao gồm:

  • Test events được tạo một lần duy nhất.
  • Chia sẻ chung cho tất cả các developers trong một IAM developer group.
  • Có thể chỉnh sửa (editable) bởi bất kỳ IAM user nào trong group đó. Mục tiêu là tìm giải pháp tích hợp sẵn, an toàn và dễ quản lý trên AWS, tránh các cách lưu trữ thủ công phức tạp. Đây là chủ đề liên quan đến testing Lambda functions trong AWS console (cập nhật đến phiên bản Lambda 2026, hỗ trợ chia sẻ test events native).

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Create the test events. Configure the event sharing settings to make the test events shareable.

Lý do 🛠️:

  • AWS Lambda console hỗ trợ tạo test events trực tiếp từ giao diện (không cần lưu trữ ngoài).
  • Tính năng event sharing settings cho phép chia sẻ test events với các IAM users hoặc groups cụ thể (qua ARN hoặc permissions).
  • Các developers trong IAM developer group có thể truy cập, sử dụng và chỉnh sửa test events mà không cần quyền admin toàn cục.
  • Giải pháp này tích hợp sẵn, an toàn (dựa trên IAM policies), tạo một lần dùng chung, và editable bởi group – hoàn toàn khớp yêu cầu. Không cần dịch vụ lưu trữ bên ngoài như S3/DynamoDB, giảm chi phí và phức tạp.

📋 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 bằng tiếng Anh. Mỗi phương án được đánh giá đúng/sai dựa trên tính phù hợp với yêu cầu (chia sẻ + editable + tạo một lần).

  • Create and store the test events in Amazon S3 as JSON objects. Allow S3 bucket access to all IAM users.
    ❌ Sai vì:

    • Lưu trữ thủ công vào S3 yêu cầu quản lý bucket policies/IAM permissions phức tạp cho edit (không native với Lambda testing).
    • Không tích hợp trực tiếp với Lambda console → developers phải tải lên/xuống thủ công, dễ lỗi và không "tạo một lần dùng chung" mượt mà.
    • Vi phạm nguyên tắc least privilege (cho phép "all IAM users" quá rộng, rủi ro bảo mật cao).
  • Create the test events. Configure the event sharing settings to make the test events shareable.
    ✅ Đúng như đã giải thích ở trên: Giải pháp native của Lambda (từ năm 2020+, cập nhật 2026 vẫn giữ), hỗ trợ shareable qua IAM, editable bởi group, không cần lưu trữ ngoài.

  • Create and store the test events in Amazon DynamoDB. Allow access to DynamoDB by using IAM roles.
    ❌ Sai vì:

    • DynamoDB là NoSQL database, không phù hợp lưu JSON events đơn giản (overkill, tốn chi phí scan/query).
    • Yêu cầu fine-grained IAM roles/policies phức tạp cho edit (không tự động như Lambda sharing).
    • Không tích hợp với Lambda test console → phải code/custom logic để load events, không đáp ứng "dùng chung editable" dễ dàng.
  • Create the test events. Configure the event sharing settings to make the test events private.
    ❌ Sai vì:

    • Private settings chỉ giới hạn truy cập cá nhân, không chia sẻ với group (trái ngược yêu cầu "used by all developers").
    • Không đáp ứng editable bởi bất kỳ user nào trong IAM group, vì private chỉ cho owner.

📘 Tài liệu tham khảo (AWS Documentation cập nhật 2026)

Giải pháp này đảm bảo tuân thủ AWS Well-Architected Framework (Pillar: Operational Excellence & Security)! 🚀

Câu 869 Chọn nhiều đáp án
A developer is configuring an application's deployment environment in AWS CodePipeline. The application code is stored in a GitHub repository. The developer wants to ensure that the repository package's unit tests run in the new deployment environment. The developer has already set the pipeline's source provider to GitHub and has specified the repository and branch to use in the deployment.

Which combination of steps should the developer take next to meet these requirements with the LEAST overhead? (Choose two.)
  1. A Create an AWS CodeCommit project. Add the repository package's build and test commands to the project's buildspec.
  2. B Create an AWS CodeBuild project. Add the repository package's build and test commands to the project's buildspec.
  3. C Create an AWS CodeDeploy project. Add the repository package's build and test commands to the project's buildspec.
  4. D Add an action to the source stage. Specify the newly created project as the action provider. Specify the build artifact as the action's input artifact.
  5. E Add a new stage to the pipeline after the source stage. Add an action to the new stage. Specify the newly created project as the action provider. Specify the source artifact as the action's input artifact.
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 quy trình triển khai ứng dụng bằng AWS CodePipeline, nơi mã nguồn được lưu trữ trong GitHub repository. Nhà phát triển đã cấu hình source stage với provider GitHub, chỉ định repository và branch cụ thể. Yêu cầu chính là chạy unit tests của package repository trong môi trường triển khai mới, với ít overhead nhất (least overhead), và chọn hai bước kết hợp tiếp theo.

🔍 Chi tiết yêu cầu:

  • CodePipeline là dịch vụ orchestration CI/CD, bao gồm các stage như Source → Build → Deploy.
  • Unit tests cần chạy sớm trong pipeline (sau source), không phải trong deploy.
  • Overhead thấp nghĩa là sử dụng dịch vụ phù hợp nhất, không tạo thêm project không cần thiết (ví dụ: không migrate sang CodeCommit khi source đã là GitHub).
  • Mục tiêu: Tích hợp build stage để chạy test commands qua buildspec (file YAML định nghĩa phases: install, pre_build, build, post_build – nơi chạy unit tests).

📘 Kiến thức cập nhật AWS (đến 2026): CodePipeline hỗ trợ GitHub trực tiếp làm source (không cần CodeCommit). CodeBuild là dịch vụ build/test chuẩn cho CI/CD, tích hợp seamless với CodePipeline qua actions. Buildspec v2 (ra mắt 2023) hỗ trợ runtime linh hoạt hơn, nhưng cơ bản vẫn dùng commands để test (npm test, pytest, v.v.).

✅ Đáp án đúng (Chọn 2)

Hai lựa chọn đúng là:

  • Create an AWS CodeBuild project. Add the repository package's build and test commands to the project's buildspec.
  • Add a new stage to the pipeline after the source stage. Add an action to the new stage. Specify the newly created project as the action provider. Specify the source artifact as the action's input artifact.

Lý do chọn (giải thích chi tiết):
🛠️ Để chạy unit tests với least overhead, cần tạo CodeBuild project làm build stage ngay sau source. CodeBuild chuyên xử lý build/test qua buildspec.yml (upload vào repo GitHub hoặc định nghĩa inline), chạy commands như npm test hoặc mvn test. Sau source stage, thêm Build stage mới, chọn action provider là CodeBuild project, input là source artifact (từ GitHub pull). Điều này tích hợp tự động, parallelizable, không cần migrate repo hay dịch vụ thừa. Overhead thấp vì CodeBuild serverless, scale tự động, tích hợp native với CodePipeline (không cần custom Lambda).

📋 Phân tích tất cả các phương án

🧩 Phương án 1:
Create an AWS CodeCommit project. Add the repository package's build and test commands to the project's buildspec.
❌ Sai: CodeCommit là Git repo managed AWS, nhưng source đã là GitHub → tạo CodeCommit tạo overhead thừa (migrate code, webhook setup). Buildspec thuộc CodeBuild, không phải CodeCommit project. Không cần thiết cho yêu cầu.

🧩 Phương án 2:
Create an AWS CodeBuild project. Add the repository package's build and test commands to the project's buildspec.
✅ Đúng: CodeBuild lý tưởng cho build/test unit tests qua buildspec (phases: build → run tests). Tích hợp trực tiếp CodePipeline, pull source artifact từ GitHub, chạy isolated. Overhead thấp, serverless, hỗ trợ multi-runtime (Node.js, Java,...).

🧩 Phương án 3:
Create an AWS CodeDeploy project. Add the repository package's build and test commands to the project's buildspec.
❌ Sai: CodeDeploy chỉ deploy artifacts đến EC2/Lambda/ECS, không chạy build/test hay buildspec (không có khái niệm này). Buildspec là của CodeBuild. Sử dụng sai dịch vụ → overhead cao, không meet yêu cầu unit tests.

🧩 Phương án 4:
Add an action to the source stage. Specify the newly created project as the action provider. Specify the build artifact as the action's input artifact.
❌ Sai: Source stage chỉ pull code từ GitHub (provider fixed), không add action build vào source (vi phạm best practice). Input là "build artifact" sai vì source chưa có build artifact (chỉ source artifact). Phải thêm stage riêng sau source.

🧩 Phương án 5:
Add a new stage to the pipeline after the source stage. Add an action to the new stage. Specify the newly created project as the action provider. Specify the source artifact as the action's input artifact.
✅ Đúng: Tạo Build stage sau Source, add action với provider CodeBuild, input source artifact (code từ GitHub). Đây là flow chuẩn CI/CD: Source → Build (test) → Deploy. Overhead thấp, tự động trigger trên commit.

📚 Tài liệu tham khảo (AWS docs cập nhật 2026)

Hy vọng phân tích giúp bạn nắm vững! 🚀 Nếu cần demo CloudFormation, comment nhé!

Câu 870
An engineer created an A/B test of a new feature on an Amazon CloudWatch Evidently project. The engineer configured two variations of the feature (Variation A and Variation B) for the test. The engineer wants to work exclusively with Variation A. The engineer needs to make updates so that Variation A is the only variation that appears when the engineer hits the application's endpoint.

Which solution will meet this requirement?
  1. A Add an override to the feature. Set the identifier of the override to the engineer's user ID. Set the variation to Variation A.
  2. B Add an override to the feature. Set the identifier of the override to Variation A. Set the variation to 100%.
  3. C Add an experiment to the project. Set the identifier of the experiment to Variation B. Set the variation to 0%.
  4. D Add an experiment to the project. Set the identifier of the experiment to the AWS account's account ISet the variation to Variation A.
Xem giải thích

🧩 Phân tích chi tiết câu hỏi trắc nghiệm AWS CloudWatch Evidently

📖 Giải thích nội dung câu hỏi:
Câu hỏi xoay quanh tính năng Amazon CloudWatch Evidently (dịch vụ quản lý thí nghiệm A/B testing và feature flags trên AWS, cập nhật mới nhất đến năm 2026 vẫn giữ nguyên các khái niệm cốt lõi như projects, features, experiments, launches và overrides). Một kỹ sư đã tạo một A/B test (thí nghiệm so sánh hai phiên bản) cho một tính năng mới trong dự án Evidently. Có hai biến thể (variations): Variation A (phiên bản gốc) và Variation B (phiên bản mới). Kỹ sư muốn chỉ làm việc độc quyền với Variation A, nghĩa là khi kỹ sư truy cập endpoint của ứng dụng (qua SDK hoặc API), chỉ Variation A được hiển thị, bất kể logic phân bổ ngẫu nhiên của A/B test. Yêu cầu là cập nhật cấu hình để force Variation A chỉ dành riêng cho kỹ sư, mà không ảnh hưởng đến người dùng khác.
🛠️ Vấn đề cốt lõi: Trong A/B test (thường dùng experiment hoặc launch), traffic được phân bổ ngẫu nhiên (ví dụ 50/50). Để override (ghi đè) cho một entity cụ thể (như user ID), cần dùng feature override thay vì chỉnh sửa experiment.

✅ Đáp án đúng:
Add an override to the feature. Set the identifier of the override to the engineer's user ID. Set the variation to Variation A.
Lý do lựa chọn: Đây là cách chính xác theo tài liệu AWS CloudWatch Evidently (phiên bản mới nhất 2026). Overrides trên feature cho phép ghi đè variation cụ thể cho một entity identifier (như user ID, session ID hoặc custom ID). Bằng cách set identifier là user ID của kỹ sư và variation là Variation A, khi kỹ sư gọi EvaluateFeature API (hoặc SDK), hệ thống sẽ luôn trả về Variation A cho user đó, bỏ qua phân bổ ngẫu nhiên của experiment. Điều này lý tưởng cho developer testing mà không thay đổi toàn bộ test.
📘 Dẫn nguồn: AWS Docs - CloudWatch Evidently Overrides và EvaluateFeature API.

🔍 Giải thích tất cả các phương án (đúng/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. Phân tích sử dụng kiến thức AWS cập nhật đến 2026 (Evidently hỗ trợ overrides linh hoạt hơn với entity types như USER, SESSION, CUSTOM).

  • ✅ [ĐÚNG] Add an override to the feature. Set the identifier of the override to the engineer's user ID. Set the variation to Variation A.
    🟢 Đúng vì: Như giải thích trên, override trên feature (không phải experiment) là cơ chế chuẩn để force variation cho entity cụ thể. User ID là identifier hợp lệ (entity type USER). Không ảnh hưởng đến traffic allocation của A/B test. Hoàn hảo cho dev testing!

  • ❌ [SAI] Add an override to the feature. Set the identifier of the override to Variation A. Set the variation to 100%.
    🔴 Sai vì: Identifier phải là một entity duy nhất (như user ID, không phải tên variation). "Variation A" không phải identifier hợp lệ (Evidently yêu cầu string đại diện cho user/session). "Set the variation to 100%" không tồn tại trong API override (override chỉ set variation cụ thể, không dùng % allocation). Sẽ gây lỗi khi tạo override.

  • ❌ [SAI] Add an experiment to the project. Set the identifier of the experiment to Variation B. Set the variation to 0%.
    🔴 Sai vì: Không thể thêm experiment mới để override experiment hiện tại (experiments độc lập). Identifier của experiment là tên project-level (không set cho variation). "Set variation to 0%" chỉ chỉnh allocation trong treatment config của experiment hiện tại, ảnh hưởng toàn bộ traffic (không dành riêng cho kỹ sư). Không giải quyết yêu cầu "exclusively with Variation A".

  • ❌ [SAI] Add an experiment to the project. Set the identifier of the experiment to the AWS account's account ID. Set the variation to Variation A.
    🔴 Sai vì: Tương tự trên, thêm experiment mới không override được experiment A/B hiện tại. Account ID không dùng làm identifier cho experiment (experiment identifier là tên nội bộ). Không có cách "set variation to Variation A" ở mức account-wide trong experiment (allocation là % traffic, không force per-entity). Sẽ tạo experiment chồng chéo, gây hỗn loạn .

🛡️ Lời khuyên thực hành: Để implement, dùng AWS Console/CLI/SDK: aws evidently create-feature-override hoặc trong code SDK putProjectPolicy với override. Test bằng aws evidently evaluate-feature với user ID. Luôn monitor metrics qua CloudWatch dashboards để tránh bias testing! 🚀