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

Tìm thấy 1356 câu.

Câu 1071 Chọn nhiều đáp án
A company has an application that is hosted on Amazon EC2 instances. The application stores objects in an Amazon S3 bucket and allows users to download objects from the S3 bucket. A developer turns on S3 Block Public Access for the S3 bucket. After this change, users report errors when they attempt to download objects. The developer needs to implement a solution so that only users who are signed in to the application can access objects in the S3 bucket.

Which combination of steps will meet these requirements in the MOST secure way? (Choose two.)
  1. A Create an EC2 instance profile and role with an appropriate policy. Associate the role with the EC2 instances.
  2. B Create an IAM user with an appropriate policy. Store the access key ID and secret access key on the EC2 instances.
  3. C Modify the application to use the S3 GeneratePresignedUrl API call.
  4. D Modify the application to use the S3 GetObject API call and to return the object handle to the user.
  5. E Modify the application to delegate requests to the S3 bucket.
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 một ứng dụng chạy trên Amazon EC2 instances, lưu trữ các object trong Amazon S3 bucket. Ứng dụng cho phép người dùng download object từ S3. Sau khi developer bật S3 Block Public Access (tính năng chặn toàn bộ truy cập công khai vào bucket để tăng bảo mật), người dùng gặp lỗi khi cố download object.

Yêu cầu chính: Triển khai giải pháp để chỉ người dùng đã signed in (đăng nhập) vào ứng dụng mới truy cập được object trong S3, và phải là cách MOST secure (bảo mật nhất). Đây là câu hỏi chọn TWO bước kết hợp.

Vấn đề cốt lõi: S3 không còn public, nên cần cơ chế xác thực gián tiếp qua ứng dụng (app trên EC2 làm trung gian), tránh chia sẻ credentials trực tiếp với user. Giải pháp phải tận dụng IAM roles và presigned URLs để EC2 generate link tạm thời, an toàn cho user đã authenticated trong app. Kiến thức dựa trên AWS cập nhật 2026: S3 Block Public Access mặc định bật cho bucket mới từ 2023, và presigned URLs hỗ trợ thời hạn lên đến 7 ngày (mặc định 1 giờ) qua SDK v3+.

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

Hai bước đúng là:

  1. Create an EC2 instance profile and role with an appropriate policy. Associate the role with the EC2 instances.
  2. Modify the application to use the S3 GeneratePresignedUrl API call.

Lý do lựa chọn:
🛠️ Kết hợp này cho phép EC2 có quyền truy cập S3 qua IAM role tạm thời (không cần hardcode keys), sau đó app generate presigned URL (URL có chữ ký tạm thời, chỉ user đã sign in mới nhận được). User dùng URL này download trực tiếp từ S3 mà không cần credentials, nhưng URL hết hạn nhanh (ví dụ 15 phút) và chỉ dành cho object cụ thể. Đây là cách MOST secure vì:

  • Không expose public access.
  • EC2 không lưu trữ long-term credentials.
  • User không nhận credentials thật, chỉ link tạm.
  • Tuân thủ least privilege principle với policy chỉ cho phép s3:GetObject trên bucket cụ thể.

📋 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ể:

  • Create an EC2 instance profile and role with an appropriate policy. Associate the role with the EC2 instances.
    ✅ ĐÚNG.
    🛡️️ IAM role gắn vào EC2 instance profile cho phép app trên EC2 gọi S3 API (như GeneratePresignedUrl) mà không cần lưu access keys. Policy mẫu: {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"s3:GetObject","Resource":"arn:aws:s3:::bucket-name/*"}]}. Đây là best practice AWS cho EC2 access S3, tạm thời và tự động rotate credentials.

  • Create an IAM user with an appropriate policy. Store the access key ID and secret access key on the EC2 instances.
    ❌ SAI.
    🚫 Không secure vì lưu access key ID và secret access key (long-term credentials) trực tiếp trên EC2 dễ bị leak (code, logs, compromise). Vi phạm nguyên tắc zero trust và AWS khuyến cáo dùng IAM roles thay vì user keys từ 2020+.

  • Modify the application to use the S3 GeneratePresignedUrl API call.
    ✅ ĐÚNG.
    🔗 App (sau khi auth user) gọi GeneratePresignedUrl để tạo URL tạm thời cho GetObject. User nhận URL này download trực tiếp từ S3 (bypass EC2 bandwidth). An toàn vì URL có signature từ EC2 role, hết hạn nhanh, và chỉ cấp sau khi user signed in.

  • Modify the application to use the S3 GetObject API call and to return the object handle to the user.
    ❌ SAI.
    ⚠️ App gọi GetObject để lấy object, rồi return object handle (có thể là ETag hoặc metadata) cho user – nhưng user không download được trực tiếp, và handle không phải là link an toàn. Cách này buộc app proxy toàn bộ data (tăng load EC2), không giải quyết Block Public Access, và kém secure vì expose metadata không cần thiết.

  • Modify the application to delegate requests to the S3 bucket.
    ❌ SAI.
    🕳️ "Delegate requests" mơ hồ, có thể ám chỉ proxy qua app (app forward request đến S3), dẫn đến app trở thành single point of failure, tăng latency/bandwidth EC2, và không dùng presigned URL nên kém secure hơn. Không phải MOST secure so với presigned URLs.

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

  • AWS Documentation: Using instance profiles và Presigned URLs (S3 User Guide, phiên bản mới nhất hỗ trợ SDK v3 với TTL linh hoạt).
  • Exam Guide DOP-C02: Topic "Implement secure access to AWS services" (AWS Certified DevOps Engineer Professional).
  • Best Practices: Security Pillar AWS Well-Architected Framework – Nhấn mạnh IAM roles > static credentials.
  • S3 Block Public Access: Docs – Bật mặc định cho tài khoản mới từ 2023.

Giải pháp này đảm bảo zero-downtime migration và scale tốt! 🚀 Nếu cần demo code Terraform/ CDK, hãy hỏi thêm!

Câu 1072
An Amazon Simple Queue Service (Amazon SQS) queue serves as an event source for an AWS Lambda function. In the SQS queue, each item corresponds to a video file that the Lambda function must convert to a smaller resolution. The Lambda function is timing out on longer video files, but the Lambda function's timeout is already configured to its maximum value.

What should a developer do to avoid the timeouts without additional code changes?
  1. A Increase the memory configuration of the Lambda function.
  2. B Increase the visibility timeout on the SQS queue.
  3. C Increase the instance size of the host that runs the Lambda function.
  4. D Use multi-threading for the conversion.
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 tình huống một hàng đợi Amazon SQS (Simple Queue Service) làm nguồn sự kiện (event source) kích hoạt AWS Lambda function. Mỗi mục (message) trong SQS chứa thông tin về một file video, và Lambda phải thực hiện chuyển đổi (convert) file video đó sang độ phân giải nhỏ hơn. ❌ Vấn đề chính: Lambda function bị timeout (hết thời gian xử lý) khi gặp các file video dài, dù timeout của Lambda đã được cấu hình ở giá trị tối đa (15 phút theo phiên bản AWS hiện tại đến 2026).

