Ngân hàng đề — AWS Certified Developer Associate
Tìm thấy 1356 câu.
Based on this scenario, what is the MOST cost-effective solution to this problem?
- A Remove the application from the ALB. Delete the ALB and change Amazon Route 53 to direct traffic to the instance running the application.
- B Remove the application from the ALCreate a Classic Load Balancer in its place. Direct traffic to the application using the HTTP protocol.
- C Alter the application code to inspect the X-Forwarded-For header. Ensure that the code can work properly if a list of IP addresses is passed in the header.
- D Alter the application code to inspect a custom header. Alter the client code to pass the IP address in the custom header.
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 cần sử dụng địa chỉ IP của client (người dùng cuối) để xử lý logic kinh doanh. Ứng dụng đã được di chuyển lên AWS và đặt sau Application Load Balancer (ALB) để hỗ trợ scale horizontally (mở rộng ngang). Tuy nhiên, vấn đề xảy ra: tất cả các yêu cầu từ client giờ đây đều hiển thị cùng một IP address (chính là IP của ALB, vì ALB hoạt động như một proxy trung gian, thay thế IP client bằng IP của chính nó).
Yêu cầu chính: Tìm giải pháp cost-effective nhất (tiết kiệm chi phí nhất) để lấy đúng IP client, đồng thời duy trì khả năng scale horizontally (không làm mất lợi ích load balancing và auto-scaling).
🛠️ Nguyên nhân gốc rễ: ALB (và các LB khác) là Layer 7 proxy, nó terminate kết nối TCP từ client và tạo kết nối mới đến backend, dẫn đến IP client bị mất. AWS cung cấp các header chuẩn như X-Forwarded-For để truyền IP gốc.
✅ Đáp án đúng:
Alter the application code to inspect the X-Forwarded-For header. Ensure that the code can work properly if a list of IP addresses is passed in the header.
Lý do chọn đáp án này (chi tiết):
- Đây là giải pháp chuẩn của AWS, hoàn toàn cost-effective vì không cần thay đổi hạ tầng (không xóa ALB, không thêm LB mới), chỉ sửa code ứng dụng một lần.
- ALB tự động thêm header X-Forwarded-For chứa IP client gốc (và có thể là list IP nếu qua nhiều proxy). Code app chỉ cần parse header này (lấy IP đầu tiên hoặc cuối cùng tùy logic, và handle trường hợp list IP).
- Duy trì scale horizontally hoàn hảo: ALB vẫn phân tải đến nhiều instance EC2/Auto Scaling Group.
- Theo tài liệu AWS mới nhất (2026), ALB hỗ trợ header này mặc định cho HTTP/HTTPS, không tốn phí thêm. ✅ Hoàn hảo cho production!
🔍 Giải thích tất cả các phương án (đúng/sai)
-
❌ Phương án SAI: Remove the application from the ALB. Delete the ALB and change Amazon Route 53 to direct traffic to the instance running the application.
Lý do sai: Xóa ALB làm mất load balancing và scale horizontally (traffic chỉ đến 1 instance duy nhất, dễ single point of failure). Route 53 chỉ là DNS, không thay thế được LB. Giải pháp này đắt đỏ hơn (mất HA/scaling) và không scalable. Không khuyến khích vì vi phạm best practice AWS. -
❌ Phương án SAI: Remove the application from the ALCreate a Classic Load Balancer in its place. Direct traffic to the application using the HTTP protocol.
(Lưu ý: Có lỗi đánh máy trong câu gốc, có lẽ là "Remove the application from the ALB. Create...")
Lý do sai: Classic Load Balancer (ELB Gen1) đã deprecated từ 2023, AWS khuyến nghị migrate sang ALB/NLB. Classic LB cũng là proxy → vẫn mất IP client (cũng dùng X-Forwarded-For tương tự). Không cost-effective (phí cao hơn ALB, không feature-rich), và không scale tốt bằng ALB cho HTTP apps. Tránh dùng! -
✅ Phương án ĐÚNG: Alter the application code to inspect the X-Forwarded-For header. Ensure that the code can work properly if a list of IP addresses is passed in the header.
Lý do đúng: Như đã giải thích ở trên. X-Forwarded-For là header chuẩn RFC 7239, ALB append IP client vào (ví dụ: "203.0.113.195, 198.51.100.178"). Code cần parse list và lấy IP đúng vị trí (thường là phần tử đầu hoặc cuối). Giải pháp zero-cost hạ tầng, chỉ code change nhỏ. Hoàn hảo! -
❌ Phương án SAI: Alter the application code to inspect a custom header. Alter the client code to pass the IP address in the custom header.
Lý do sai: Yêu cầu sửa code client-side (có thể là browser/mobile/public users) → không khả thi vì không kiểm soát được tất cả client. Custom header không chuẩn, dễ bị spoof (fake IP). Không cost-effective (phức tạp, không scalable), vi phạm nguyên tắc "app behind LB phải dùng proxy headers chuẩn".
📘 Tài liệu tham khảo (AWS cập nhật 2026)
- AWS ALB X-Forwarded Headers: docs.aws.amazon.com/elasticloadbalancing/latest/application/x-forwarded-headers.html – Chi tiết cách ALB thêm X-Forwarded-For.
- ALB Best Practices: docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html – Khuyến nghị dùng header cho client IP.
- Classic LB Deprecation: aws.amazon.com/blogs/aws/classic-load-balancer-support-policy/ – Không dùng nữa từ 2023.
🛠️ Mẹo DevOps: Luôn test vớicurl -H "X-Forwarded-For: 1.2.3.4"để verify code parse đúng!
The application must provide seats to customers according to the following requirements. If a seat is accidently sold more than once, the first order that the application received must get the seat. In these cases, the application must process the payment for only the first order. However, if the first order is rejected during payment processing, the second order must get the seat. In these cases, the application must process the payment for the second order.
Which solution will meet these requirements?
-
A
Send the order ID to an Amazon Simple Notification Service (Amazon SNS) FIFO topic that fans out to one Amazon Simple Queue Service (Amazon SQS) FIFO queue for inventory management and another SQS FIFO queue for payment processing.
-
B
Change the Lambda function that generates the order ID to initiate the Lambda function for inventory management. Then initiate the Lambda function for payment processing.
-
C
Send the order ID to an Amazon Simple Notification Service (Amazon SNS) topic. Subscribe the Lambda functions for inventory management and payment processing to the topic.
- D Deliver the order ID to an Amazon Simple Queue Service (Amazon SQS) queue. Configure the Lambda functions for inventory management and payment processing to poll the queue.
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 serverless trên AWS dùng để khách hàng chọn ghế xem concert. Quy trình chính như sau:
- Khách gửi request qua Amazon API Gateway đến AWS Lambda đầu tiên, Lambda này xác nhận order và tạo order ID.
- Sau đó, có hai Lambda khác chạy song song (parallel): một quản lý inventory (kiểm tra/chốt ghế), một xử lý payment, cả hai ghi order vào DynamoDB.
Yêu cầu kinh doanh quan trọng 📋:
- Nếu ghế bị bán nhầm hai lần trở lên, order đầu tiên nhận được (first-come-first-served).
- Chỉ xử lý payment cho order đầu tiên.
- Ngoại lệ: Nếu order đầu tiên fail payment, thì order thứ hai được ghế và xử lý payment.
Vấn đề cốt lõi là đảm bảo thứ tự xử lý nghiêm ngặt (strict ordering) giữa các order trùng lặp (ví dụ: cùng một ghế), đồng thời hỗ trợ parallel processing cho inventory và payment, tránh race condition hoặc double-payment. Giải pháp phải dùng cơ chế FIFO (First-In-First-Out) để duy trì thứ tự và deduplication (loại bỏ trùng lặp). Kiến thức AWS cập nhật đến 2026: SNS và SQS FIFO hỗ trợ message group ID để order per-group, fan-out parallel mà vẫn giữ thứ tự.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Send the order ID to an Amazon Simple Notification Service (Amazon SNS) FIFO topic that fans out to one Amazon Simple Queue Service (Amazon SQS) FIFO queue for inventory management and another SQS FIFO queue for payment processing.
Lý do chi tiết 🛠️:
- SNS FIFO topic hỗ trợ fan-out đến nhiều SQS FIFO queue, duy trì thứ tự nghiêm ngặt theo message group ID (dùng order ID làm group ID).
- Hai SQS FIFO queue riêng biệt cho inventory và payment: parallel processing nhưng đồng bộ thứ tự – inventory Lambda poll queue 1, payment Lambda poll queue 2.
- Xử lý conflict hoàn hảo: Order đầu vào FIFO trước → được xử lý inventory/payment trước. Nếu payment fail (inventory commit ghế cho order 1), DynamoDB có thể detect và rollback để order 2 (vào sau) được xử lý tiếp. Deduplication tránh process trùng.
- Đáp ứng exactly-once semantics và ordered delivery, lý tưởng cho serverless với high concurrency.
📘 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. Tôi giữ nguyên văn bản gốc tiếng Anh của phương án, đánh dấu ✅ (đúng) hoặc ❌ (sai), và giải thích hoàn toàn bằng tiếng Việt với lý do dựa trên AWS best practices.
-
Send the order ID to an Amazon Simple Notification Service (Amazon SNS) FIFO topic that fans out to one Amazon Simple Queue Service (Amazon SQS) FIFO queue for inventory management and another SQS FIFO queue for payment processing.
✅ Đúng – Như giải thích trên, SNS FIFO + SQS FIFO fan-out đảm bảo ordered delivery và deduplication per message group. Parallel nhưng strict order, xử lý fail-back cho order 2. Hoàn hảo cho yêu cầu "first order wins, except payment fail". -
Change the Lambda function that generates the order ID to initiate the Lambda function for inventory management. Then initiate the Lambda function for payment processing.
❌ Sai – Làm sequential invoke (inventory → payment), vi phạm yêu cầu parallel processing. Không scale tốt với high traffic concert, dễ timeout Lambda (15 phút max), và không handle duplicate orders từ nhiều request đồng thời (race condition). -
Send the order ID to an Amazon Simple Notification Service (Amazon SNS) topic. Subscribe the Lambda functions for inventory management and payment processing to the topic.
❌ Sai – SNS standard topic (không FIFO) không đảm bảo thứ tự – messages có thể out-of-order, dẫn đến order 2 xử lý inventory trước order 1 → sai "first order gets seat". Lambda direct subscribe SNS cũng kém decoupled, không retry tốt như SQS. -
Deliver the order ID to an Amazon Simple Queue Service (Amazon SQS) queue. Configure the Lambda functions for inventory management and payment processing to poll the queue.
❌ Sai – SQS standard queue (không FIFO) không giữ thứ tự, cả hai Lambda poll cùng queue → competing consumers, order 2 có thể poll trước order 1 → double-booking hoặc wrong payment. Không fan-out parallel hiệu quả.
📚 Tài liệu tham khảo (AWS cập nhật 2026)
- SNS FIFO: Amazon SNS FIFO topics – Hỗ trợ fan-out ordered đến SQS FIFO.
- SQS FIFO: Amazon SQS FIFO queues – Exactly-once + ordering per group.
- Serverless patterns: AWS Well-Architected Framework – Reliability Pillar: Serverless Lens.
- Exam tip 🎯: DOP-C02 exam nhấn mạnh FIFO cho ordering in decoupled systems.
Giải pháp này scalable, reliable và fully serverless! 🚀 Nếu cần code sample hoặc diagram, hỏi thêm nhé!
How should the developer use filter expressions to filter the results in X-Ray?
- A Add custom attributes as annotations in the segment document.
- B Add custom attributes as metadata in the segment document.
- C Add custom attributes as new segment fields in the segment document.
- D Create new sampling rules that are based on custom attributes.
Xem giải thích
🧩 Giải thích nội dung câu hỏi
Câu hỏi tập trung vào AWS X-Ray, một dịch vụ theo dõi và phân tích traces (dấu vết) ứng dụng phân tán. Ứng dụng tạo ra lượng lớn trace data hàng giờ, và developer muốn sử dụng filter expressions (biểu thức lọc) để giới hạn kết quả trả về dựa trên custom attributes (thuộc tính tùy chỉnh do người dùng chỉ định).
🔍 Chi tiết vấn đề:
- X-Ray lưu trữ traces dưới dạng segment documents (tài liệu phân đoạn), bao gồm thông tin về requests, subsegments, và metadata.
- Filter expressions được dùng trong các API như
GetTraceSummaries,GetTraceGraph,GetServiceGraphđể query traces theo điều kiện cụ thể (ví dụ:annotation.property=value). - Yêu cầu là cách thêm custom attributes vào segment document sao cho chúng có thể được lọc bằng filter expressions một cách hiệu quả.
- Kiến thức cập nhật đến 2026: AWS X-Ray hỗ trợ annotations/metadata từ lâu, nhưng chỉ annotations mới được index tự động và query được qua filter expressions (theo docs AWS mới nhất).
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Add custom attributes as annotations in the segment document.
Lý do chi tiết 🛠️:
- Annotations là các cặp key-value được index tự động bởi X-Ray service, cho phép sử dụng filter expressions để query chính xác (ví dụ:
annotation.userId=123hoặcannotations.s3.bucketName="my-bucket"). - Điều này phù hợp hoàn hảo với nhu cầu "limit the returned results through user-specified custom attributes" vì annotations hỗ trợ toán tử như
=,!=,>,<, và kết hợp vớiAND/OR. - Không dùng annotations sẽ không thể filter hiệu quả với lượng dữ liệu lớn hàng giờ.
📋 Giải thích tất cả các phương án (đúng và sai)
Dưới đây là phân tích từng lựa chọn, giữ nguyên văn bản gốc tiếng Anh:
-
✅ Add custom attributes as annotations in the segment document.
🛠️ Đúng vì annotations được X-Ray index và hỗ trợ filter expressions đầy đủ (string, number, boolean). Đây là cách chuẩn theo AWS best practices cho custom filtering. Ví dụ SDK:segment.addAnnotation("userId", "123"). -
❌ Add custom attributes as metadata in the segment document.
🛠️ Sai vì metadata chỉ lưu trữ để hiển thị trong console hoặc export, không được index nên không thể dùng filter expressions để query (chỉ search text thô trong trace summary, không chính xác với custom attributes). -
❌ Add custom attributes as new segment fields in the segment document.
🛠️ Sai vì segment document có cấu trúc chuẩn (name, id, start_time, end_time, v.v.), không hỗ trợ thêm custom fields tùy ý. Việc chỉnh sửa schema sẽ làm trace invalid, không tương thích với X-Ray ingestion và filtering. -
❌ Create new sampling rules that are based on custom attributes.
🛠️ Sai vì sampling rules chỉ quyết định có sample trace vào X-Ray không (dựa trên service, URL, HTTP method), không dùng để filter kết quả đã lưu (post-sampling). Filter expressions hoạt động trên traces đã sampled.
📘 Tài liệu tham khảo (AWS cập nhật 2026)
- AWS X-Ray Developer Guide - Annotations: https://docs.aws.amazon.com/xray/latest/devguide/xray-concepts.html#xray-concepts-annotations (Giải thích annotations vs metadata và filtering).
- Filter Expressions Reference: https://docs.aws.amazon.com/xray/latest/devguide/xray-api-gettracessummaries.html#xray-api-gettracessummaries-filter-expression (Ví dụ filter với annotations).
- SDK Examples: AWS SDK for X-Ray (Python/Java/JS) -
add_annotation()method (docs.aws.amazon.com/xray/latest/devguide/xray-sdk.html).
Hy vọng phân tích này giúp bạn ôn thi DevOps Professional hiệu quả! 🚀 Nếu cần thêm ví dụ code, hãy hỏi nhé!
How can the developer implement encryption at rest for data within the Kinesis Data Streams?
- A Enable SSL connections to Kinesis.
- B Use Amazon Kinesis Consumer Library.
- C Encrypt the data once it is at rest with a Lambda function.
- D Enable server-side encryption in Kinesis Data Streams.
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 việc triển khai mã hóa dữ liệu tại trạng thái nghỉ (encryption at rest) cho dữ liệu trong Amazon Kinesis Data Streams.
Một ứng dụng web sử dụng Kinesis Data Streams để thu thập dữ liệu clickstream (dữ liệu theo dõi hành vi người dùng). Dữ liệu này có thể không được tiêu thụ (consume) trong vòng tối đa 12 giờ, nghĩa là nó sẽ được lưu trữ tạm thời trong stream với thời gian giữ dữ liệu (retention period) mặc định là 24 giờ (có thể cấu hình lên đến 365 ngày theo tài liệu AWS mới nhất năm 2024-2026).
Vấn đề chính: Làm thế nào để mã hóa dữ liệu ngay khi nó nằm yên trong stream (at rest), đảm bảo tính bảo mật theo tiêu chuẩn AWS. Kinesis Data Streams lưu trữ dữ liệu shard-based, và encryption at rest là tính năng server-side được hỗ trợ trực tiếp để bảo vệ dữ liệu không bị truy cập trái phép nếu shard bị lộ.
📘 Kiến thức cập nhật AWS (2026): Từ năm 2018, Kinesis hỗ trợ Server-Side Encryption (SSE) với AWS KMS (SSE-KMS hoặc SSE-AWS-managed). Đây là cách chính thức, dễ triển khai qua Console, CLI, hoặc SDK. Không cần mã hóa client-side phức tạp.
✅ Đáp án đúng: Enable server-side encryption in Kinesis Data Streams
Lý do lựa chọn (chi tiết):
🛠️ Phương án này kích hoạt mã hóa server-side trực tiếp trên Kinesis Data Streams, sử dụng AWS Key Management Service (KMS) để tự động mã hóa dữ liệu ngay khi ghi vào shard và giải mã khi đọc.
- Hỗ trợ retention 12 giờ: Dữ liệu được mã hóa xuyên suốt thời gian lưu trữ (24h-365 ngày), phù hợp hoàn hảo.
- Dễ triển khai: Sử dụng lệnh
UpdateStreamAPI hoặc Console > Stream > Encryption. Chọn KMS key (customer-managed hoặc AWS-managed). - Tuân thủ best practices: AWS khuyến nghị SSE cho compliance (GDPR, HIPAA). Không ảnh hưởng hiệu suất stream (low latency).
Kết quả: Dữ liệu at rest an toàn 100% mà không cần can thiệp code.
📋 Giải thích tất cả các phương án (đúng/sai)
-
Enable SSL connections to Kinesis.
❌ Sai: SSL (nay là TLS) chỉ mã hóa dữ liệu trong quá trình truyền (in transit) giữa producer/consumer và Kinesis endpoint. Không ảnh hưởng đến dữ liệu at rest trong shard. Dù bắt buộc TLS cho Kinesis từ 2022, nó không giải quyết yêu cầu câu hỏi. -
Use Amazon Kinesis Consumer Library.
❌ Sai: Kinesis Consumer Library (KCL) là thư viện Java/Python để tiêu thụ dữ liệu đa luồng/checkpointing từ stream (như EMR, Lambda). Hoàn toàn không liên quan đến mã hóa at rest; chỉ hỗ trợ consume, không encrypt dữ liệu lưu trữ. -
Encrypt the data once it is at rest with a Lambda function.
❌ Sai: Không khả thi vì dữ liệu trong Kinesis không thể chỉnh sửa sau khi ghi (immutable shards). Lambda chỉ trigger trên event (như PutRecord), nhưng không truy cập/encrypt dữ liệu at rest trực tiếp. Cách này phức tạp, không scale, và vi phạm nguyên tắc serverless của AWS. -
Enable server-side encryption in Kinesis Data Streams.
✅ Đúng: Như giải thích trên, đây là tính năng native, tự động mã hóa toàn bộ dữ liệu lưu trữ với KMS keys. Hỗ trợ audit log qua CloudTrail.
🔗 Tài liệu tham khảo chính thức AWS (cập nhật 2026)
- 📘 Amazon Kinesis Data Streams Encryption at Rest – Hướng dẫn chi tiết SSE-KMS.
- 📘 Kinesis Data Streams Developer Guide – Retention & Security best practices.
- 🛠️ AWS CLI Example –
aws kinesis update-stream --stream-name MyStream --stream-mode-details StreamMode=ON_DEMAND --encryption-type KMS --key-id alias/aws/kinesis.
💡 Lời khuyên DevOps: Trong production, kết hợp IAM policies hạn chế KMS key usage và enable CloudWatch metrics theo dõi decryption errors. Nếu cần client-side encryption, dùng AWS Encryption Library trước khi PutRecord, nhưng server-side là ưu tiên cho at rest!
What service could be used to allow multiple consumers to process the data concurrently and MOST cost-effectively?
- A Amazon SNS with fanout to an SQS queue for each application
- B Amazon SNS with fanout to an SQS FIFO (first-in, first-out) queue for each application
- C Amazon Kinesis Firehose
- D Amazon Kinesis Data Streams
Xem giải thích
🧩 Giải thích nội dung câu hỏi
Câu hỏi tập trung vào một ứng dụng xử lý real-time (thời gian thực) hàng triệu sự kiện (events) được nhận qua API. Yêu cầu chính là chọn dịch vụ AWS cho phép nhiều người tiêu dùng (multiple consumers) xử lý dữ liệu đồng thời (concurrently) và tiết kiệm chi phí nhất (MOST cost-effectively).
🔍 Phân tích yêu cầu cốt lõi:
- Real-time processing: Dữ liệu phải được xử lý ngay lập tức, không buffer lâu.
- Millions of events: Cần xử lý throughput cao, scalable.
- Multiple consumers concurrently: Nhiều ứng dụng/consumer có thể đọc và xử lý cùng dữ liệu song song mà không làm mất tính đồng thời hoặc duplicate không cần thiết.
- Cost-effectively: Ưu tiên mô hình giá rẻ, dựa trên usage thực tế (như shard-hour, không tính per message cao).
Dựa trên kiến thức AWS cập nhật đến 2026 (AWS Well-Architected Framework cho Streaming Data và Kinesis family), đây là tình huống streaming data với multiple readers từ cùng nguồn dữ liệu.
✅ Đáp án đúng và lý do lựa chọn
Amazon Kinesis Data Streams là lựa chọn đúng nhất!
🛠️ Lý do chi tiết:
- Kinesis Data Streams (KDS) được thiết kế dành riêng cho real-time streaming với throughput cao (hàng triệu events/giây).
- Hỗ trợ multiple consumers concurrently: Mỗi shard cho phép nhiều consumer đọc độc lập (sử dụng Enhanced Fan-Out từ 2019, cập nhật 2024 với Consumer Applications API), mỗi consumer có iterator riêng, đọc dữ liệu cùng lúc mà không ảnh hưởng lẫn nhau.
- Cost-effective: Giá chỉ ~$0.015/shard-giờ + $0.014/100.000 units PUT payload units (2026 pricing), scalable theo nhu cầu, không charge per consumer. Rẻ hơn so với duplicate data qua SNS/SQS.
- Phù hợp API ingestion: Sử dụng Producer SDK để đẩy events trực tiếp.
📋 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 (giữ nguyên văn bản gốc tiếng Anh). Tôi đánh dấu ✅ đúng hoặc ❌ sai, kèm giải thích bằng tiếng Việt rõ ràng:
-
❌ Amazon SNS with fanout to an SQS queue for each application
Phương án này dùng SNS làm pub/sub với fanout (gửi 1 message đến nhiều SQS queue). ❌ Sai vì: SNS không lưu trữ dữ liệu lâu (chỉ retain ngắn), không hỗ trợ real-time streaming cho millions events (throttling tại 300.000 msg/phút/topic). Multiple consumers yêu cầu queue riêng → duplicate data (tốn chi phí lưu trữ/processing gấp đôi), không concurrent read từ cùng source. SQS standard không đảm bảo order, kém cost-effective (SNS $0.50/million publishes + SQS fees). -
❌ Amazon SNS with fanout to an SQS FIFO (first-in, first-out) queue for each application
Tương tự trên nhưng dùng SQS FIFO (hỗ trợ exactly-once, ordering). ❌ Sai vì: Vẫn duplicate data cho mỗi queue (tốn kém gấp nhiều lần), throughput giới hạn (3.000 msg/giây/queue), không phải streaming real-time (SQS polling delay ~1-10s). Không concurrent processing hiệu quả từ cùng dataset, chi phí cao hơn KDS (SNS + FIFO fees ~$0.45/million requests). -
❌ Amazon Kinesis Firehose
Kinesis Data Firehose dùng để capture + transform + load dữ liệu vào S3/Redshift/etc. ❌ Sai vì: Không hỗ trợ multiple consumers concurrently (chỉ single pipeline delivery, buffer 60s-24h), tập trung batch delivery chứ không real-time processing. Không scalable cho custom consumers đọc stream, chi phí dựa trên GB ingested (~$0.029/GB), kém hiệu quả cho millions events cần processing ngay. -
✅ Amazon Kinesis Data Streams
Như đã giải thích ở trên: Hoàn hảo cho real-time, multiple concurrent consumers (enhanced fan-out lên đến 2MB/s/consumer/shard), cost-effective với autoscaling shards (2025 update).
📘 Tài liệu tham khảo
- AWS Docs: Amazon Kinesis Data Streams Developer Guide (Enhanced Fan-Out section).
- Kinesis vs. SNS/SQS Comparison (cập nhật 2024).
- AWS Pricing Calculator: Kinesis Pricing (2026 rates).
- Well-Architected: Streaming Data Lens (Reliability pillar: Multiple consumers pattern).
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ỏi nhé!
Description: Creates a new Amazon S3 bucket for shared content. Uses a random bucket name to avoid conflicts.
Resources:
ContentBucket:
Type: AWS::S3::Bucket
Outputs:
ContentBucketName:
Value: !Ref ContentBucket
What is the MOST efficient way to reference the new Amazon S3 bucket from another AWS CloudFormation template?
- A Add an Export declaration to the Outputs section of the original template and use ImportValue in other templates.
- B Add Exported: true to the Content.Bucket in the original template and use ImportResource in other templates.
- C Create a custom AWS CloudFormation resource that gets the bucket name from the ContentBucket resource of the first stack.
- D Use Fn::Include to include the existing template in other templates and use the ContentBucket resource directly.
Xem giải thích
📘 Phân tích câu hỏi
Câu hỏi yêu cầu tìm cách tham chiếu hiệu quả nhất đến một bucket Amazon S3 được tạo ra bởi một template AWS CloudFormation từ một template khác. Template ban đầu tạo ra một bucket S3 với tên ngẫu nhiên để tránh trùng lặp.
Nội dung template:
Description: Creates a new Amazon S3 bucket for shared content. Uses a random bucket name to avoid conflicts.
Resources:
ContentBucket:
Type: AWS::S3::Bucket
Outputs:
ContentBucketName:
Value: !Ref ContentBucket
Các lựa chọn:
- Add an Export declaration to the Outputs section of the original template and use ImportValue in other templates.
- Add Exported: true to the Content.Bucket in the original template and use ImportResource in other templates.
- Create a custom AWS CloudFormation resource that gets the bucket name from the ContentBucket resource of the first stack.
- Use Fn::Include to include the existing template in other templates and use the ContentBucket resource directly.
Giải thích các lựa chọn:
1. Add an Export declaration to the Outputs section of the original template and use ImportValue in other templates. ✅
Cách này cho phép bạn xuất giá trị của ContentBucketName từ template ban đầu và nhập nó vào template khác. Điều này có thể được thực hiện bằng cách thêm một khai báo Export vào phần Outputs của template ban đầu:
Outputs:
ContentBucketName:
Value: !Ref ContentBucket
Export:
Name: ContentBucketName
Sau đó, trong template khác, bạn có thể nhập giá trị này bằng cách sử dụng ImportValue:
Resources:
MyResource:
Type: AWS::S3::Object
Properties:
Bucket: !ImportValue ContentBucketName
Đây là cách tham chiếu hiệu quả và an toàn.
2. Add Exported: true to the Content.Bucket in the original template and use ImportResource in other templates. ❌
Không có thuộc tính Exported trong tài nguyên AWS::S3::Bucket. Hơn nữa, ImportResource không phải là một hàm hợp lệ trong AWS CloudFormation.
3. Create a custom AWS CloudFormation resource that gets the bucket name from the ContentBucket resource of the first stack. ❌
Tạo một tài nguyên tùy chỉnh để lấy tên bucket từ stack đầu tiên không phải là cách tiếp cận hiệu quả nhất. Điều này có thể làm tăng độ phức tạp và không đảm bảo tính nhất quán.
4. Use Fn::Include to include the existing template in other templates and use the ContentBucket resource directly. ❌
Fn::Include chỉ có thể được sử dụng để bao gồm các template con, không phải để tham chiếu tài nguyên giữa các template khác nhau.
Kết luận:
Cách tham chiếu hiệu quả nhất đến bucket Amazon S3 từ template khác là sử dụng Export và ImportValue. 📘
Tài liệu tham khảo:
- AWS CloudFormation User Guide: Exporting and importing stack outputs
Which actions should the developer take to resolve this issue? (Choose two.)
- A Move the application to a larger EC2 instance.
- B Increase the number of read capacity units (RCUs) that are provisioned for the DynamoDB table.
- C Reduce the frequency of requests to DynamoDB by implementing exponential backoff.
- D Increase the frequency of requests to DynamoDB by decreasing the retry delay.
- E Change the capacity mode of the DynamoDB table from provisioned to on-demand.
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 lập trình viên đã xây dựng ứng dụng chèn dữ liệu (insert data) vào bảng Amazon DynamoDB được cấu hình sử dụng provisioned capacity (dung lượng được cung cấp cố định, nơi bạn phải chỉ định số lượng Read Capacity Units - RCUs và Write Capacity Units - WCUs trước). Ứng dụng được triển khai trên instance Amazon EC2 loại burstable nano (như t3.nano, có khả năng burst CPU nhưng giới hạn baseline thấp). Log ứng dụng cho thấy lỗi ProvisionedThroughputExceededException – đây là lỗi throttling xảy ra khi số lượng request (read/write) vượt quá giới hạn throughput đã provisioned cho bảng DynamoDB.
Vấn đề cốt lõi: Ứng dụng đang gửi quá nhiều request write (insert) so với WCUs đã provisioned, dẫn đến DynamoDB từ chối request để bảo vệ bảng. Câu hỏi yêu cầu chọn HAI hành động để giải quyết vấn đề này. (Chú ý: Kiến thức cập nhật đến 2026, DynamoDB vẫn hỗ trợ provisioned với auto-scaling, on-demand capacity, và các best practices như exponential backoff theo AWS Well-Architected Framework.)
✅ Đáp án đúng (chọn TWO):
- Reduce the frequency of requests to DynamoDB by implementing exponential backoff.
- Change the capacity mode of the DynamoDB table from provisioned to on-demand.
🛠️ Lý do lựa chọn các đáp án đúng:
Những hành động này trực tiếp giải quyết nguyên nhân gốc rễ (throttling do vượt throughput provisioned):
- Exponential backoff giảm tải request ngay lập tức mà không cần thay đổi hạ tầng.
- Chuyển sang on-demand mode (cập nhật 2023-2026: hỗ trợ scale tự động lên đến 40,000 RCUs/WCUs/giây, không cần provision trước, phù hợp workload không dự đoán được).
🔍 Giải thích chi tiết TẤT CẢ các phương án (giữ nguyên văn bản gốc bằng tiếng Anh)
-
❌ Move the application to a larger EC2 instance.
❌ Sai: Kích thước EC2 (như từ nano lên lớn hơn) chỉ ảnh hưởng đến hiệu suất CPU/memory của ứng dụng, không liên quan đến giới hạn throughput của DynamoDB. Lỗi throttling xảy ra ở phía DynamoDB, không phải do EC2 yếu. Việc upscale EC2 có thể làm ứng dụng gửi request nhanh hơn, tệ hơn vấn đề! (Burstable nano vẫn đủ cho app đơn giản nếu DynamoDB handle được.) -
❌ Increase the number of read capacity units (RCUs) that are provisioned for the DynamoDB table.
❌ Sai: Ứng dụng đang insert data (write operation), cần tăng Write Capacity Units (WCUs) chứ không phải RCUs (dành cho read). Lỗi ProvisionedThroughputExceededException có thể từ write throttling, tăng RCUs không giải quyết. (Theo docs AWS 2026: Provisioned mode yêu cầu tính toán chính xác RCU/WCU dựa trên workload; sai loại unit sẽ lãng phí chi phí.) -
✅ Reduce the frequency of requests to DynamoDB by implementing exponential backoff.
✅ Đúng: Đây là best practice của AWS cho DynamoDB (Retry with exponential backoff). Khi gặp throttling, app nên delay request dần dần (ví dụ: 50ms → 100ms → 200ms...) để giảm tần suất, cho phép DynamoDB phục hồi. Giảm tải ngay lập tức, tiết kiệm chi phí, không cần thay đổi bảng. (SDK AWS như Boto3 hỗ trợ tự động.) -
❌ Increase the frequency of requests to DynamoDB by decreasing the retry delay.
❌ Sai: Giảm retry delay sẽ tăng tần suất request, làm throttling nặng hơn! Điều này ngược hoàn toàn với nguyên tắc xử lý lỗi DynamoDB (tránh "retry storm"). Sẽ dẫn đến chi phí cao và app fail liên tục. -
✅ Change the capacity mode of the DynamoDB table from provisioned to on-demand.
✅ Đúng: On-demand mode (ra mắt 2018, tối ưu 2026) tự động scale throughput theo nhu cầu thực tế (pay-per-request, không provision trước). Phù hợp workload bursty như app này, loại bỏ hoàn toàn lỗi throttling do provisioned fixed. (Lưu ý: Có thể chuyển đổi seamless qua Console/CLI/API mà không downtime.)
📘 Tài liệu tham khảo (AWS cập nhật mới nhất 2026)
- DynamoDB Developer Guide: ProvisionedThroughputExceededException & On-Demand Capacity.
- Best Practices: Exponential Backoff.
- Exam Topic DOP-C02: DynamoDB capacity management (AWS Certified DevOps Engineer Professional).
- Well-Architected Framework: Reliability Pillar – Handle throttling gracefully.
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é!
What is the MOST secure way to share the documents with the external users?
- A Use S3 presigned URLs to share the documents with the external users. Set an expiration time of 7 days.
- B Move the documents to an Amazon WorkDocs folder. Share the links of the WorkDocs folder with the external users.
- C Create temporary IAM users that have read-only access to the S3 bucket. Share the access keys with the external users. Expire the credentials after 7 days.
- D Create a role that has read-only access to the S3 bucket. Share the Amazon Resource Name (ARN) of this role with the external users.
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 chia sẻ tài liệu tham khảo (reference documents) từ một S3 bucket thuộc sở hữu của công ty với người dùng bên ngoài (external users) trong thời gian ngắn 7 ngày, nhằm tổ chức workshop. Yêu cầu chính là tìm cách MOST secure (an toàn nhất) để thực hiện việc này.
🔍 Chi tiết vấn đề:
- Tài liệu nằm trong Amazon S3 bucket của công ty (không phải public bucket).
- Người dùng bên ngoài không có tài khoản AWS hoặc quyền truy cập vĩnh viễn.
- Thời hạn chia sẻ chính xác 7 ngày, sau đó phải tự động hết hạn để tránh rủi ro bảo mật.
- Ưu tiên bảo mật cao nhất: Tránh chia sẻ credentials (access keys), không thay đổi vị trí lưu trữ tài liệu, và hạn chế quyền truy cập chỉ đọc (read-only) cho các object cụ thể.
🛡️ Nguyên tắc bảo mật AWS (cập nhật đến 2026): AWS khuyến nghị sử dụng least privilege principle (quyền tối thiểu), không chia sẻ long-term credentials, và ưu tiên các cơ chế temporary access như presigned URLs cho S3. Không sử dụng IAM users/access keys cho external users vì vi phạm best practices.
📘 Tài liệu tham khảo:
- AWS S3 Presigned URLs Documentation (cập nhật 2025).
- AWS Security Best Practices.
- IAM Best Practices: Don't Share Credentials.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Use S3 presigned URLs to share the documents with the external users. Set an expiration time of 7 days.
Lý do chi tiết 🛠️:
- S3 Presigned URLs tạo liên kết tạm thời (temporary) cho phép truy cập public read-only vào object cụ thể trong S3 mà không cần chia sẻ credentials AWS (access keys hoặc IAM roles).
- Có thể set expiration time chính xác 7 ngày (tối đa 7 ngày cho presigned URL qua AWS CLI/SDK, hoặc dài hơn qua code tùy chỉnh).
- An toàn nhất vì:
- Chỉ cấp quyền GET object (read-only), không ảnh hưởng toàn bucket.
- Tự động hết hạn, không để lại rủi ro lâu dài.
- Không yêu cầu external users có AWS account.
- Tuân thủ zero-trust model của AWS (cập nhật Re:Post 2025).
- Đây là recommended method cho short-term sharing theo AWS Well-Architected Framework (Security Pillar).
📋 Giải thí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, với ✅ đúng và ❌ sai. Giữ nguyên văn bản gốc tiếng Anh cho phương án, chỉ giải thích bằng tiếng Việt.
-
Use S3 presigned URLs to share the documents with the external users. Set an expiration time of 7 days.
✅ Đúng - An toàn nhất 🛡️: Như giải thích trên, presigned URLs cấp access tạm thời, read-only, hết hạn tự động sau 7 ngày mà không lộ credentials. Hoàn hảo cho external users và short-term sharing. Không cần di chuyển data hay tạo user/role. -
Move the documents to an Amazon WorkDocs folder. Share the links of the WorkDocs folder with the external users.
❌ Sai - Không an toàn và không hiệu quả 🚫:- WorkDocs là dịch vụ quản lý tài liệu riêng (tích hợp Office-like), không liên quan trực tiếp đến S3 bucket hiện tại. Việc "move documents" gây phức tạp, tốn chi phí sync data, và thay đổi architecture không cần thiết.
- Links WorkDocs có thể share public, nhưng không kiểm soát expiration chính xác 7 ngày một cách granular như S3 presigned. WorkDocs phù hợp nội bộ hơn external short-term.
- Vi phạm nguyên tắc "keep data in place" cho S3.
-
Create temporary IAM users that have read-only access to the S3 bucket. Share the access keys with the external users. Expire the credentials after 7 days.
❌ Sai - Rủi ro bảo mật cao ⚠️:- Chia sẻ access keys trực tiếp là vi phạm nghiêm trọng IAM best practices (AWS cấm share credentials với external parties). Keys có thể bị lạm dụng ngay cả khi temporary.
- Temporary IAM users vẫn cần quản lý (tạo/xóa), và external users phải config AWS CLI/SDK – phức tạp và không an toàn.
- Dù expire sau 7 ngày, keys vẫn có quyền toàn bucket (không chỉ object cụ thể), dễ bị attack nếu leak.
-
Create a role that has read-only access to the S3 bucket. Share the Amazon Resource Name (ARN) of this role with the external users.
❌ Sai - Không khả thi cho external users 🔒:- External users không thể assume role chỉ bằng ARN (cần STS credentials, AWS account, hoặc federation như SAML/OIDC). Việc share ARN vô ích vì họ không có cách assume role an toàn.
- Role dành cho trusted entities (EC2, Lambda), không phải external humans. Tạo cross-account role phức tạp hơn presigned URLs.
- Không hỗ trợ expiration tự động 7 ngày cho access; vẫn rủi ro privilege escalation nếu misconfigure trust policy.
🏆 Kết luận
Sử dụng S3 Presigned URLs là giải pháp MOST secure, simple và scalable theo tiêu chuẩn AWS DevOps Professional (DOP-C02 exam blueprint 2025). Nếu triển khai, dùng AWS CLI: aws s3 presign s3://bucket/key --expires-in 604800 (7 ngày = 604800 giây). Khuyến nghị test với bucket policy deny public access! 🚀
How should the application be deployed while minimizing the number of resources to manage?
- A Create a separate API Gateway and separate Lambda function for each environment in the same Region.
- B Assign a Region for each environment and deploy API Gateway and Lambda to each Region.
- C Create one API Gateway with multiple stages with one Lambda function with multiple aliases.
- D Create one API Gateway and one Lambda function, and use a REST parameter to identify the environment.
Xem giải thích
🧩 Giải thích nội dung câu hỏi
Câu hỏi tập trung vào việc triển khai một REST API sử dụng Amazon API Gateway kết hợp AWS Lambda, với ba môi trường riêng biệt: development (dev), test và production (prod). Mục tiêu chính là tối ưu hóa việc triển khai để giảm thiểu số lượng tài nguyên (resources) cần quản lý, chẳng hạn như số lượng API Gateway, Lambda functions, hoặc các cấu hình liên quan. Điều này nhấn mạnh vào các best practices của AWS DevOps để quản lý môi trường một cách hiệu quả, tránh lãng phí chi phí và phức tạp hóa vận hành. Theo kiến thức AWS cập nhật đến năm 2026 (bao gồm API Gateway v2 và Lambda với hỗ trợ aliases/versions nâng cao), cách tiếp cận lý tưởng phải tận dụng các tính năng native như stages trong API Gateway và aliases trong Lambda để phân tách môi trường mà không nhân bản tài nguyên.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Create one API Gateway with multiple stages with one Lambda function with multiple aliases.
🛠️ Lý do chi tiết:
- Sử dụng một API Gateway duy nhất với nhiều stages (ví dụ:
dev,test,prod) cho phép route traffic đến các endpoint khác nhau dựa trên stage (nhưhttps://api.example.com/dev/...), mà không cần tạo nhiều Gateway riêng lẻ. - Kết hợp với một Lambda function duy nhất sử dụng nhiều aliases (ví dụ:
$LATESTcho dev, aliastestvàprod), giúp deploy code/version khác nhau cho từng môi trường mà chỉ quản lý một function ARN gốc. - Lợi ích minimize resources: Chỉ cần 1 API Gateway + 1 Lambda function, giảm chi phí (Gateway tính phí theo request, Lambda theo invocation), dễ quản lý CI/CD (sử dụng AWS SAM hoặc CDK), và hỗ trợ canary deployments/blue-green qua aliases. Đây là best practice theo AWS Well-Architected Framework (Operational Excellence pillar, cập nhật 2024-2026).
📋 Phân tích tất cả các phương án
Dưới đây là phân tích chi tiết từng lựa chọn, với nội dung gốc giữ nguyên tiếng Anh. Tôi đánh dấu ✅ cho đúng và ❌ cho sai, kèm giải thích rõ ràng:
-
❌ Create a separate API Gateway and separate Lambda function for each environment in the same Region.
Phương án này sai vì tạo 3 API Gateway + 3 Lambda functions riêng biệt (tổng 6 resources) trong cùng Region, dẫn đến tăng gấp 3 lần số lượng tài nguyên cần quản lý, chi phí cao hơn (Gateway phí theo request, Lambda phí lưu trữ), và phức tạp hóa IAM roles, monitoring (CloudWatch), logging. Không tận dụng stages/aliases, vi phạm nguyên tắc minimize resources. -
❌ Assign a Region for each environment and deploy API Gateway and Lambda to each Region.
Phương án này sai và tệ nhất vì phân bổ Region khác nhau cho từng môi trường (ví dụ: us-east-1 cho dev, us-west-2 cho test,...), tạo 6 resources đa Region. Điều này tăng latency cross-Region, chi phí transfer data, phức tạp networking (VPC peering nếu cần), và khó quản lý global (không hỗ trợ Route 53 multi-Region hiệu quả cho API). AWS khuyến cáo single-Region cho cùng app trừ khi cần high availability toàn cầu. -
✅ Create one API Gateway with multiple stages with one Lambda function with multiple aliases.
Như đã giải thích ở phần đáp án đúng: Hoàn hảo vì chỉ 1 Gateway + 1 Lambda, sử dụng stages để phân môi trường trên Gateway và aliases để version/control traffic trên Lambda. Hỗ trợ promotion code giữa môi trường (dev → test → prod) qua alias publishing, tích hợp AWS X-Ray cho tracing multi-stage. -
❌ Create one API Gateway and one Lambda function, and use a REST parameter to identify the environment.
Phương án này sai vì dù chỉ dùng 1 Gateway + 1 Lambda, việc dùng REST parameter (ví dụ:/api/{env}/...) yêu cầu code logic bên trong Lambda phân nhánh theo param (if-else cho env), dẫn đến single point of failure, khó isolate (một bug dev ảnh hưởng prod), không hỗ trợ independent deployments/rollbacks, và vi phạm separation of concerns. Không phải best practice so với stages/aliases native.
📘 Tài liệu tham khảo
- AWS API Gateway Stages: Deploying multiple environments with API Gateway stages (cập nhật 2025, hỗ trợ HTTP/REST APIs v2).
- AWS Lambda Aliases/Versions: Using Lambda aliases for environment management (cập nhật 2026, tích hợp với Lambda SnapStart và Provisioned Concurrency).
- AWS Well-Architected Framework: Operational Excellence - Environment management (phiên bản 2024, khuyến cáo stages + aliases).
- AWS SAM/CDK Examples: Multi-stage API Gateway + Lambda aliases template.
Hy vọng phân tích này giúp bạn nắm vững best practices AWS DevOps! 🚀 Nếu cần ví dụ code SAM/CDK, hãy hỏi thêm.
Why is the Lambda function not being invoked?
- A A Lambda function cannot be registered as a target for an ALB.
- B A Lambda function can be registered with an ALB using AWS Management Console only.
- C The permissions to invoke the Lambda function are missing.
- D Cross-zone is not enabled on the ALB.
Xem giải thích
🧩 Phân tích nội dung câu hỏi
Câu hỏi mô tả tình huống: Một lập trình viên đã đăng ký một hàm AWS Lambda làm target group cho Application Load Balancer (ALB) bằng lệnh CLI (AWS Command Line Interface). Tuy nhiên, khi client gửi request qua ALB, hàm Lambda không được kích hoạt (invoke).
📌 Vấn đề cốt lõi: ALB có hỗ trợ tích hợp với Lambda từ năm 2017 (và vẫn duy trì đến phiên bản AWS 2026), nhưng việc invoke thất bại thường do thiếu quyền truy cập (permissions). Câu hỏi yêu cầu xác định lý do chính xác khiến Lambda không hoạt động.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: The permissions to invoke the Lambda function are missing.
🛠️ Lý do: Khi đăng ký Lambda làm target cho ALB, AWS yêu cầu chính sách quyền (IAM permission policy) cụ thể trên hàm Lambda. ALB sử dụng service principal elasticloadbalancing.amazonaws.com để invoke Lambda qua action lambda:InvokeFunction. Nếu thiếu policy này (ví dụ: resource-based policy trên Lambda), ALB sẽ không thể gọi hàm dù đã đăng ký thành công qua CLI. Đây là lỗi phổ biến nhất trong tích hợp ALB-Lambda, theo best practices AWS DevOps.
📋 Giải thích chi tiết từng phương án
Dưới đây là phân tích tất cả các lựa chọn, giữ nguyên văn bản gốc bằng tiếng Anh. Mỗi phương án được đánh giá đúng/sai với lý do cụ thể dựa trên tài liệu AWS mới nhất (2026):
-
❌ A Lambda function cannot be registered as a target for an ALB.
Sai: Lambda có thể được đăng ký làm target cho ALB (target group loại IP hoặc Lambda). Tính năng này được hỗ trợ đầy đủ qua CLI (aws elbv2 register-targets), Console, SDK từ năm 2017 và không thay đổi đến 2026. Ví dụ lệnh CLI:aws elbv2 register-targets --target-group-arn <arn> --targets Id=<lambda-arn>. -
❌ A Lambda function can be registered with an ALB using AWS Management Console only.
Sai: Đăng ký Lambda với ALB không giới hạn ở Console. Có thể dùng CLI, SDK, CloudFormation, Terraform,... AWS CLI hỗ trợ lệnhregister-targetsvới target typelambda. Đây là tính năng đa kênh, không bị hạn chế. -
✅ The permissions to invoke the Lambda function are missing.
Đúng: Như đã giải thích ở trên. Phải thêm IAM policy vào Lambda function:{ "Sid": "AllowALBInvoke", "Effect": "Allow", "Principal": {"Service": "elasticloadbalancing.amazonaws.com"}, "Action": "lambda:InvokeFunction", "Resource": "<lambda-arn>" }Thiếu policy này dẫn đến lỗi invoke dù đăng ký thành công (kiểm tra CloudWatch Logs ALB/Lambda để xác nhận).
-
❌ Cross-zone is not enabled on the ALB.
Sai: Cross-zone load balancing chỉ ảnh hưởng đến phân phối traffic giữa các AZ (Availability Zones) trên các target EC2/ECS/IP, không liên quan đến target Lambda (Lambda là serverless, không có zone-specific). Tính năng mặc định bật từ 2020 và không gây lỗi invoke.
📘 Tài liệu tham khảo (AWS cập nhật 2026)
- AWS Docs: Integrate Lambda with ALB – Hướng dẫn permissions và register targets.
- Lambda Permissions Model – Chi tiết resource-based policy cho ALB.
- ALB Target Groups – Xác nhận hỗ trợ CLI và Lambda type.
- Best Practices: AWS Well-Architected Framework – Reliability Pillar (DevOps Professional exam blueprint).
🧠 Lời khuyên DevOps: Luôn kiểm tra CloudWatch Logs (ALB access logs + Lambda logs) và IAM policies đầu tiên khi debug tích hợp serverless!