Ngân hàng đề — AWS Certified DevOps Engineer Professional

Tìm thấy 681 câu.

Câu 571
A company uses an AWS Cloud Development Kit (AWS CDK) application for its infrastructure. The AWS CDK application creates AWS Lambda functions and the IAM roles that are attached to the functions. The company also uses AWS Organizations. The company's developers can assume the AWS CDK application deployment role.

The company's security team discovered that the developers and the role used to deploy the AWS CDK application have more permissions than necessary. The security team also discovered that the roles attached to the Lambda functions that the CDK application creates have more permissions than necessary. The developers must not have the ability to grant additional permissions.

Which solution will meet these requirements with the LEAST operational overhead?
  1. A Create an SCP that denies the iam:CreateRole action and the iam:UpdateRole action for the developer role and the AWS CDK application deployment role. Centrally create new IAM roles to attach to the Lambda functions for the developers to use to provision Lambda functions.
  2. B Create an IAM permission boundary policy. Define the maximum actions that the AWS CDK application requires in the policy. Update the account's AWS CDK bootstrapping to use the permission boundary. Update the configuration in the AWS CDK application for the default permissions boundary to use the policy.
  3. C Create an IAM permission boundary policy. Define the maximum actions that the AWS CDK application requires in the policy. Instruct the developers to use the permission boundary policy name when they create a role in the AWS CDK application code.
  4. D Create an SCP that denies the iam:CreateRole action and the iam:UpdateRole action for the developer role. Give the AWS CDK deployment role access to create roles associated with Lambda functions. Run AWS Identity and Access Management Access Analyzer to verify that the Lambda functions role does not have permissions.
Xem giải thích

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

Câu hỏi xoay quanh việc tối ưu hóa bảo mật IAM trong môi trường AWS CDK kết hợp AWS Organizations.

✅ Tình huống cụ thể:

  • Công ty sử dụng AWS CDK để triển khai infrastructure, bao gồm tạo AWS Lambda functions và IAM roles gắn với chúng.
  • Developers có thể assume CDK deployment role để deploy.
  • Vấn đề bảo mật (do security team phát hiện):
    • Developers và CDK deployment role có permissions thừa (over-privileged).
    • IAM roles gắn Lambda cũng over-privileged.
    • Developers KHÔNG được phép grant thêm permissions (tức là không thể tự tăng quyền).
  • Yêu cầu: Giải pháp meet requirements với LEAST operational overhead (ít công vận hành nhất, tự động hóa cao).

🛠️ Mục tiêu chính: Giới hạn maximum permissions mà CDK có thể grant cho roles nó tạo, mà không cần can thiệp thủ công nhiều. Sử dụng kiến thức AWS mới nhất (2024-2026): IAM Permission Boundaries là tính năng lý tưởng cho CDK, hỗ trợ bootstrap tự động và default boundary cho constructs như Lambda.

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

✅ Đáp án đúng: Phương án thứ 2

Create an IAM permission boundary policy. Define the maximum actions that the AWS CDK application requires in the policy. Update the account's AWS CDK bootstrapping to use the permission boundary. Update the configuration in the AWS CDK application for the default permissions boundary to use the policy.

Lý do lựa chọn:

  • 🛡️ Permission Boundary giới hạn tối đa permissions mà role có thể có (enforceable policy), ngay cả khi attached policy rộng hơn – chính xác giải quyết "developers không grant thêm permissions".
  • 🎯 Tích hợp CDK hoàn hảo:
    • cdk bootstrap --permissions-boundary arn:... apply boundary cho CDK execution roles (deploy role).
    • Set defaultPermissionsBoundary trong CDK app config (qua cdk.json hoặc code) → Tự động apply boundary cho TẤT CẢ roles CDK tạo (như Lambda roles).
  • ⚡ Least operational overhead: Một lần config bootstrap + app config → Áp dụng toàn bộ, không cần devs chỉnh code từng role, không central management thủ công.
  • 🔒 Hoạt động ở account level (Organizations), an toàn với multi-account.

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

  • ❌ Phương án 1 (SAI):
    Create an SCP that denies the iam:CreateRole action and the iam:UpdateRole action for the developer role and the AWS CDK application deployment role. Centrally create new IAM roles to attach to the Lambda functions for the developers to use to provision Lambda functions.
    Giải thích sai: SCP (Service Control Policy) chỉ deny actions ở Organizations level, không giới hạn permissions trong role đã tạo (vẫn over-privileged). Phải centrally create roles → devs phải dùng pre-made roles → operational overhead cao (quản lý central, devs phụ thuộc). Không tự động cho CDK.

  • ✅ Phương án 2 (ĐÚNG): (Đã giải thích ở trên – lý tưởng nhất).

  • ❌ Phương án 3 (SAI):
    Create an IAM permission boundary policy. Define the maximum actions that the AWS CDK application requires in the policy. Instruct the developers to use the permission boundary policy name when they create a role in the AWS CDK application code.
    Giải thích sai: Permission boundary đúng hướng, nhưng yêu cầu instruct devs manually add vào code CDK (qua role.addToPolicy hoặc construct props) → Không tự động, devs dễ quên/lỗi → operational overhead cao (review code liên tục). Không dùng bootstrap/default → Không scale.

  • ❌ Phương án 4 (SAI):
    Create an SCP that denies the iam:CreateRole action and the iam:UpdateRole action for the developer role. Give the AWS CDK deployment role access to create roles associated with Lambda functions. Run AWS Identity and Access Management Access Analyzer to verify that the Lambda functions role does not have permissions.
    Giải thích sai: SCP chỉ deny Create/Update cho dev role, nhưng CDK role vẫn tạo roles over-privileged. Access Analyzer chỉ verify/audit (policy analysis), KHÔNG prevent runtime → Không meet "developers must not grant additional". Overhead: Config SCP + run Analyzer định kỳ → Không tự động/preventive.

🏆 Tóm tắt: Phương án 2 là best practice AWS cho CDK + Organizations, đảm bảo zero-trust permissions với overhead thấp nhất! 🚀

Câu 572
A company uses Amazon Elastic Container Registry (Amazon ECR) private registries to store container images.

A DevOps team needs to ensure that the container images are regularly scanned for software package vulnerabilities.

Which solution will meet this requirement?
  1. A Enable enhanced scanning for private registries in Amazon ECR.
  2. B Enable basic continuous scanning for private registries in Amazon ECR.
  3. C Create an AWS System Manager Automation document to scan images by using the AWS SDK. Configure the Automation document to run when a new image is pushed to an ECR registry.
  4. D Create an AWS Lambda function that scans all images in Amazon ECR by using the AWS SDK. Create an Amazon EventBridge rule to invoke the Lambda function each day.
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 bảo mật container images trong Amazon Elastic Container Registry (Amazon ECR) private registries. 🛡️️ Một công ty đang sử dụng ECR để lưu trữ các image container, và đội DevOps cần quét (scan) định kỳ các image này để phát hiện lỗ hổng bảo mật (vulnerabilities) trong các gói phần mềm (software packages).

Yêu cầu chính là tìm giải pháp tự động, đáng tin cậy và tích hợp sẵn của AWS để đảm bảo quét thường xuyên (regularly), không chỉ một lần mà có thể liên tục cập nhật khi có lỗ hổng mới. Đây là chủ đề phổ biến trong kỳ thi AWS Certified DevOps Engineer - Professional (DOP-C02), nhấn mạnh vào best practices cho container security và CI/CD pipelines. 📈

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