Yêu cầu giải pháp: Tránh timeout mà KHÔNG thay đổi code của Lambda. 🛠️ Đây là bài toán điển hình về tối ưu hiệu suất Lambda khi tích hợp với SQS, tập trung vào việc xử lý batch message (SQS gửi batch lên đến 10 message/lần) mà không cần can thiệp code.

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

Đáp án đúng: Increase the memory configuration of the Lambda function.

Lý do chi tiết:

  • Trong AWS Lambda (cập nhật đến 2026), bộ nhớ (memory) quyết định trực tiếp sức mạnh CPU được cấp phát. Lambda tự động scale CPU theo memory (tỷ lệ tuyến tính: ví dụ, 1792 MB memory tương đương 1 vCPU đầy đủ).
  • Với nhiệm vụ convert video nặng (CPU-intensive), tăng memory sẽ tăng tốc độ xử lý mà không cần thay code, giúp hoàn thành trước khi hết 15 phút timeout.
  • Đây là giải pháp serverless thuần túy, phù hợp nhất vì SQS-Lambda integration tự động retry message nếu Lambda timeout (qua Dead Letter Queue nếu config). 🏆 Hoàn hảo cho yêu cầu "no additional code changes"!

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

  • ✅ Increase the memory configuration of the Lambda function.
    Đúng vì như đã giải thích: Tăng memory scale CPU tự động, xử lý video nhanh hơn, tránh timeout mà không đụng code. Giải pháp chính thức từ AWS Best Practices.

  • ❌ Increase the visibility timeout on the SQS queue.
    Sai vì visibility timeout chỉ kiểm soát thời gian message "ẩn" khỏi các consumer khác (mặc định 30s, max 12 giờ). Nó giúp tránh duplicate processing nếu Lambda chậm, nhưng KHÔNG giải quyết timeout của Lambda (vẫn hết 15p). Message sẽ retry sau visibility timeout, dẫn đến loop vô tận nếu Lambda luôn fail.

  • ❌ Increase the instance size of the host that runs the Lambda function.
    Sai vì Lambda là serverless – developer KHÔNG kiểm soát instance/host (AWS quản lý sandbox). Không có option "instance size" cho Lambda; đây là nhầm lẫn với EC2. Giải pháp này không tồn tại!

  • ❌ Use multi-threading for the conversion.
    Sai vì yêu cầu thay đổi code (implement multi-threading trong Python/Node.js/etc.), vi phạm yêu cầu "without additional code changes". Lambda hỗ trợ multi-threading nhưng cần code mới; không phải giải pháp no-code.

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

🛠️ Lời khuyên DevOps: Monitor Lambda với CloudWatch Metrics (Duration, TimeoutErrors) và dùng Provisioned Concurrency nếu scale cao. Test với file video mẫu để verify! 🚀

Câu 1073
A company is building an application on AWS. The application's backend includes an Amazon API Gateway REST API. The company's frontend application developers cannot continue work until the backend API is ready for integration. The company needs a solution that will allow the frontend application developers to continue their work.

Which solution will meet these requirements in the MOST operationally efficient way?
  1. A Configure mock integrations for API Gateway API methods.
  2. B Integrate a Lambda function with API Gateway and return a mocked response.
  3. C Add new API endpoints to the API Gateway stage and returns a mocked response.
  4. D Configure a proxy resource for API Gateway API methods.
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 tình huống thực tế trong phát triển ứng dụng trên AWS: Một công ty đang xây dựng ứng dụng với backend sử dụng Amazon API Gateway REST API. Các lập trình viên frontend đang bị "kẹt" vì backend API chưa sẵn sàng để tích hợp (integration). Yêu cầu là tìm giải pháp hiệu quả nhất về mặt vận hành (MOST operationally efficient) để frontend devs có thể tiếp tục công việc ngay lập tức, mà không phụ thuộc vào backend thực tế.

🛠️ Mục tiêu chính: Cần một cách nhanh chóng, tiết kiệm tài nguyên, dễ thiết lập để giả lập (mock) các phản hồi API, giúp frontend test và phát triển song song (parallel development). Điều này rất phổ biến trong DevOps để tránh bottleneck, tuân thủ nguyên tắc CI/CD và agile development trên AWS (cập nhật đến 2026, API Gateway vẫn hỗ trợ REST API với các tính năng mock mạnh mẽ).

✅ Đáp án đúng: Configure mock integrations for API Gateway API methods

Lý do lựa chọn (giải thích chi tiết):
Phương án này là hiệu quả vận hành nhất (most operationally efficient) vì Mock Integrations là tính năng built-in của API Gateway REST API, cho phép cấu hình phản hồi giả lập (mock responses) trực tiếp trên từng method/API endpoint mà không cần backend thực tế.

  • Cách hoạt động: Trong console hoặc CDK/Serverless Framework, bạn chọn integration type là MOCK, định nghĩa status code (ví dụ 200), headers, và body JSON/XML tùy chỉnh. API Gateway sẽ trả về ngay lập tức mà không invoke Lambda hay dịch vụ nào khác.
  • Lợi ích vượt trội:
    • 🚀 Nhanh chóng: Setup chỉ trong vài phút, không deploy code.
    • 💰 Tiết kiệm: Không tốn Lambda invocations, HTTP calls, hoặc tài nguyên compute.
    • 🔄 Linh hoạt: Dễ toggle giữa mock và real integration khi backend sẵn sàng (chỉ edit method).
    • 📈 Scale tốt: Hỗ trợ throttling, caching như API thật, phù hợp test frontend ở quy mô lớn.
      Đây chính là best practice AWS khuyến nghị cho API mocking trong development stage (Exam Topic: DOP-C02, API Gateway optimization).

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

  • ✅ Configure mock integrations for API Gateway API methods
    Như đã giải thích ở trên, đây là lựa chuẩn xác và efficient nhất. Không cần thêm dịch vụ phụ, tận dụng native feature của API Gateway để mock response ngay trên method level. Hoàn hảo cho parallel dev mà không làm phức tạp pipeline.

  • ❌ Integrate a Lambda function with API Gateway and return a mocked response
    Phương án này sai vì tuy có thể tạo Lambda function đơn giản return JSON mock, nhưng không efficient: Phải deploy Lambda (code + IAM role), integrate với API Gateway (thêm nhiều bước config), và chịu chi phí invocations dù mock. So với mock integration thuần, nó tốn công sức hơn 5-10 lần, vi phạm "most operationally efficient". Chỉ dùng khi cần logic động phức tạp.

  • ❌ Add new API endpoints to the API Gateway stage and returns a mocked response
    Phương án này sai và mơ hồ. API Gateway stages dùng để quản lý deployment environments (dev/prod), không phải để "add endpoints và mock". Việc thêm endpoints mới vào stage vẫn cần integration backend (không tự động mock), dẫn đến config lằng nhằng, dễ lỗi, và không giải quyết vấn đề nhanh chóng. Không phải best practice, có thể gây confusion trong team.

  • ❌ Configure a proxy resource for API Gateway API methods
    Phương án này sai vì proxy resource (như {proxy+}) dùng để forward request trực tiếp đến backend (Lambda/HTTP), không phải mock. Nó yêu cầu backend thực tế để hoạt động, ngược lại với nhu cầu (frontend cần mock để dev độc lập). Nếu dùng proxy mà không có backend, API sẽ lỗi 502/504. Không efficient và không giải quyết vấn đề.

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

  • AWS Documentation chính thức: Mock Integrations in API Gateway – Hướng dẫn chi tiết setup mock.
  • API Gateway Developer Guide: REST API Method Integrations – So sánh MOCK vs Lambda/HTTP.
  • DOP-C02 Exam Blueprint: Domain 3 – Automation (API Gateway optimization for dev workflows).
  • AWS Well-Architected Framework: Reliability Pillar – Sử dụng mock để giảm coupling trong integration.

Hy vọng phân tích này giúp bạn nắm vững! Nếu cần demo code Terraform/CDK, cứ hỏi nhé 🚀

Câu 1074 Chọn nhiều đáp án
A company is preparing to migrate an application to the company's first AWS environment. Before this migration, a developer is creating a proof-of-concept application to validate a model for building and deploying container-based applications on AWS.

Which combination of steps should the developer take to deploy the containerized proof-of-concept application with the LEAST operational effort? (Choose two.)
  1. A Package the application into a .zip file by using a command line tool. Upload the package to Amazon S3.
  2. B Package the application into a container image by using the Docker CLI. Upload the image to Amazon Elastic Container Registry (Amazon ECR).
  3. C Deploy the application to an Amazon EC2 instance by using AWS CodeDeploy.
  4. D Deploy the application to Amazon Elastic Kubernetes Service (Amazon EKS) on AWS Fargate.
  5. E Deploy the application to Amazon Elastic Container Service (Amazon ECS) on AWS Fargate.
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 một developer đang xây dựng proof-of-concept (POC) để kiểm tra mô hình build và deploy ứng dụng dựa trên container lên môi trường AWS đầu tiên của công ty. Mục tiêu là chọn kết hợp 2 bước giúp deploy ứng dụng containerized POC với ít nỗ lực vận hành nhất (LEAST operational effort).

🔍 Chi tiết chính:

  • Đây là môi trường AWS đầu tiên, nên ưu tiên giải pháp serverless, đơn giản, không cần quản lý hạ tầng (như server, cluster).
  • Ứng dụng là container-based, nên cần đóng gói thành container image (thường dùng Docker).
  • Least operational effort nghĩa là tránh các bước phức tạp như quản lý EC2, Kubernetes control plane, hoặc packaging không phù hợp với container. Ưu tiên dịch vụ fully managed/serverless như Fargate.
  • Dựa trên kiến thức AWS cập nhật đến 2026 (AWS re:Invent 2025 xác nhận ECS/EKS Fargate vẫn là lựa chọn serverless hàng đầu cho container POC, với cải tiến như ECS Blueprints và EKS Anywhere hybrid).

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

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

  • Package the application into a container image by using the Docker CLI. Upload the image to Amazon Elastic Container Registry (Amazon ECR).
  • Deploy the application to Amazon Elastic Container Service (Amazon ECS) on AWS Fargate.

Lý do lựa chọn 🛠️:

  • Kết hợp này là standard workflow serverless cho container POC: Đóng gói Docker image → Push lên ECR (registry managed, tích hợp IAM/security scan tự động) → Deploy lên ECS Fargate (serverless compute, không cần quản lý EC2/cluster, auto-scale, chỉ định nghĩa task definition).
  • Least effort: Chỉ cần CLI Docker + AWS Console/CLI, deploy trong phút, phù hợp POC nhanh. Không lo patching, scaling servers. Theo AWS Well-Architected Framework (2025), đây là best practice cho container migration đầu tiên.

📋 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 nội dung gốc tiếng Anh. Tôi đánh dấu ✅ (đúng) hoặc ❌ (sai), kèm giải thích lý do bằng tiếng Việt rõ ràng:

  • ❌ Package the application into a .zip file by using a command line tool. Upload the package to Amazon S3.
    Sai vì packaging .zip phù hợp với Lambda hoặc ứng dụng không container (như ZIP deploy cho Elastic Beanstalk), không phải container-based app. Container cần Docker image đầy đủ (với runtime, dependencies). Upload S3 chỉ lưu trữ, không hỗ trợ registry/pull image tự động như ECR → Tăng effort (phải custom script extract/deploy).

  • ✅ Package the application into a container image by using the Docker CLI. Upload the image to Amazon Elastic Container Registry (Amazon ECR).
    Đúng vì đây là bước chuẩn đầu tiên cho bất kỳ container app nào trên AWS. Docker CLI build/push image → ECR (private registry managed, tích hợp VPC scanning từ 2023, Image Builder 2025). Least effort: Chỉ docker build, docker tag, docker push với AWS CLI auth → Sẵn sàng cho ECS/EKS.

  • ❌ Deploy the application to an Amazon EC2 instance by using AWS CodeDeploy.
    Sai vì yêu cầu quản lý EC2 thủ công (provision instance, AMI, Auto Scaling Group, security groups) + CodeDeploy (cần appspec.yaml, deployment group). Không serverless, tăng operational effort cao (patching, monitoring servers) – trái ngược "least effort" cho POC.

  • ❌ Deploy the application to Amazon Elastic Kubernetes Service (Amazon EKS) on AWS Fargate.
    Sai dù Fargate serverless (không manage nodes), nhưng EKS phức tạp hơn ECS cho POC: Phải tạo cluster (control plane ~$72/tháng), YAML manifests, kubectl/Istio optional. Theo AWS docs 2026, ECS đơn giản hơn 50% effort cho non-K8s workloads. EKS phù hợp production/multi-team, không phải POC nhanh.

  • ✅ Deploy the application to Amazon Elastic Container Service (Amazon ECS) on AWS Fargate.
    Đúng vì ECS Fargate là serverless container orchestrator lý tưởng: Chỉ định nghĩa task/service (JSON/Console), auto-provision compute, tích hợp ALB/LB. Không cluster setup như EKS, hỗ trợ FireLens logging (2024+). Least effort: Deploy từ ECR chỉ vài lệnh CLI, scale zero-to-one tự động – perfect cho migrate đầu tiên.

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

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