Đáp án đúng: Enable enhanced scanning for private registries in Amazon ECR.

Lý do:
Enhanced scanning là tính năng tích hợp sẵn, mạnh mẽ nhất của Amazon ECR cho private registries, hỗ trợ quét liên tục (continuous scanning) và quét định kỳ các image để phát hiện vulnerabilities trong software packages (như OS packages, libraries). Nó sử dụng các công cụ Clair và Trivy để phân tích sâu, cập nhật vulnerability database hàng ngày, và tự động re-scan khi có lỗ hổng mới mà không cần code custom. Giải pháp này miễn phí cho basic use, dễ enable qua console/CLI/API, và phù hợp hoàn hảo với yêu cầu "regularly scanned". Đây là recommended solution theo AWS best practices đến năm 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, giữ nguyên nội dung gốc bằng tiếng Anh. Mỗi phương án được đánh dấu ✅ (đúng) hoặc ❌ (sai), kèm giải thích bằng tiếng Việt:

  • Enable enhanced scanning for private registries in Amazon ECR.
    ✅ Đúng: Như đã giải thích ở trên, đây là giải pháp tích hợp, tự động và continuous, quét định kỳ vulnerabilities trong software packages với độ chính xác cao. Không cần thêm tài nguyên, chỉ cần enable một lần. 🛡️️

  • Enable basic continuous scanning for private registries in Amazon ECR.
    ❌ Sai: Basic scanning không phải continuous và chỉ quét một lần khi push image (on-push scanning), không hỗ trợ re-scan định kỳ cho vulnerabilities mới. Nó cũng hạn chế coverage (chỉ common vulnerabilities), không đáp ứng "regularly scanned". Enhanced mới là lựa chọn đúng cho continuous/full scanning. 📉

  • Create an AWS System Manager Automation document to scan images by using the AWS SDK. Configure the Automation document to run when a new image is pushed to an ECR registry.
    ❌ Sai: Giải pháp custom này phức tạp, không hiệu quả và chỉ quét khi push mới (on-push), không đảm bảo "regularly" (định kỳ cho tất cả images cũ). SSM Automation dùng AWS SDK (như DescribeImageScanFindings) chỉ lấy kết quả scan có sẵn từ ECR, không tự scan vulnerabilities. Tốn kém, khó maintain, vi phạm best practices. 🛠️❌

  • Create an AWS Lambda function that scans all images in Amazon ECR by using the AWS SDK. Create an Amazon EventBridge rule to invoke the Lambda function each day.
    ❌ Sai: Lambda + EventBridge chỉ lập lịch hàng ngày nhưng không thực sự scan (SDK chỉ query findings từ ECR scan engine). Không quét sâu software packages, chi phí cao (Lambda invocations, permissions phức tạp), và không continuous như enhanced scanning. Custom solution kém hơn native feature. ⏰❌

📘 Tài liệu tham khảo

  • AWS Documentation (cập nhật 2024-2026): Amazon ECR Enhanced Scanning – Chi tiết về continuous re-scanning và vulnerability coverage.
  • AWS Best Practices: Container Image Scanning – So sánh basic vs enhanced.
  • Exam Guide DOP-C02: Domain 5: Security and Compliance (Security in CI/CD).
  • AWS re:Post & Blogs: Tìm "ECR enhanced scanning vulnerabilities" cho case studies thực tế. 🌐

Giải pháp này giúp DevOps team tối ưu hóa security pipeline một cách đơn giản nhất! 💪

Câu 573 Chọn nhiều đáp án
A security team sets up a workflow that invokes an AWS Step Functions workflow when Amazon EventBridge matches specific events. The events can be generated by several AWS services. AWS CloudTrail records user activities.

The security team notices that some important events do not invoke the workflow as expected. The CloudTrail logs do not indicate any direct errors related to the missing events.

Which combination of steps will identify the root cause of the missing event invocations? (Choose three.)
  1. A Enable EventBridge schema discovery on the event bus to determine whether the event patterns match the expected schema.
  2. B Configure Amazon CloudWatch to monitor EventBridge metrics and Step Functions metrics. Set up alerts for anomalies in event patterns and workflow invocations.
  3. C Configure an AWS Lambda logging function to monitor and log events from EventBridge to provide more details about the processed events.
  4. D Review the Step Functions execution history for patterns of failures or timeouts that could correlate to the missing event invocations.
  5. E Review metrics for the EventBridge failed invocations to ensure that the IAM execution role that is attached to the rule has sufficient permissions.
  6. F Verify that the Step Functions workflow has the correct permissions to be invoked by EventBridge.
Xem giải thích

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

Câu hỏi này thuộc chủ đề Amazon EventBridge và AWS Step Functions trong AWS, liên quan đến việc debug và troubleshooting các sự cố về event invocation trong workflow bảo mật.

  • Bối cảnh: Một team bảo mật thiết lập workflow sử dụng AWS Step Functions được kích hoạt bởi Amazon EventBridge khi phát hiện các event cụ thể từ nhiều AWS services (như CloudTrail ghi log hoạt động user). Tuy nhiên, một số event quan trọng không kích hoạt workflow như mong đợi, và CloudTrail logs không ghi nhận lỗi trực tiếp liên quan đến các event bị thiếu.
  • Vấn đề cốt lõi: Cần xác định nguyên nhân gốc rễ (root cause) của việc missing event invocations (các event bị bỏ lỡ không invoke workflow). Đây là tình huống phổ biến khi event pattern không match, permissions thiếu, hoặc metrics chỉ ra failed invocations.
  • Yêu cầu: Chọn 3 steps kết hợp để identify vấn đề, tập trung vào monitoring, metrics và validation schema/permissions (dựa trên best practices AWS mới nhất đến 2026, với EventBridge hỗ trợ schema discovery nâng cao và CloudWatch metrics chi tiết hơn).

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

✅ Đáp án đúng (Chọn 3 phương án sau)

Các đáp án đúng là sự kết hợp hoàn hảo để xác định root cause một cách toàn diện: kiểm tra schema match, monitor metrics anomalies, và review failed invocations với permissions. Lý do chọn:

  • Chúng trực tiếp nhắm vào các metrics và validation của EventBridge (nơi vấn đề invoke xảy ra đầu tiên), trước khi đến Step Functions.
  • CloudTrail không có lỗi → vấn đề nằm ở event matching hoặc rule execution, không phải user activity.
  • Theo best practices AWS 2026, EventBridge FailedInvocations và CloudWatch metrics là bước đầu tiên để debug missing events.