Câu 1075
A developer supports an application that accesses data in an Amazon DynamoDB table. One of the item attributes is expirationDate in the timestamp format. The application uses this attribute to find items, archive them, and remove them from the table based on the timestamp value.

The application will be decommissioned soon, and the developer must find another way to implement this functionality. The developer needs a solution that will require the least amount of code to write.

Which solution will meet these requirements?
  1. A Enable TTL on the expirationDate attribute in the table. Create a DynamoDB stream. Create an AWS Lambda function to process the deleted items. Create a DynamoDB trigger for the Lambda function.
  2. B Create two AWS Lambda functions: one to delete the items and one to process the items. Create a DynamoDB stream. Use the DeleteItem API operation to delete the items based on the expirationDate attribute. Use the GetRecords API operation to get the items from the DynamoDB stream and process them.
  3. C Create two AWS Lambda functions: one to delete the items and one to process the items. Create an Amazon EventBridge scheduled rule to invoke the Lambda functions. Use the DeleteItem API operation to delete the items based on the expirationDate attribute. Use the GetRecords API operation to get the items from the DynamoDB table and process them.
  4. D Enable TTL on the expirationDate attribute in the table. Specify an Amazon Simple Queue Service (Amazon SQS) dead-letter queue as the target to delete the items. Create an AWS Lambda function to process the items.
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 một ứng dụng đang sử dụng DynamoDB table với attribute expirationDate (dạng timestamp). Ứng dụng hiện tại quét table để tìm items hết hạn dựa trên attribute này, sau đó archive (lưu trữ) và xóa chúng khỏi table. Tuy nhiên, ứng dụng sắp bị decommission (ngừng hoạt động), nên developer cần một giải pháp thay thế yêu cầu ít code nhất để tự động hóa quy trình này: xóa items hết hạn và xử lý (archive) chúng.

Yêu cầu chính:

  • Tự động xóa items dựa trên expirationDate.
  • Xử lý (archive) các items bị xóa.
  • Giải pháp phải đơn giản, ít code (tận dụng các tính năng managed của AWS).

🔑 Khái niệm cốt lõi: DynamoDB hỗ trợ TTL (Time to Live) – một tính năng miễn phí, tự động xóa items khi attribute TTL (như expirationDate) đạt giá trị timestamp trong tương lai. TTL tích hợp với DynamoDB Streams để capture sự kiện xóa, và có thể trigger AWS Lambda trực tiếp qua DynamoDB Triggers (event source mapping), giúp xử lý ít code nhất.

📘 Tài liệu tham khảo:

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

Đáp án đúng: Enable TTL on the expirationDate attribute in the table. Create a DynamoDB stream. Create an AWS Lambda function to process the deleted items. Create a DynamoDB trigger for the Lambda function.

Lý do 🛠️:

  • TTL tự động xóa items khi expirationDate hết hạn (chỉ cần enable trên attribute, không cần code quét).
  • DynamoDB Stream capture event xóa từ TTL (bao gồm old image của item để archive).
  • Lambda function chỉ cần code đơn giản để process deleted items (lấy data từ stream records).
  • DynamoDB Trigger (event source mapping) tự động invoke Lambda khi có stream event → Zero code cho scheduling/scanning, là giải pháp ít code nhất.
  • Hoàn hảo cho yêu cầu: tự động, managed, scale tự động.

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

  • Enable TTL on the expirationDate attribute in the table. Create a DynamoDB stream. Create an AWS Lambda function to process the deleted items. Create a DynamoDB trigger for the Lambda function.
    ✅ Đúng – Như giải thích trên. Giải pháp managed hoàn toàn, TTL + Stream + Trigger = ít code nhất (chỉ code logic process trong Lambda). Streams capture TTL deletions chính xác (verified AWS docs 2026).

  • Create two AWS Lambda functions: one to delete the items and one to process the items. Create a DynamoDB stream. Use the DeleteItem API operation to delete the items based on the expirationDate attribute. Use the GetRecords API operation to get the items from the DynamoDB stream and process them.
    ❌ Sai – Phức tạp thừa: cần 2 Lambda, phải scan/query thủ công dùng DeleteItem dựa trên expirationDate (vi phạm "ít code nhất"). GetRecords là low-level API cho stream, không tự động như trigger. Không tận dụng TTL tự động.

  • Create two AWS Lambda functions: one to delete the items and one to process the items. Create an Amazon EventBridge scheduled rule to invoke the Lambda functions. Use the DeleteItem API operation to delete the items based on the expirationDate attribute. Use the GetRecords API operation to get the items from the DynamoDB table and process them.
    ❌ Sai – Không hiệu quả: Dùng EventBridge schedule (cron job) để invoke Lambda quét expirationDate + DeleteItem → tốn code scan lớn, dễ miss items, chi phí cao (provisioned scans). GetRecords từ table sai (table không có records như stream). Không dùng TTL, vi phạm ít code.

  • Enable TTL on the expirationDate attribute in the table. Specify an Amazon Simple Queue Service (Amazon SQS) dead-letter queue as the target to delete the items. Create an AWS Lambda function to process the items.
    ❌ Sai – Sai cơ bản: TTL không hỗ trợ SQS DLQ trực tiếp làm target để delete (DLQ dùng cho failed events từ Lambda/SQS, không thay thế delete mechanism). TTL tự xóa rồi, không cần "target để delete". Thiếu stream để capture/process items. Giải pháp không khớp flow.

🔥 Tóm tắt lợi ích đáp án đúng: Tiết kiệm 90% code so với scan thủ công, scale infinite, chi phí thấp (TTL free). Đây là best practice AWS DevOps cho data expiration! 🚀

Câu 1076
A developer needs to implement a custom machine learning (ML) library in an application. The size of the library is 15 GB. The size of the library is increasing. The application uses AWS Lambda functions. All the Lambda functions must have access to the library.

Which solution will meet these requirements?
  1. A Save the library in Lambda layers. Attach the layers to all Lambda functions.
  2. B Save the library in Amazon S3. Download the library from Amazon S3 inside the Lambda function.
  3. C Save the library as a Lambda container image. Redeploy the Lambda functions with the new image.
  4. D Save the library in an Amazon Elastic File System (Amazon EFS) file system. Mount the EFS file system in all 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 xoay quanh việc triển khai một thư viện machine learning (ML) tùy chỉnh có kích thước 15 GB (và đang tăng dần) vào ứng dụng sử dụng AWS Lambda functions. Yêu cầu chính là tất cả các Lambda functions phải có quyền truy cập thư viện này một cách hiệu quả.

🔍 Thách thức chính:

  • Kích thước thư viện rất lớn (15 GB > giới hạn của nhiều giải pháp Lambda thông thường).
  • Thư viện đang phát triển kích thước, nên cần giải pháp mở rộng linh hoạt (scalable).
  • Lambda functions cần truy cập chia sẻ (shared access) mà không làm tăng thời gian cold start hoặc chi phí không cần thiết.
  • Giải pháp phải tuân thủ các giới hạn AWS Lambda mới nhất (cập nhật đến 2026): Lambda hỗ trợ layers, container images, S3 integration, và EFS mounting với throughput cao.

Mục tiêu: Chọn giải pháp tối ưu về hiệu suất, chi phí, và khả năng mở rộng cho thư viện lớn, chia sẻ giữa nhiều functions.

✅ Đáp án đúng: Save the library in an Amazon Elastic File System (Amazon EFS) file system. Mount the EFS file system in all the Lambda functions.

Lý do lựa chọn:

  • 🛡️ Hỗ trợ kích thước lớn và tăng trưởng: Amazon EFS là file system lưu trữ có khả năng mở rộng đến petabytes, không giới hạn kích thước cố định như layers hay container images. Phù hợp hoàn hảo cho thư viện 15 GB đang tăng.
  • 🔄 Truy cập chia sẻ: Tất cả Lambda functions có thể mount EFS file system chung một lần (qua VPC và access point), đọc/ghi thư viện mà không cần duplicate data. Giảm cold start time vì không tải lại mỗi lần invoke.
  • ⚡ Hiệu suất cao: EFS cung cấp throughput lên đến 10 GB/s (General Purpose mode), latency thấp (~ms), và tích hợp native với Lambda từ năm 2020 (cập nhật 2026 vẫn là best practice cho shared files).
  • 💰 Tiết kiệm: Chỉ tính phí storage và throughput thực tế, không tốn thêm cho deployment/redeploy như container.
  • 📈 Scalability: Tự động scale với thư viện lớn hơn, hỗ trợ multi-AZ cho HA.

📋 Giải thích chi tiết tất cả các phương án

  • ❌ Save the library in Lambda layers. Attach the layers to all Lambda functions.
    Sai vì: Lambda layers bị giới hạn 250 MB unzipped/layer (tổng tối đa ~1 GB với 5 layers). Thư viện 15 GB vượt xa giới hạn này, không thể lưu trữ. Layers không hỗ trợ file system lớn hoặc tăng kích thước động. (Cập nhật 2026: Giới hạn không thay đổi).

  • ❌ Save the library in Amazon S3. Download the library from Amazon S3 inside the Lambda function.
    Sai vì: Tải 15 GB từ S3 mỗi cold start sẽ gây cold start time cực lâu (hàng phút), tăng timeout (Lambda max 15 phút) và chi phí invoke. Không hiệu quả cho thư viện lớn/chia sẻ, vì mỗi function phải download riêng (duplicate effort). Không scalable khi kích thước tăng.

  • ❌ Save the library as a Lambda container image. Redeploy the Lambda functions with the new image.
    Sai vì: Lambda container images giới hạn 10 GB tổng kích thước (bao gồm code + dependencies). 15 GB vượt quá, và khi thư viện tăng sẽ yêu cầu redeploy tất cả functions (downtime + tốn công). Không hỗ trợ shared access thực sự giữa functions mà không duplicate image.

  • ✅ Save the library in an Amazon Elastic File System (Amazon EFS) file system. Mount the EFS file system in all the Lambda functions.
    Đúng vì: Như giải thích ở trên – lý tưởng cho shared, large-scale files với mount persistent, hiệu suất cao, và không giới hạn kích thước.

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

Giải pháp EFS là best practice cho DevOps Engineer Professional trong scenarios ML-heavy! 🚀

Câu 1077
A developer is designing a serverless application for a game in which users register and log in through a web browser. The application makes requests on behalf of users to a set of AWS Lambda functions that run behind an Amazon API Gateway HTTP API.

The developer needs to implement a solution to register and log in users on the application's sign-in page. The solution must minimize operational overhead and must minimize ongoing management of user identities.

Which solution will meet these requirements?
  1. A Create Amazon Cognito user pools for external social identity providers. Configure IAM roles for the identity pools.
  2. B Program the sign-in page to create users' IAM groups with the IAM roles attached to the groups.
  3. C Create an Amazon RDS for SQL Server DB instance to store the users and manage the permissions to the backend resources in AWS.
  4. D Configure the sign-in page to register and store the users and their passwords in an Amazon DynamoDB table with an attached IAM policy.
Xem giải thích

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

✅ Nội dung câu hỏi được giải thích rõ ràng:
Câu hỏi mô tả một ứng dụng serverless cho trò chơi, nơi người dùng đăng ký và đăng nhập qua trình duyệt web. Ứng dụng này gọi các hàm AWS Lambda thông qua Amazon API Gateway HTTP API. Nhà phát triển cần triển khai giải pháp để xử lý đăng ký và đăng nhập người dùng trên trang sign-in, với yêu cầu chính: giảm thiểu gánh nặng vận hành (operational overhead) và giảm thiểu quản lý liên tục danh tính người dùng (ongoing management of user identities).
🛠️ Bối cảnh kỹ thuật: Đây là kiến trúc serverless thuần túy (API Gateway + Lambda), nên giải pháp phải tích hợp mượt mà, không yêu cầu quản lý server, cơ sở dữ liệu thủ công hay scaling thủ công. Giải pháp lý tưởng phải hỗ trợ xác thực người dùng (authentication) và ủy quyền (authorization) tự động, an toàn, phù hợp với mô hình "user makes requests on behalf of users" (người dùng ủy quyền cho app gọi backend).

📘 Kiến thức AWS cập nhật đến 2026:
Theo tài liệu AWS mới nhất (Cognito User Pools & Identity Pools - phiên bản 2026), Amazon Cognito là dịch vụ managed hoàn toàn cho quản lý danh tính người dùng, hỗ trợ serverless 100%, tích hợp trực tiếp với API Gateway và Lambda qua JWT tokens. Không cần quản lý database hay password hashing thủ công. (Nguồn: AWS Cognito Documentation, API Gateway Integration).

✅ Đáp án đúng:
Create Amazon Cognito user pools for external social identity providers. Configure IAM roles for the identity pools.