🛠️ Giải thích chi tiết từng phương án

  • ✅ Enable EventBridge schema discovery on the event bus to determine whether the event patterns match the expected schema.
    Đúng: Phương án này trực tiếp kiểm tra schema discovery (tính năng EventBridge từ 2021, cập nhật 2026 với auto-discovery nâng cao). Nếu event từ AWS services không match event pattern hoặc schema (ví dụ: field thiếu hoặc format sai), workflow sẽ không invoke. Schema discovery giúp generate và validate pattern chính xác, xác định root cause missing events mà không phụ thuộc logs. Đây là bước quan trọng đầu tiên cho event validation.

  • ✅ Configure Amazon CloudWatch to monitor EventBridge metrics and Step Functions metrics. Set up alerts for anomalies in event patterns and workflow invocations.
    Đúng: CloudWatch metrics là công cụ cốt lõi để monitor Invocations, FailedInvocations, MatchedEvents của EventBridge và ExecutionsStarted/Failed của Step Functions (cập nhật metrics mới như MatchedEventsDropped đến 2026). Thiết lập alerts phát hiện anomalies (như spike failed hoặc drop invocations) giúp correlate missing events với pattern issues, ngay cả khi CloudTrail không báo lỗi.

  • ❌ Configure an AWS Lambda logging function to monitor and log events from EventBridge to provide more details about the processed events.
    Sai: Không hiệu quả và không phải best practice. EventBridge không hỗ trợ Lambda logging function trực tiếp để monitor events (có thể dùng target Lambda làm rule target, nhưng phức tạp và tốn kém). Thay vào đó, dùng CloudWatch Logs Insights hoặc EventBridge insights native (từ 2023). Phương án này không identify root cause mà chỉ log thêm, dễ miss issues permissions/schema.

  • ❌ Review the Step Functions execution history for patterns of failures or timeouts that could correlate to the missing event invocations.
    Sai: Step Functions execution history chỉ ghi executions đã bắt đầu, không hiển thị missing invocations từ EventBridge (nếu event không match rule, sẽ không có history). Vấn đề ở EventBridge layer, nên review history không giúp root cause; chỉ hữu ích sau khi confirm invocations đã xảy ra.

  • ✅ Review metrics for the EventBridge failed invocations to ensure that the IAM execution role that is attached to the rule has sufficient permissions.
    Đúng: EventBridge metric FailedInvocations (per rule) trực tiếp chỉ ra failed do permissions của IAM execution role gắn với rule (cần states:StartExecution cho Step Functions). Nếu role thiếu perms (ví dụ: không cross-account), events match nhưng fail invoke → CloudTrail không log lỗi direct. Metrics này (cập nhật granular hơn 2026) là bước then chốt để check IAM issues.

  • ❌ Verify that the Step Functions workflow has the correct permissions to be invoked by EventBridge.
    Sai: Step Functions không cần permissions riêng để được invoke; permissions nằm ở IAM role của EventBridge rule (principal invoke). Verify workflow perms chỉ redundant và không address missing events từ EventBridge matching/failed invocations.

📈 Kết luận & Best Practices

Kết hợp 3 ✅ giúp layer-by-layer debugging: schema → metrics general → failed specifics. Implement CloudWatch dashboards và EventBridge Partner Event Source nếu events từ third-party (2026 updates). Test bằng EventBridge Schema Registry để tránh tương lai! 🚀

Câu 574
A company's DevOps engineer uses AWS Systems Manager to perform maintenance tasks. The company has a few Amazon EC2 instances that require a restart after notifications from AWS Health.

The DevOps engineer must implement an automated solution that uses Amazon EventBridge to remediate the notifications during the company's scheduled maintenance windows.

How should the DevOps engineer configure an EventBridge rule to meet these requirements?
  1. A Configure an event source of AWS Health. Configure event types that indicate scheduled instance termination and retirement. Target the AWS-RestartEC2Instance Systems Manager Automation runbook to restart the EC2 instances.
  2. B Configure an event source of Systems Manager. Configure an event type that indicates a maintenance window. Target the AWS-RestartEC2Instance Systems Manager Automation runbook to restart the EC2 instances.
  3. C Configure an event source of AWS Health. Configure event types that indicate scheduled instance termination and retirement. Target a newly created AWS Lambda function that registers a Systems Manager maintenance window task to restart the EC2 instances.
  4. D Configure an event source of EC2. Configure an event type that indicates instance state notification. Target a newly created AWS Lambda function that registers a Systems Manager maintenance window task to restart the EC2 instances.
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âu hỏi tập trung vào việc triển khai giải pháp tự động hóa trên AWS để xử lý thông báo từ AWS Health liên quan đến việc cần restart các instance Amazon EC2. Công ty sử dụng AWS Systems Manager (SSM) để thực hiện các nhiệm vụ bảo trì. DevOps engineer cần cấu hình Amazon EventBridge rule để tự động khắc phục (remediate) các thông báo này trong khoảng thời gian bảo trì theo lịch (scheduled maintenance windows) của công ty.

🛠️ Yêu cầu chính:

  • Sử dụng EventBridge làm trung tâm để bắt sự kiện (events) từ AWS Health.
  • Tự động restart EC2 instances khi có thông báo về scheduled instance termination hoặc retirement (hết hạn sử dụng).
  • Đảm bảo hành động diễn ra trong maintenance windows của SSM, tránh gián đoạn dịch vụ ngoài giờ bảo trì.
    Giải pháp phải đơn giản, tự động và tận dụng các dịch vụ AWS managed để giảm thiểu code tùy chỉnh.

✅ Đáp án đúng:
Configure an event source of AWS Health. Configure event types that indicate scheduled instance termination and retirement. Target the AWS-RestartEC2Instance Systems Manager Automation runbook to restart the EC2 instances.

🔍 Lý do chọn đáp án đúng (bằng kiến thức AWS mới nhất 2026):

  • Event source AWS Health là nguồn sự kiện chính xác vì AWS Health gửi notifications về scheduled retirement/termination qua EventBridge (detail-type: "AWS Health Event").
  • Event types cụ thể cho "scheduled instance termination and retirement" khớp với các event từ AWS Health (ví dụ: AWS-RDS hoặc EC2 retirement events).
  • Target là AWS-RestartEC2Instance SSM Automation runbook là giải pháp tối ưu: Đây là document Automation managed của AWS (cập nhật mới nhất SSM 2026), tự động restart EC2 instances an toàn, và tích hợp trực tiếp với maintenance windows của SSM (Automation runbook chỉ chạy trong window nếu được cấu hình). Không cần Lambda tùy chỉnh, giảm chi phí và độ phức tạp.
    Giải pháp này đảm bảo tuân thủ nguyên tắc least privilege và automation-first trong DevOps Professional.

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

  • ✅ Phương án ĐÚNG:
    Configure an event source of AWS Health. Configure event types that indicate scheduled instance termination and retirement. Target the AWS-RestartEC2Instance Systems Manager Automation runbook to restart the EC2 instances.
    🟢 Giải thích: Như đã phân tích ở trên, phương án này chính xác 100% vì tận dụng nguồn sự kiện AWS Health chuẩn, event types phù hợp, và SSM Automation runbook AWS-RestartEC2Instance (phiên bản mới nhất hỗ trợ restart multi-instance trong maintenance window). Đây là best practice từ AWS Well-Architected Framework (Pillar: Operational Excellence).

  • ❌ Phương án SAI 1:
    Configure an event source of Systems Manager. Configure an event type that indicates a maintenance window. Target the AWS-RestartEC2Instance Systems Manager Automation runbook to restart the EC2 instances.
    🔴 Giải thích: Sai nguồn sự kiện – SSM không gửi event về AWS Health notifications (như retirement/termination). Event từ SSM chỉ liên quan đến maintenance window executions hoặc associations, không trigger từ Health. Sử dụng sai source sẽ không bắt được thông báo gốc, dẫn đến không tự động hóa đúng yêu cầu.

  • ❌ Phương án SAI 2:
    Configure an event source of AWS Health. Configure event types that indicate scheduled instance termination and retirement. Target a newly created AWS Lambda function that registers a Systems Manager maintenance window task to restart the EC2 instances.
    🔴 Giải thích: Nguồn và event types đúng, nhưng target sai – Tạo Lambda mới để "register maintenance window task" là thừa thãi và phức tạp. SSM Automation runbook (như AWS-RestartEC2Instance) đã hỗ trợ trực tiếp EventBridge target + maintenance window (không cần register task thủ công). Lambda tăng chi phí, độ trễ và cần code IAM permissions phức tạp, vi phạm nguyên tắc "use managed services first".

  • ❌ Phương án SAI 3:
    Configure an event source of EC2. Configure an event type that indicates instance state notification. Target a newly created AWS Lambda function that registers a Systems Manager maintenance window task to restart the EC2 instances.
    🔴 Giải thích: Hoàn toàn sai nguồn sự kiện – EC2 events chỉ về state changes (stop/start/terminate), không phải notifications từ AWS Health về scheduled retirement. Event type "instance state notification" không khớp với yêu cầu Health. Thêm Lambda register task càng làm giải pháp kém hiệu quả, không tự động hóa trực tiếp.

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

🛡️ Kết luận: Giải pháp đúng giúp tự động hóa end-to-end, giảm MTTR (Mean Time To Recovery) và tuân thủ SLA maintenance windows! Nếu cần lab thực hành, dùng AWS Console EventBridge + SSM.

Câu 575
A DevOps engineer manages an AWS CodePipeline pipeline that builds and deploys a web application on AWS. The pipeline has a source stage, a build stage, and a deploy stage. When deployed properly, the web application responds with a 200 OK HTTP response code when the URL of the home page is requested.

The home page recently returned a 503 HTTP response code after CodePipeline deployed the application. The DevOps engineer needs to add an automated test into the pipeline. The automated test must ensure that the application returns a 200 OK HTTP response code after the application is deployed. The pipeline must fail if the response code is not present during the test. The DevOps engineer has added a CheckURL stage after the deploy stage in the pipeline.

What should the DevOps engineer do next to implement the automated test?
  1. A Configure the CheckURL stage to use an Amazon CloudWatch action. Configure the action to use a canary synthetic monitoring check on the application URL and to report a success or failure to CodePipeline.
  2. B Create an AWS Lambda function to check the response code status of the URL and to report a success or failure to CodePipeline. Configure an action in the CheckURL stage to invoke the Lambda function.
  3. C Configure the CheckURL stage to use an AWS CodeDeploy action. Configure the action with an input artifact that is the URL of the application and to report a success or failure to CodePipeline.
  4. D Deploy an Amazon API Gateway HTTP API that checks the response code status of the URL and that reports success or failure to CodePipeline. Configure the CheckURL stage to use the AWS Device Farm test action and to provide the API Gateway HTTP API as an input artifact.
Xem giải thích

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

Câu hỏi mô tả một DevOps engineer đang quản lý pipeline AWS CodePipeline để build và deploy ứng dụng web trên AWS. Pipeline gồm 3 stage chính: source (lấy code), build (build ứng dụng), và deploy (triển khai). Bình thường, sau deploy, trang home sẽ trả về HTTP 200 OK khi request URL. Tuy nhiên, gần đây sau một lần deploy, trang home trả 503 Service Unavailable – dấu hiệu ứng dụng chưa sẵn sàng hoặc lỗi.

📌 Yêu cầu chính: Thêm automated test vào stage CheckURL (đặt sau deploy stage) để:

  • Kiểm tra ứng dụng có trả 200 OK không.
  • Pipeline fail nếu không đạt (để tránh release version lỗi).

Mục tiêu là implement test tự động, đơn giản, tích hợp trực tiếp vào CodePipeline. Đây là best practice trong DevOps để đảm bảo post-deployment validation (kiểm tra sau triển khai), giúp pipeline self-healing và giảm downtime. Kiến thức dựa trên AWS CodePipeline phiên bản mới nhất (2026), hỗ trợ các action linh hoạt như Invoke Lambda cho custom logic.

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

Đáp án đúng:
Create an AWS Lambda function to check the response code status of the URL and to report a success or failure to CodePipeline. Configure an action in the CheckURL stage to invoke the Lambda function.

🛠️ Lý do chi tiết:

  • Lambda là serverless, scale tự động, lý tưởng cho custom test script (ví dụ: dùng Python requests library gửi HTTP GET đến URL home page, check status_code == 200).
  • Trong Lambda, dùng AWS SDK (boto3) gọi CodePipeline.PUT_JOB_SUCCESS_RESULT() nếu OK, hoặc PUT_JOB_FAILURE_RESULT() nếu fail → pipeline tự động pass/fail stage.
  • CodePipeline hỗ trợ Invoke action cho Lambda trực tiếp trong stage (configuration: Lambda ARN, role với quyền codepipeline:PutJob*).
  • Ưu điểm: Nhanh (chạy <10s), rẻ (pay-per-use), không cần infra quản lý. Phù hợp post-deploy smoke test – kiểm tra cơ bản nhất.
  • Đây là best practice theo AWS Well-Architected Framework (Operations Pillar) cho CI/CD validation.

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

📋 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. Tôi giữ nguyên nội dung văn bản gốc bằng tiếng Anh, chỉ giải thích bằng tiếng Việt với lý do đúng/sai. Sử dụng ✅/❌ để nổi bật.

  • ❌ [SAI] Configure the CheckURL stage to use an Amazon CloudWatch action. Configure the action to use a canary synthetic monitoring check on the application URL and to report a success or failure to CodePipeline.
    🛠️ Giải thích sai: CodePipeline không hỗ trợ "CloudWatch action" trực tiếp cho Synthetics Canary. CloudWatch Synthetics dùng để monitor ongoing (chạy định kỳ), không phải one-time test trong pipeline stage. Canary không integrate tự động report success/failure vào CodePipeline job (cần custom Lambda/Step Functions bridge). Sai vì không khớp action type và thiếu tích hợp native (dù Synthetics tốt cho prod monitoring, không phải CI/CD gate).

  • ✅ [ĐÚNG] Create an AWS Lambda function to check the response code status of the URL and to report a success or failure to CodePipeline. Configure an action in the CheckURL stage to invoke the Lambda function.
    🛠️ Giải thích đúng (như phần trên): Hoàn hảo cho custom HTTP check, report trực tiếp qua CodePipeline API. Đơn giản, scalable, zero-config infra. ✅ Best fit!

  • ❌ [SAI] Configure the CheckURL stage to use an AWS CodeDeploy action. Configure the action with an input artifact that is the URL of the application and to report a success or failure to CodePipeline.
    🛠️ Giải thích sai: CodeDeploy dùng cho deployment (deploy app đến EC2/ ECS/ Lambda), không phải test URL response. Không có input artifact kiểu "URL string" – chỉ chấp nhận ZIP/bundle artifacts. CodeDeploy có deployment hooks (AppSpec AfterBlock), nhưng không thay thế test stage riêng. Sai hoàn toàn về purpose và config.

  • ❌ [SAI] Deploy an Amazon API Gateway HTTP API that checks the response code status of the URL and that reports success or failure to CodePipeline. Configure the CheckURL stage to use the AWS Device Farm test action and to provide the API Gateway HTTP API as an input artifact.
    🛠️ Giải thích sai: Device Farm dành cho mobile app testing (Android/iOS trên real devices), không phải web URL HTTP check. Không hỗ trợ "API Gateway as input artifact" cho web test. API Gateway + Lambda có thể làm proxy checker, nhưng phức tạp thừa (thêm cost/latency), và Device Farm action không tồn tại cho case này. Sai vì mismatch service (over-engineering + wrong tool).