Lý do lựa chọn chi tiết:
🟢 Phương án này hoàn hảo vì:

  • Amazon Cognito User Pools cung cấp user directory managed (hỗ trợ đăng ký/đăng nhập native hoặc federated với social providers như Google, Facebook), tự động xử lý password, MFA, verification mà không cần code tùy chỉnh hay quản lý ongoing.
  • Identity Pools liên kết với User Pools để cấp IAM roles tạm thời cho người dùng đã xác thực, cho phép họ gọi Lambda/API Gateway an toàn (fine-grained permissions).
  • Minimize overhead: Serverless native, auto-scale, tích hợp 1-click với API Gateway (Lambda authorizer). Không lo patching, backup hay scaling.
    ✅ Đây là best practice cho serverless apps với user auth (theo AWS Well-Architected Framework - Security Pillar, cập nhật 2026).

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

  • ✅ [ĐÚNG] Create Amazon Cognito user pools for external social identity providers. Configure IAM roles for the identity pools.
    🟢 Đúng vì: Như giải thích trên, Cognito là dịch vụ managed chuyên biệt cho user lifecycle (register/login), hỗ trợ social IdPs (external providers), và Identity Pools cấp IAM roles để authorize calls đến Lambda/API Gateway. Zero operational overhead, phù hợp serverless 2026 (hỗ trợ OIDC/SAML nâng cao).

  • ❌ [SAI] Program the sign-in page to create users' IAM groups with the IAM roles attached to the groups.
    ❌ Sai vì: IAM groups chỉ dành cho AWS internal users/services (nhân viên AWS account), không hỗ trợ end-user registration/login (không có password management, scaling cho hàng triệu users). Tạo groups động qua code vi phạm least privilege, tăng overhead quản lý (audit, rotation roles). Không phù hợp serverless user-facing apps.

  • ❌ [SAI] Create an Amazon RDS for SQL Server DB instance to store the users and manage the permissions to the backend resources in AWS.
    ❌ Sai vì: RDS SQL Server là managed DB nhưng operational overhead cao (provisioning, patching, backup, scaling multi-AZ, encryption keys). Không có built-in auth/MFA/encryption passwords chuẩn (phải code custom), không minimize user identity management. Vi phạm serverless principle, dễ lỗi bảo mật (SQL injection).

  • ❌ [SAI] Configure the sign-in page to register and store the users and their passwords in an Amazon DynamoDB table with an attached IAM policy.
    ❌ Sai vì: DynamoDB là NoSQL serverless nhưng không dành cho user auth (phải tự implement hashing/salting/verification, tăng code complexity và rủi ro bảo mật như credential stuffing). IAM policy attached chỉ coarse-grained, không fine-grained per-user. Overhead cao: custom scaling, encryption at-rest/transit, compliance (GDPR). Không best practice cho identities.

📚 Tài liệu tham khảo chính (cập nhật 2026):

Câu 1078
A company has a web application that is hosted on Amazon EC2 instances. The EC2 instances are configured to stream logs to Amazon CloudWatch Logs. The company needs to receive an Amazon Simple Notification Service (Amazon SNS) notification when the number of application error messages exceeds a defined threshold within a 5-minute period.

Which solution will meet these requirements?
  1. A Rewrite the application code to stream application logs to Amazon SNS. Configure an SNS topic to send a notification when the number of errors exceeds the defined threshold within a 5-minute period.
  2. B Configure a subscription filter on the CloudWatch Logs log group. Configure the filter to send an SNS notification when the number of errors exceeds the defined threshold within a 5-minute period.
  3. C Install and configure the Amazon Inspector agent on the EC2 instances to monitor for errors. Configure Amazon Inspector to send an SNS notification when the number of errors exceeds the defined threshold within a 5-minute period.
  4. D Create a CloudWatch metric filter to match the application error pattern in the log data. Set up a CloudWatch alarm based on the new custom metric. Configure the alarm to send an SNS notification when the number of errors exceeds the defined threshold within a 5-minute period.
Xem giải thích

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

Câu hỏi mô tả một ứng dụng web chạy trên các instance Amazon EC2, được cấu hình để stream logs (gửi nhật ký) trực tiếp đến Amazon CloudWatch Logs. Yêu cầu chính là nhận thông báo qua Amazon SNS khi số lượng thông báo lỗi ứng dụng (application error messages) vượt quá một ngưỡng định sẵn (threshold) trong khoảng thời gian 5 phút.

🛠️ Vấn đề cốt lõi: Cần một giải pháp tự động giám sát logs trong CloudWatch Logs, đếm số lượng lỗi dựa trên pattern cụ thể, và kích hoạt alarm để gửi SNS notification. Giải pháp phải tận dụng các dịch vụ AWS native mà không cần thay đổi code ứng dụng lớn, đảm bảo real-time monitoring và scalable. Đây là kịch bản điển hình trong AWS DevOps cho log-based alerting (cập nhật đến 2026, CloudWatch Logs vẫn hỗ trợ metric filters và alarms với độ trễ thấp ~1-5 phút).

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

Đáp án đúng: Create a CloudWatch metric filter to match the application error pattern in the log data. Set up a CloudWatch alarm based on the new custom metric. Configure the alarm to send an SNS notification when the number of errors exceeds the defined threshold within a 5-minute period.

Lý do chọn 🟢:

  • Đây là cách chuẩn AWS để xử lý logs unstructured trong CloudWatch Logs. Metric Filter quét logs theo pattern (ví dụ: regex cho "ERROR" hoặc "Exception"), tạo custom metric (ví dụ: ErrorCount) với giá trị đếm mỗi lần match.
  • CloudWatch Alarm đặt trên metric này với period 5 phút, threshold (ví dụ: Sum > 10), và action là publish to SNS topic.
  • ✅ Đầy đủ yêu cầu: Không cần thay đổi code, hỗ trợ real-time (logs stream → filter → metric → alarm trong <5 phút), scalable cho nhiều EC2. Phù hợp DOP-C01 exam (DevOps Professional).