🏆 Kết luận & Best Practices

✅ Lambda Invoke là lựa chọn optimal, align với AWS-native CI/CD (Immutability & Automation). Implement ví dụ: Lambda code dùng requests.get(url).status_code == 200 + client.put_job_success_result(jobId=event['CodePipeline.job']['id']). Test pipeline trước khi prod!

📘 Nguồn bổ sung:

Nếu cần code sample Lambda hoặc pipeline YAML, hỏi thêm nhé! 🚀

Câu 576
A company has an application that uploads access logs to an Amazon CloudWatch Logs log group. The fields in the log lines include the response code and the application name.

The company wants to create a CloudWatch metric to track the number of requests by response code in a specific range and with a specific application name.

Which solution will meet these requirements?
  1. A Create a CloudWatch Logs log event filter on the CloudWatch Logs log stream to match the response code range. Configure the log event filter to increment a metric. Set the response code and application name as dimensions.
  2. B Create a CloudWatch Logs metric filter on the CloudWatch Logs log group to match the response code range. Configure the metric filter to increment a metric. Set the response code and application name as dimensions.
  3. C Create a CloudWatch Contributor Insights rule on the CloudWatch Logs log stream with a filter to match the response code range. Configure the Contributor Insights rule to increment a CloudWatch metric with the response code and application name as dimensions.
  4. D Create a CloudWatch Logs Insights query on the CloudWatch Logs log group to match the response code range. Configure the Logs Insights query to increment a CloudWatch metric with the response code and application name as dimensions.
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ủa công ty đang upload các access logs (nhật ký truy cập) vào một Amazon CloudWatch Logs log group. Mỗi dòng log chứa các trường dữ liệu quan trọng như response code (mã phản hồi, ví dụ: 200, 404, 500) và application name (tên ứng dụng).
Yêu cầu cụ thể: Tạo một CloudWatch metric (chỉ số đo lường) để theo dõi số lượng requests (yêu cầu) dựa trên response code nằm trong một khoảng cụ thể (ví dụ: 400-499) và tên ứng dụng cụ thể.
🛠️ Mục tiêu chính: Sử dụng tính năng của CloudWatch Logs để tự động trích xuất và đếm số lượng log events phù hợp, chuyển thành metric có thể theo dõi trên dashboard, alarm, v.v. Điều này giúp giám sát hiệu suất ứng dụng theo thời gian thực.
✅ Phiên bản AWS cập nhật đến 2026: CloudWatch Logs hỗ trợ metric filters với pattern matching nâng cao (JSON, regex), dimensions động, và tích hợp sâu với CloudWatch metrics (không thay đổi lớn từ 2023-2026).

✅ Đáp án đúng và lý do lựa chọn:
Đáp án đúng là: Create a CloudWatch Logs metric filter on the CloudWatch Logs log group to match the response code range. Configure the metric filter to increment a metric. Set the response code and application name as dimensions.
Lý do chi tiết:

  • CloudWatch Logs metric filter là tính năng chuẩn của AWS để tạo metric từ logs. Nó áp dụng trên log group (không phải log stream riêng lẻ), sử dụng pattern filter (ví dụ: [..., response_code="4XX", app_name="MyApp"]) để match response code range (hỗ trợ regex hoặc JSON extraction).
  • Filter sẽ increment một metric mỗi khi log khớp (ví dụ: metric "RequestsByResponseCode" với value +1).
  • Dimensions (response_code, application_name) được extract động từ log, cho phép slice/dice metric theo app và code (ví dụ: filter metric theo app="MyApp", code="404").
    🛠️ Đây là giải pháp tự động, real-time, chi phí thấp (miễn phí cho metric filter, chỉ tính phí storage logs và metrics). Hoàn hảo cho tracking theo yêu cầu!

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

  • ❌ [SAI] Create a CloudWatch Logs log event filter on the CloudWatch Logs log stream to match the response code range. Configure the log event filter to increment a metric. Set the response code and application name as dimensions.
    Phân tích sai: Không tồn tại "CloudWatch Logs log event filter" trong AWS (có lẽ nhầm lẫn với subscription filters hoặc live tail). Metric filters không áp dụng trên log stream riêng lẻ mà trên log group. Không thể config để increment metric trực tiếp như vậy. Sử dụng sai sẽ không tạo được metric theo response range và dimensions.

  • ✅ [ĐÚNG] Create a CloudWatch Logs metric filter on the CloudWatch Logs log group to match the response code range. Configure the metric filter to increment a metric. Set the response code and application name as dimensions.
    Phân tích đúng: Như đã giải thích ở trên. Đây là cách chính thức, hiệu quả nhất theo best practices AWS. Pattern filter hỗ trợ extract fields từ log (ví dụ: { $.response_code = [400,499] }), increment metric namespace tùy chỉnh, và dimensions động. Hoạt động real-time trên toàn log group.

  • ❌ [SAI] Create a CloudWatch Contributor Insights rule on the CloudWatch Logs log group with a filter to match the response code range. Configure the Contributor Insights rule to increment a CloudWatch metric with the response code and application name as dimensions.
    Phân tích sai: Contributor Insights dùng để phân tích top contributors (ví dụ: top IP, user gây lỗi nhiều nhất) từ logs, không phải để increment metric đếm requests theo range. Nó tạo top-N metrics (như Heatmaps), không hỗ trợ dimensions tùy chỉnh như response code/app name một cách linh hoạt. Filter của nó không thay thế metric filter cho counting đơn giản.

  • ❌ [SAI] Create a CloudWatch Logs Insights query on the CloudWatch Logs log group to match the response code range. Configure the Logs Insights query to increment a CloudWatch metric with the response code and application name as dimensions.
    Phân tích sai: CloudWatch Logs Insights là query language (giống SQL) để truy vấn ad-hoc logs (ví dụ: filter response_code between 400 and 499 | stats count() by application_name). Tuy nhiên, không thể config query để tự động increment metric real-time với dimensions. Insights chỉ lưu query results tạm thời, export sang dashboard hoặc export metrics thủ công (không real-time như metric filter). Phù hợp cho analysis, không phải monitoring liên tục.

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

Hy vọng phân tích này giúp bạn nắm vững! 🚀 Nếu cần ví dụ code CloudFormation cho metric filter, hãy hỏi thêm nhé!

Câu 577
A DevOps engineer provisioned an Amazon Elastic Kubernetes Service (Amazon EKS) cluster with managed node groups. The DevOps engineer associated an OpenID Connect (OIDC) issuer with the cluster.

The DevOps engineer is configuring Amazon Elastic Block Store (Amazon EBS) General Purpose SSD (gp3) volumes for the cluster. The DevOps engineer attempts to initiate a PersistentVolumeClaim (PVC) request but is unable to provision a volume. To troubleshoot the issue, the DevOps engineer runs the kubectl describe pyc command. The DevOps engineer receives a failed to provision volume with StorageClass error and a could not create volume in EC2:UnauthorizedOperation error.

Which solution will resolve these errors?
  1. A Create a Kubernetes cluster role that allows the persistent volumes to perform get, list, watch, create, and delete operations. Configure the cluster role to allow get, list, and watch operations for storage in the cluster.
  2. B Create an Amazon EBS Container Storage Interface (CSI) driver IAM role that has the required permissions and trust relationships. Attach the IAM role to the Amazon EBS CSI driver add-on in the cluster.
  3. C Add the ebs.csi.aws.com/volumeType:gp3 annotation to the PersistentVolumeClaim object in the cluster.
  4. D Create a Kubernetes storage class object. Set the provisioner value to ebs.csi.aws.com. Set the volumeBindingMode value to WaitForFirstConsumer in the luster.
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 DevOps engineer đã thiết lập Amazon EKS cluster sử dụng managed node groups và đã liên kết OIDC issuer với cluster. Engineer đang cố gắng cấu hình Amazon EBS gp3 volumes (loại General Purpose SSD thế hệ 3) cho cluster bằng cách tạo PersistentVolumeClaim (PVC). Tuy nhiên, quá trình provisioning thất bại.

Khi troubleshoot bằng lệnh kubectl describe pvc, engineer nhận được lỗi:

  • "failed to provision volume with StorageClass error": Chỉ ra vấn đề với StorageClass hoặc provisioner không thể tạo volume.
  • "could not create volume in EC2: UnauthorizedOperation error": Lỗi cốt lõi là thiếu quyền IAM khi CSI driver cố gắng tạo EBS volume trong EC2.

🛠️ Nguyên nhân gốc rễ: Trong EKS (phiên bản mới nhất 2024-2026), để dynamic provisioning EBS volumes qua EBS CSI driver, cần:

  • Cài đặt EBS CSI driver addon (từ EKS add-ons).
  • Tạo IAM role dành riêng cho CSI driver với các policy cần thiết (như AmazonEBSCSIDriverPolicy), và trust relationship sử dụng OIDC issuer của cluster.
  • Attach IAM role vào addon để pod CSI controller có quyền gọi EC2 API tạo volume. Vì cluster đã có OIDC, vấn đề không phải thiếu OIDC mà là thiếu IAM role gắn với CSI driver.

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

Đáp án đúng: Create an Amazon EBS Container Storage Interface (CSI) driver IAM role that has the required permissions and trust relationships. Attach the IAM role to the Amazon EBS CSI driver add-on in the cluster.

Lý do:

  • Lỗi UnauthorizedOperation ở EC2 API xảy ra vì EBS CSI driver (chạy như pod trong cluster) thiếu IAM permissions để tạo EBS volumes.
  • Giải pháp chuẩn theo AWS (EKS 1.28+ đến 2026): Tạo IAM role với policy AmazonEBSCSIDriverPolicy (hoặc custom tương đương, bao gồm ec2:CreateVolume, ec2:DeleteVolume, v.v.), thiết lập trust policy dựa trên OIDC issuer của cluster (sử dụng eks.eksctl.io/role-name annotation).
  • Sau đó, attach role vào EBS CSI driver add-on qua AWS CLI hoặc Console: aws eks create-addon --cluster-name <cluster> --addon-name aws-ebs-csi-driver --service-account-role-arn <role-arn>.
  • Điều này cho phép CSI controller pod assume role và provision gp3 volumes động. ✅ Hoàn toàn khớp lỗi và giải quyết triệt để.

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

  • ❌ [SAI] Create a Kubernetes cluster role that allows the persistent volumes to perform get, list, watch, create, and delete operations. Configure the cluster role to allow get, list, and watch operations for storage in the cluster.
    Phương án này sai vì cluster role RBAC chỉ kiểm soát quyền trong Kubernetes (như get/list PVC/PV), không giải quyết được lỗi IAM UnauthorizedOperation ở EC2 API. EBS CSI driver cần quyền AWS IAM bên ngoài cluster, không phải RBAC nội bộ. 🧩 Tạo role này vô ích cho provisioning EBS.

  • ✅ [ĐÚNG] Create an Amazon EBS Container Storage Interface (CSI) driver IAM role that has the required permissions and trust relationships. Attach the IAM role to the Amazon EBS CSI driver add-on in the cluster.
    Như đã giải thích ở trên: Đây là bước bắt buộc theo best practice AWS. IAM role với OIDC trust + attach vào addon cấp quyền cho CSI driver gọi EC2 CreateVolume cho gp3. ✅ Giải quyết chính xác lỗi "could not create volume in EC2".

  • ❌ [SAI] Add the ebs.csi.aws.com/volumeType:gp3 annotation to the PersistentVolumeClaim object in the cluster.
    Sai vì annotation volumeType chỉ chỉ định loại volume (gp3) trong PVC, nhưng lỗi không phải do loại volume mà là thiếu quyền tạo volume. gp3 là default trong StorageClass ebs-csi, và annotation này không fix IAM issue. Thậm chí nếu thêm, vẫn fail do UnauthorizedOperation.

  • ❌ [SAI] Create a Kubernetes storage class object. Set the provisioner value to ebs.csi.aws.com. Set the volumeBindingMode value to WaitForFirstConsumer in the luster.
    Sai vì lỗi không phải thiếu StorageClass (kubectl describe đã mention "with StorageClass", ngụ ý StorageClass tồn tại nhưng provision fail). Provisioner ebs.csi.aws.com cần CSI driver có IAM role; volumeBindingMode: WaitForFirstConsumer chỉ delay binding đến pod schedule, không fix quyền EC2. Lỗi chính là IAM, không phải config StorageClass.

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

🛠️ Lời khuyên: Sau fix, verify bằng kubectl get pvc và check logs CSI pod: kubectl logs -n kube-system daemonset.apps/ebs-csi-node. Chúc bạn học tốt DOP-C02! 🚀

Câu 578 Chọn nhiều đáp án
A company runs a fleet of Amazon EC2 instances in a VPC. The company's employees remotely access the EC2 instances by using the Remote Desktop Protocol (RDP).

The company wants to collect metrics about how many RDP sessions the employees initiate every day.

Which combination of steps will meet this requirement? (Choose three.)
  1. A Create an Amazon EventBridge rule that reacts to EC2 Instance State-change Notification events.
  2. B Create an Amazon CloudWatch Logs log group. Specify the log group as a target for the EventBridge rule.
  3. C Create a flow log in VPC Flow Logs.
  4. D Create an Amazon CloudWatch Logs log group. Specify the log group as a destination for the flow log.
  5. E Create a log group metric filter.
  6. F Create a log group subscription filter. Use EventBridge as the destination.
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 công ty đang chạy các instance Amazon EC2 trong một VPC. Nhân viên truy cập từ xa vào các EC2 instances này qua giao thức Remote Desktop Protocol (RDP) (thường sử dụng port TCP 3389).
Yêu cầu chính: Thu thập metrics về số lượng RDP sessions mà nhân viên khởi tạo mỗi ngày.
📌 Mục tiêu: Không chỉ log dữ liệu mà cần tạo metrics (chỉ số đo lường) để theo dõi hàng ngày, ví dụ: đếm số kết nối RDP thành công/thất bại.
🛠️ Giải pháp phù hợp: Sử dụng VPC Flow Logs để capture lưu lượng mạng (traffic flows) liên quan đến RDP, sau đó đẩy vào Amazon CloudWatch Logs và áp dụng metric filter để trích xuất metrics từ logs. Đây là cách chính xác, chi phí thấp và scalable theo best practices AWS (cập nhật đến 2026, VPC Flow Logs hỗ trợ traffic metrics chi tiết hơn với phiên bản mới).