📋 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 tiếng Anh. Mỗi phương án được đánh giá ✅ Đúng hoặc ❌ Sai, kèm giải thích bằng tiếng Việt.

  • Rewrite the application code to stream application logs to Amazon SNS. Configure an SNS topic to send a notification when the number of errors exceeds the defined threshold within a 5-minute period.
    ❌ Sai: Phải viết lại code ứng dụng để gửi logs trực tiếp đến SNS – điều này phá vỡ kiến trúc hiện tại (đã stream đến CloudWatch Logs), tốn công sức và không scalable. SNS là pub/sub messaging, không hỗ trợ đếm threshold tự động (không có metric/alarm native cho log counting trong 5 phút). Không khả thi cho production logs volume lớn.

  • Configure a subscription filter on the CloudWatch Logs log group. Configure the filter to send an SNS notification when the number of errors exceeds the defined threshold within a 5-minute period.
    ❌ Sai: Subscription filter (CloudWatch Logs Subscriptions) chỉ gửi toàn bộ logs matching filter đến đích như Lambda/Kinesis/elasticsearch/Firehose, không đếm số lượng errors hay tạo metric cho alarm. Không hỗ trợ threshold trong 5 phút trực tiếp; phải dùng Lambda để parse và custom logic – phức tạp, không native như metric filter.

  • Install and configure the Amazon Inspector agent on the EC2 instances to monitor for errors. Configure Amazon Inspector to send an SNS notification when the number of errors exceeds the defined threshold within a 5-minute period.
    ❌ Sai: Amazon Inspector (nay là Inspector v2, cập nhật 2023-2026) dùng để scan vulnerabilities, misconfigs, và runtime exploits trên EC2/ECS/Lambda, không monitor application logs hay error messages. Agent không quét logs; nó tập trung security findings (CISR/EC2 checks), không có metric cho app errors hay 5-minute threshold.

  • Create a CloudWatch metric filter to match the application error pattern in the log data. Set up a CloudWatch alarm based on the new custom metric. Configure the alarm to send an SNS notification when the number of errors exceeds the defined threshold within a 5-minute period.
    ✅ Đúng: Như giải thích trên, đây là best practice AWS. Metric filter → custom metric → alarm → SNS là flow hoàn hảo, hỗ trợ pattern matching (JSON/text/regex), statistic Sum/Average, và evaluation period 5 phút. Đáp ứng 100% yêu cầu mà không overhead.

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

🛠️ Lời khuyên DevOps: Trong thực tế, kết hợp với CloudWatch Logs Insights để query/debug patterns trước khi tạo filter! Nếu scale lớn, xem xét CloudWatch Logs to Metrics via Contributor Insights.

Câu 1079
A photo sharing application uses Amazon S3 to store image files. All user images are manually audited for inappropriate content by a third-party company. The audits are completed 1-24 hours after user upload and the results are written to an Amazon DynamoDB table, which uses the S3 object key as a primary key. The database items can be queried by using a REST API created by the third-party company.

An application developer needs to implement an automated process to tag all S3 objects with the results of the content audit.

What should the developer do to meet these requirements in the MOST operationally efficient way?
  1. A Create an AWS Lambda function to run in response to the s3:ObjectCreated event type. Write the S3 key to an Amazon Simple Queue Service (Amazon SQS) queue with a visibility timeout of 24 hours. Create and configure a second Lambda function to read items from the queue. Retrieve the results for each item from the DynamoDB table. Tag each S3 object accordingly.
  2. B Create an AWS Lambda function to run in response to the s3:ObjectCreated event type. Integrate the function into an AWS Step Functions standard workflow. Define an AWS Step Functions Wait state and set the value to 24 hours. Create and configure a second Lambda function to retrieve the audit results and tag the S3 objects accordingly after the Wait state is over.
  3. C Create an AWS Lambda function to load all untagged S3 objects. Retrieve the results for each item from the REST API and tag each S3 object accordingly. Create and configure an Amazon EventBridge rule to run at regular intervals. Set the Lambda function as a target for the EventBridge rule.
  4. D Launch an Amazon EC2 instance. Deploy a script to the EC2 instance to use the external database results to tag the S3 objects accordingly. Configure a crontab file to run the script at regular intervals.
Xem giải thích

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

Câu hỏi mô tả một ứng dụng chia sẻ ảnh sử dụng Amazon S3 để lưu trữ file ảnh người dùng. Tất cả ảnh đều được kiểm duyệt thủ công (audit) nội dung không phù hợp bởi một công ty thứ ba. Quá trình audit hoàn thành trong khoảng 1-24 giờ sau khi upload, và kết quả được ghi vào bảng Amazon DynamoDB với S3 object key làm primary key. Kết quả có thể query qua REST API do công ty thứ ba cung cấp.

Nhà phát triển ứng dụng cần triển khai quy trình tự động hóa để tag tất cả S3 objects dựa trên kết quả audit. Yêu cầu là cách hiệu quả nhất về mặt vận hành (MOST operationally efficient), nghĩa là ưu tiên giải pháp serverless, ít quản lý, đáng tin cậy, chi phí thấp và xử lý chính xác thời gian chờ đợi (khoảng 24 giờ).

🛠️ Thách thức chính: Phải chờ audit hoàn thành (tối đa 24h) trước khi tag, tránh polling liên tục (inefficient), và tận dụng serverless để giảm overhead.

📘 Kiến thức AWS cập nhật 2026: Sử dụng S3 Event Notifications (s3:ObjectCreated:*), AWS Step Functions (Standard Workflows hỗ trợ Wait state lên đến 1 năm, tích hợp Lambda), DynamoDB queries nhanh. Không khuyến khích EC2/cron cho workload event-driven. (Nguồn: AWS Step Functions Developer Guide 2025, S3 Event Notifications docs).

✅ Đáp án đúng: Phương án thứ hai (Create an AWS Lambda function to run in response to the s3:ObjectCreated event type. Integrate the function into an AWS Step Functions standard workflow. Define an AWS Step Functions Wait state and set the value to 24 hours. Create and configure a second Lambda function to retrieve the audit results and tag the S3 objects accordingly after the Wait state is over.)

Lý do chọn đáp án đúng 🏆:

  • Hiệu quả vận hành cao nhất vì serverless hoàn toàn (Lambda + Step Functions), không cần quản lý queue/infrastructure.
  • S3 Event trigger Step Functions ngay khi object created → Wait state chờ chính xác 24h (Step Functions hỗ trợ chính xác thời gian, không approximate như visibility timeout). Sau đó, Lambda thứ hai query DynamoDB và tag S3 (sử dụng PutObjectTagging).
  • Đáng tin cậy: Step Functions quản lý workflow, retry/error handling tự động, visibility cao. Chi phí thấp cho workflow dài hạn.
  • Phù hợp best practice: Event-driven + orchestration cho delayed processing. (Nguồn: AWS Well-Architected Framework - Operational Excellence pillar, Step Functions case studies 2025).