Số lượng đáp án cần chọn: 3 bước kết hợp.

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

Các bước đúng là 3 lựa chọn sau (kết hợp để tạo metrics từ RDP traffic):

  • Create a flow log in VPC Flow Logs.
  • Create an Amazon CloudWatch Logs log group. Specify the log group as a destination for the flow log.
  • Create a log group metric filter.

Lý do chọn 🏆:

  • VPC Flow Logs ghi nhận tất cả traffic flows (bao gồm RDP trên port 3389) vào/ra EC2, giúp đếm sessions chính xác (ví dụ: filter theo dstport 3389 và action ACCEPTED).
  • Gửi logs vào CloudWatch Logs để lưu trữ.
  • Metric filter trên log group trích xuất metrics (như số lượng sessions/ngày) từ pattern logs, publish trực tiếp vào CloudWatch Metrics. Không cần code Lambda phức tạp, tuân thủ nguyên tắc observability AWS DevOps.
    Kết quả: Dashboard metrics realtime về RDP sessions hàng ngày! 🚀

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

Dưới đây là phân tích từng lựa chọn một, 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 chi tiết bằng tiếng Việt dựa trên kiến thức AWS mới nhất (2026).

  • Create an Amazon EventBridge rule that reacts to EC2 Instance State-change Notification events.
    ❌ Sai: EventBridge rule này chỉ phản ứng với sự kiện thay đổi trạng thái instance (như running/stopped), không capture traffic RDP sessions. Không liên quan đến đếm kết nối hàng ngày. 🛑

  • Create an Amazon CloudWatch Logs log group. Specify the log group as a target for the EventBridge rule.
    ❌ Sai: Log group có thể là target cho EventBridge, nhưng EventBridge rule ở trên không capture RDP traffic. Kết hợp này vô ích, không tạo metrics về sessions. Tiết kiệm chi phí bằng cách bỏ qua! 💸

  • Create a flow log in VPC Flow Logs.
    ✅ Đúng: VPC Flow Logs capture chi tiết traffic flows (source IP, dstport=3389 cho RDP, bytes/packets). Bắt buộc phải tạo flow log ở mức VPC/ENI để ghi nhận RDP sessions. Hoàn hảo cho metrics! 🌐

  • Create an Amazon CloudWatch Logs log group. Specify the log group as a destination for the flow log.
    ✅ Đúng: Flow Logs cần destination là CloudWatch Logs log group để lưu trữ dữ liệu traffic. Từ đây, mới có thể filter và tạo metrics. Bước thiết yếu trong pipeline observability. 📊

  • Create a log group metric filter.
    ✅ Đúng: Metric filter trên CloudWatch Logs log group parse logs (ví dụ: pattern { $.dstport = "3389" && $.action = "ACCEPT" }) để publish custom metrics về số RDP sessions/ngày. Không dùng subscription filter vì chỉ cần metrics, không stream real-time. ⚡

  • Create a log group subscription filter. Use EventBridge as the destination.
    ❌ Sai: Subscription filter stream logs real-time đến EventBridge (cho alerting/Lambda), nhưng không tạo metrics trực tiếp. Phức tạp hóa không cần thiết, không đáp ứng yêu cầu đếm sessions hàng ngày. Chọn metric filter đơn giản hơn! 🔄

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

  • VPC Flow Logs: AWS VPC Flow Logs Documentation – Hỗ trợ RDP traffic capture với filters nâng cao.
  • CloudWatch Logs Metric Filters: CloudWatch Logs Metric Filters – Ví dụ pattern cho port-based metrics.
  • Best Practices DevOps: AWS Well-Architected Framework – Observability Pillar (Reliability & Operations).
  • Exam Prep: AWS Certified DevOps Engineer Professional DOP-C02 (Flow Logs cho network metrics là high-frequency topic).

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

Câu 579
A company is using Amazon Elastic Kubernetes Service (Amazon EKS) to run its applications. The EKS cluster is successfully running multiple pods. The company stores the pod images in Amazon Elastic Container Registry (Amazon ECR).

The company needs to configure Pod Identity access for the EKS cluster. The company has already updated the node IAM role by using the permissions for Pod Identity access.

Which solution will meet these requirements?
  1. A Create an IAM OpenID Connect (OIDC) provider for the EKS cluster.
  2. B Ensure that the nodes can reach the EKS Auth API. Add and configure the EKS Pod Identity Agent add-on for the EKS cluster.
  3. C Create an EKS access entry that uses the API_AND-CONFIG_MAP cluster authentication mode.
  4. D Configure the AWS Security Token Service (AWS STS) endpoint for the Kubernetes service account that the pods in the EKS cluster use.
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 cấu hình Pod Identity access cho Amazon EKS cluster. Công ty đang sử dụng EKS để chạy ứng dụng với nhiều pod đang hoạt động tốt, lưu trữ image pod trong Amazon ECR. Họ cần kích hoạt Pod Identity (tính năng mới của AWS từ năm 2024, cập nhật đến 2026, thay thế dần IRSA - IAM Roles for Service Accounts).

📌 Yêu cầu chính:

  • Cluster EKS đã cập nhật node IAM role với permissions cần thiết cho Pod Identity (ví dụ: eks:AssociatePodIdentityAssociation, sts:AssumeRoleWithWebIdentity...).
  • Mục tiêu: Cho phép pod truy cập AWS services qua IAM roles mà không cần OIDC provider phức tạp, sử dụng EKS Pod Identity Agent làm trung gian xác thực với EKS API.

🛠️ Bối cảnh kỹ thuật (cập nhật AWS 2026): Pod Identity sử dụng EKS Auth API để xác thực pod và cấp token STS tạm thời. Quy trình bao gồm: agent add-on trên node, PodIdentityAssociation, và đảm bảo kết nối đến EKS endpoint. Không cần OIDC provider như IRSA cũ.

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

Đáp án đúng: Ensure that the nodes can reach the EKS Auth API. Add and configure the EKS Pod Identity Agent add-on for the EKS cluster.

Lý do 🏆:

  • Đây là bước cốt lõi chính thức để kích hoạt Pod Identity theo tài liệu AWS mới nhất (EKS 1.30+).
    • Đảm bảo nodes reach EKS Auth API: Nodes phải kết nối được với endpoint EKS (qua VPC endpoints hoặc public access) để agent giao tiếp xác thực.
    • Thêm và cấu hình EKS Pod Identity Agent add-on: Add-on này (từ AWS Console/CLI/eksctl) chạy daemonset trên nodes, xử lý token exchange cho pod. Sau đó tạo eks create-pod-identity-association.
  • Node IAM role đã update permissions, nên chỉ cần 2 bước này để hoàn tất. Giải pháp an toàn, scalable, không phụ thuộc OIDC.

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

  • ❌ SAI: Create an IAM OpenID Connect (OIDC) provider for the EKS cluster.
    Giải thích: Phương án này dành cho IRSA (IAM Roles for Service Accounts) cũ, yêu cầu OIDC provider để ký JWT token từ Kubernetes. Pod Identity KHÔNG cần OIDC (đã deprecated dần từ 2024), thay vào đó dùng EKS Pod Identity Agent trực tiếp với EKS API. Tạo OIDC thừa và không giải quyết yêu cầu.

  • ✅ ĐÚNG: Ensure that the nodes can reach the EKS Auth API. Add and configure the EKS Pod Identity Agent add-on for the EKS cluster.
    Giải thích: Như trên, đây là quy trình chuẩn AWS (xem AWS docs). Agent add-on là DaemonSet tự động deploy, xử lý web identity token exchange qua STS mà không cần SA annotation phức tạp.

  • ❌ SAI: Create an EKS access entry that uses the API_AND-CONFIG_MAP cluster authentication mode.
    Giải thích: EKS Access Entries dùng để quản lý IAM principal truy cập cluster (RBAC-like), với mode API_AND_CONFIG_MAP kết hợp API server + configmap. Đây là cho human/user access, không liên quan Pod Identity (dành cho pod-to-AWS services). Sử dụng sai ngữ cảnh.

  • ❌ SAI: Configure the AWS Security Token Service (AWS STS) endpoint for the Kubernetes service account that the pods in the EKS cluster use.
    Giải thích: STS endpoint dùng để assume role, nhưng cấu hình cho Kubernetes Service Account là phần của IRSA (cần OIDC + annotation). Pod Identity tự động handle STS qua agent, không cần config thủ công endpoint cho SA. Có thể gây conflict và không phải bước yêu cầu.

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

  • AWS Docs chính thức: Use Pod Identity - Chi tiết steps: prerequisites (node IAM role), install agent add-on, create association.
  • EKS Best Practices: Pod Identity Agent Add-on - CLI: aws eks create-addon --cluster-name <cluster> --addon-name eks-pod-identity-agent.
  • Blog AWS: Introducing EKS Pod Identity (2024, vẫn valid 2026).
  • Exam Tips (DevOps Pro DOP-C02): Pod Identity là hot topic, thay thế IRSA cho simplicity.

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

Câu 580
A company has multiple AWS accounts in an organization in AWS Organizations that has all features enabled. The company’s DevOps administrator needs to improve security across all the company's AWS accounts. The administrator needs to identify the top users and roles in use across all accounts.

Which solution will meet these requirements with the MOST operational efficiency?
  1. A Create a new organization trail in AWS CloudTrail. Configure the trail to send log events to Amazon CloudWatch Logs. Create a CloudWatch Contributor Insights rule for the userIdentity.arn log field. View the results in CloudWatch Contributor Insights.
  2. B Create an unused access analysis for the organization by using AWS Identity and Access Management Access Analyzer. Review the analyzer results and determine if each finding has the intended level of permissions required for the workload.
  3. C Create a new organization trail in AWS CloudTrail. Create a table in Amazon Athena that uses partition projection. Load the Athena table with CloudTrail data. Query the Athena table to find the top users and roles.
  4. D Generate a Service access report for each account by using Organizations. From the results, pull the last accessed date and last accessed by account fields to find the top users and roles.
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 cải thiện bảo mật trong một tổ chức AWS Organizations (đã kích hoạt tất cả tính năng - all features enabled), nơi có nhiều AWS accounts. DevOps administrator cần xác định top users và roles đang sử dụng nhiều nhất trên tất cả các accounts một cách hiệu quả vận hành nhất (MOST operational efficiency).

📌 Yêu cầu chính:

  • Phải bao quát toàn bộ organization (không chỉ một account).
  • Tập trung vào users và roles thực tế đang hoạt động (in use), không phải unused hoặc service access.
  • Giải pháp phải tối ưu hóa operational efficiency: Ít công sức setup, tự động hóa cao, dễ theo dõi mà không cần query thủ công phức tạp.

🛠️ Bối cảnh AWS mới nhất (2026): AWS Organizations hỗ trợ delegated administration cho CloudTrail organization trails (logs events từ tất cả accounts). CloudWatch Contributor Insights (cập nhật với advanced rules) là công cụ lý tưởng để phân tích top contributors từ CloudTrail logs mà không cần ETL phức tạp.

✅ Đáp án đúng

Create a new organization trail in AWS CloudTrail. Configure the trail to send log events to Amazon CloudWatch Logs. Create a CloudWatch Contributor Insights rule for the userIdentity.arn log field. View the results in CloudWatch Contributor Insights.

Lý do lựa chọn:

  • 🟢 Hiệu quả vận hành cao nhất: Organization trail tự động thu thập CloudTrail logs từ tất cả accounts trong Organizations (delegated admin account setup nhanh). Logs gửi đến CloudWatch Logs, sau đó Contributor Insights rule trên field userIdentity.arn (chứa ARN của users/roles) tự động tính toán top contributors (top users/roles theo số lượng events). Kết quả hiển thị dashboard trực quan, real-time, không cần query thủ công hay ETL.
  • 🟢 Phù hợp security: Giúp xác định users/roles "hot" để audit permissions, giảm rủi ro over-privileged.
  • 🟢 Cập nhật AWS 2026: Contributor Insights hỗ trợ advanced log insights cho CloudTrail, scalable cho multi-account.

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

  • ✅ Create a new organization trail in AWS CloudTrail. Configure the trail to send log events to Amazon CloudWatch Logs. Create a CloudWatch Contributor Insights rule for the userIdentity.arn log field. View the results in CloudWatch Contributor Insights.
    Đúng vì: Như giải thích trên, đây là giải pháp native, tự động, zero-maintenance cho top users/roles từ CloudTrail. Field userIdentity.arn chính xác capture principal (user/role ARN). Operational efficiency cao nhất với dashboard sẵn có.

  • ❌ Create an unused access analysis for the organization by using AWS Identity and Access Management Access Analyzer. Review the analyzer findings and determine if each finding has the intended level of permissions required for the workload.
    Sai vì: IAM Access Analyzer chỉ phát hiện unused access (quyền không dùng >90 ngày), không xác định top users/roles đang sử dụng. Nó phân tích policies, không phải activity logs. Không hiệu quả cho "in use" analysis, phải review manual từng finding – kém operational efficiency.

  • ❌ Create a new organization trail in AWS CloudTrail. Create a table in Amazon Athena that uses partition projection. Load the Athena table with CloudTrail data. Query the Athena table to find the top users and roles.
    Sai vì: Dù dùng organization trail (tốt), nhưng phải setup Athena table, partition projection, load data, rồi query SQL thủ công (ví dụ GROUP BY userIdentity.arn) – tốn công sức maintain schema/query. Không tự động như Contributor Insights, kém efficiency (cần skills SQL + cost S3/Athena).

  • ❌ Generate a Service access report for each account by using Organizations. From the results, pull the last accessed date and last accessed by account fields to find the top users and roles.
    Sai vì: Organizations Service Control Policies (SCPs) hoặc IAM service last accessed reports chỉ track services cuối cùng accessed (không phải users/roles chi tiết). Phải generate từng account riêng lẻ (không organization-wide tự động), fields như "last accessed by account" không cho top users/roles. Không phù hợp, manual cao.

📘 Tài liệu tham khảo

🛡️ Kết luận: Giải pháp đúng tận dụng stack AWS native để audit security nhanh chóng, phù hợp DevOps Professional best practices!