🔍 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 tiếng Anh. Mỗi phương án được đánh giá đúng/sai với lý do cụ thể:

  • [SAI] Create an AWS Lambda function to run in response to the s3:ObjectCreated event type. Write the S3 key to an Amazon Simple Queue Service (Amazon SQS) queue with a visibility timeout of 24 hours. Create and configure a second Lambda function to read items from the queue. Retrieve the results for each item from the DynamoDB table. Tag each S3 object accordingly.
    ❌ Sai vì kém hiệu quả: Visibility timeout của SQS chỉ giấu message tạm thời (khi consumer poll), không đảm bảo chờ chính xác 24h (có thể sớm hơn nếu không poll). Phức tạp hơn (2 Lambda + SQS), tăng chi phí polling queue. Không orchestration tốt như Step Functions. (Nguồn: SQS Developer Guide - Visibility Timeout limitations).

  • [ĐÚNG] Create an AWS Lambda function to run in response to the s3:ObjectCreated event type. Integrate the function into an AWS Step Functions standard workflow. Define an AWS Step Functions Wait state and set the value to 24 hours. Create and configure a second Lambda function to retrieve the audit results and tag the S3 objects accordingly after the Wait state is over.
    ✅ Đúng hoàn hảo (như đã giải thích ở trên): Serverless, chính xác thời gian chờ, dễ monitor/scale. Best practice cho delayed workflows.

  • [SAI] Create an AWS Lambda function to load all untagged S3 objects. Retrieve the results for each item from the REST API and tag each S3 object accordingly. Create and configure an Amazon EventBridge rule to run at regular intervals. Set the Lambda function as a target for the EventBridge rule.
    ❌ Sai vì inefficient: Polling tất cả untagged objects qua EventBridge (cron-like) gây chi phí cao (S3 ListObjectsV2 tốn kém với volume lớn), query REST API lặp lại không cần thiết. Không event-driven, dễ miss/throttle. (Nguồn: AWS Compute Optimizer - Avoid polling patterns).

  • [SAI] Launch an Amazon EC2 instance. Deploy a script to the EC2 instance to use the external database results to tag the S3 objects accordingly. Configure a crontab file to run the script at regular intervals.
    ❌ Sai hoàn toàn: Không serverless, phải quản lý EC2 (patching, scaling, HA), cron polling inefficient/tốn kém. Không tận dụng S3 events, overhead cao cho workload đơn giản. Vi phạm Operational Excellence. (Nguồn: AWS Well-Architected - Reliability pillar, migrate to serverless).

Câu 1080
A company has built an AWS Lambda function to convert large image files into output files that can be used in a third-party viewer application. The company recently added a new module to the function to improve the output of the generated files. However, the new module has increased the bundle size and has increased the time that is needed to deploy changes to the function code.

How can a developer increase the speed of the Lambda function deployment?
  1. A Use AWS CodeDeploy to deploy the function code.
  2. B Use Lambda layers to package and load dependencies.
  3. C Increase the memory size of the function.
  4. D Use Amazon S3 to host the function dependencies.
Xem giải thích

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

Câu hỏi xoay quanh một công ty đã xây dựng AWS Lambda function để chuyển đổi các file hình ảnh lớn thành định dạng phù hợp cho ứng dụng xem bên thứ ba. Gần đây, họ thêm một module mới vào function để cải thiện chất lượng output, nhưng module này làm tăng kích thước bundle (file zip chứa code và dependencies) và tăng thời gian deploy (triển khai thay đổi code lên Lambda).

📌 Vấn đề cốt lõi: Deploy Lambda chậm do bundle size lớn (thường upload lên S3 trước khi Lambda unzip và chạy). Câu hỏi yêu cầu giải pháp để tăng tốc độ deploy function, không phải tăng tốc độ thực thi runtime. Đây là chủ đề phổ biến trong AWS Lambda best practices (cập nhật đến 2026, theo AWS Well-Architected Framework cho Serverless).

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

Đáp án đúng: Use Lambda layers to package and load dependencies.

🛠️ Lý do chi tiết: Lambda Layers cho phép tách dependencies (thư viện, module bên thứ ba) ra khỏi bundle code chính, lưu trữ chúng dưới dạng layer riêng biệt. Khi deploy, bạn chỉ cần upload code chính nhỏ gọn (không chứa dependencies nặng), Layers được AWS cache và attach vào function mà không cần upload lại mỗi lần. Kết quả: Giảm kích thước file zip deploy xuống đáng kể (có thể từ hàng trăm MB còn vài MB), tăng tốc deploy lên đến 90% theo case study AWS. Đây là giải pháp chính thức được khuyến nghị trong docs AWS Lambda (vẫn là best practice đến 2026, hỗ trợ lên đến 5 layers/function và kích thước layer 250MB unzipped).

📘 Tài liệu tham khảo:

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

Dưới đây là phân tích từng lựa chọn một cách chi tiết, dựa trên kiến thức AWS mới nhất (Lambda runtime hỗ trợ Layers v2 với improved caching từ 2023-2026):

  • ❌ Use AWS CodeDeploy to deploy the function code.
    Phương án này sai vì AWS CodeDeploy chủ yếu dùng cho EC2, ECS, Lambda với alias/traffic shifting (blue/green deployment), nhưng không giải quyết vấn đề bundle size lớn. CodeDeploy chỉ quản lý quy trình deploy (rollout, rollback), vẫn phải upload toàn bộ bundle lớn qua ZIP/S3, nên thời gian deploy không giảm. Thậm chí, với Lambda alias, nó còn thêm overhead validation. Không phù hợp cho tốc độ deploy thuần túy.

  • ✅ Use Lambda layers to package and load dependencies.
    Phương án này đúng như đã giải thích ở trên. Layers giảm kích thước bundle deploy bằng cách externalize dependencies, AWS tự động quản lý versioning và caching. Ví dụ: Với image processing libs như Pillow/OpenCV nặng, di chuyển chúng vào layer giúp deploy chỉ mất giây thay vì phút. Hỗ trợ multi-runtime (Python, Node.js, etc.) và immutable layers cho production.

  • ❌ Increase the memory size of the function.
    Phương án này sai vì tăng memory (lên đến 10,240 MB từ 2024) chỉ ảnh hưởng đến performance runtime (execution time, CPU allocation), không liên quan đến deploy time. Deploy vẫn phải upload toàn bộ bundle lớn qua API Gateway/S3, memory config chỉ apply sau khi deploy xong. Đây là nhầm lẫn phổ biến giữa deploy speed và cold start/runtime speed.

  • ❌ Use Amazon S3 to host the function dependencies.
    Phương án này sai vì S3 chỉ lưu trữ static files, Lambda không tự động load dependencies từ S3 vào runtime (trừ khi code tự fetch lúc runtime, gây cold start chậm hơn). Deploy vẫn cần bundle tất cả vào ZIP (bao gồm download dependencies thủ công), dẫn đến bundle size vẫn lớn + thêm latency fetch. Không có cơ chế caching tự động như Layers. AWS khuyến cáo dùng Layers thay vì S3 hack này.

🧠 Lời khuyên DevOps: Trong thực tế DOP-C02 exam, ưu tiên Layers cho dependency management. Kết hợp với Lambda CI/CD via CodePipeline/CodeBuild để automate layer versioning. Test bằng aws lambda update-function-code --zip-file để đo deploy time before/after! 🚀