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

Tìm thấy 681 câu.

Câu 491 Chọn nhiều đáp án
A company uses AWS Organizations to manage its AWS accounts. A DevOps engineer must ensure that all users who access the AWS Management Console are authenticated through the company’s corporate identity provider (IdP).

Which combination of steps will meet these requirements? (Choose two.)
  1. A Use Amazon GuardDuty with a delegated administrator account Use GuardDuty to enforce denial of IAM user logins.
  2. B Use AWS IAM Identity Center to configure identity federation with SAML 2.0.
  3. C Create a permissions boundary in AWS IAM Identity Center to deny password logins for IAM users.
  4. D Create IAM groups in the Organizations management account to apply consistent permissions for all IAM users.
  5. E Create an SCP in Organizations to deny password creation for IAM users.
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 bảo mật truy cập AWS Management Console trong môi trường AWS Organizations. Công ty đang quản lý nhiều tài khoản AWS qua Organizations, và yêu cầu là tất cả người dùng (users) truy cập Console phải xác thực (authenticate) qua IdP doanh nghiệp (corporate identity provider), thường là hệ thống như Active Directory, Okta, hoặc Azure AD hỗ trợ SAML/OIDC.

📌 Mục tiêu chính:

  • Ngăn chặn đăng nhập bằng tài khoản IAM user với password gốc (root hoặc IAM password-based login).
  • Buộc sử dụng federated identity qua IdP bên ngoài để truy cập Console.
  • Cần chọn TWO steps kết hợp để đạt yêu cầu này, phù hợp với best practices DevOps trên AWS (cập nhật đến 2026: AWS IAM Identity Center là service chính cho identity federation, SCPs là công cụ chính để enforce policy cross-account).

🛠️ Ngữ cảnh kỹ thuật:

  • AWS Console hỗ trợ login qua IAM user/password HOẶC federated identity (SAML 2.0/IdP).
  • Trong Organizations, Service Control Policies (SCPs) dùng để deny actions ở level organization-wide.
  • Không có single step nào làm hết; cần kết hợp federation setup + deny IAM password login.

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

Hai phương án đúng là:

  1. Use AWS IAM Identity Center to configure identity federation with SAML 2.0.
    🧩 Lý do chọn: IAM Identity Center (trước gọi AWS SSO, cập nhật 2023+) là service trung tâm để thiết lập identity federation với SAML 2.0 từ corporate IdP. Nó cho phép users từ IdP truy cập Console cross-account qua Organizations mà không cần IAM user/password. Điều này buộc tất cả truy cập Console qua IdP, hỗ trợ permission sets và multi-account access.

  2. Create an SCP in Organizations to deny password creation for IAM users.
    🧩 Lý do chọn: SCP (Service Control Policy) ở Organizations management account có thể deny các action liên quan đến IAM password như iam:CreateLoginProfile, iam:UpdateLoginProfile, iam:ChangePassword. Điều này ngăn tạo/cập nhật password cho IAM users ở tất cả accounts con, force dùng federation qua IdP thay vì password login.

Kết hợp hai steps: IAM Identity Center setup federation → users login qua IdP; SCP deny password → không thể fallback sang IAM password. Hoàn hảo cho yêu cầu!

📋 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 cách chi tiết. Tôi giữ nguyên văn bản gốc tiếng Anh, chỉ giải thích bằng tiếng Việt:

  • ❌ Use Amazon GuardDuty with a delegated administrator account Use GuardDuty to enforce denial of IAM user logins.
    Sai vì: GuardDuty là service threat detection (phát hiện malware, recon, v.v.), không dùng để enforce access control hoặc deny login. Delegated admin chỉ cho management cross-account, không liên quan deny IAM logins. GuardDuty không kiểm soát authentication policy. (Không phù hợp yêu cầu).

  • ✅ Use AWS IAM Identity Center to configure identity federation with SAML 2.0.
    Đúng vì: Như giải thích trên, đây là cách chuẩn và chính thức để federate với corporate IdP (SAML 2.0). Users truy cập Console qua IdP → permission sets → multi-account. Cập nhật 2026: IAM Identity Center hỗ trợ external IdP full, tích hợp Organizations. (Best practice từ AWS).

  • ❌ Create a permissions boundary in AWS IAM Identity Center to deny password logins for IAM users.
    Sai vì: Permissions boundary chỉ giới hạn max permissions cho IAM roles/users (như guardrail), không deny password creation/login. IAM Identity Center không hỗ trợ boundary cho việc này; nó dùng cho roles, không block iam:CreateLoginProfile. Không enforce cross-account deny password.

  • ❌ Create IAM groups in the Organizations management account to apply consistent permissions for all IAM users.
    Sai vì: IAM groups chỉ apply trong account tạo (management account), không cross-account tự động. IAM users vẫn login bằng password nếu có, groups chỉ manage permissions chứ không force IdP hoặc deny login. Không giải quyết federation qua corporate IdP.

  • ✅ Create an SCP in Organizations to deny password creation for IAM users.
    Đúng vì: SCP là deny policy organization-wide, chặn iam:*LoginProfile actions ở tất cả accounts. Kết hợp với federation, đảm bảo không IAM password login, force qua IdP. Ví dụ SCP: {"DenyPassword": {"Effect": "Deny", "Action": ["iam:CreateLoginProfile", "iam:UpdateLoginProfile"], "Resource": "*"}}. (Cập nhật 2026: SCPs vẫn là core cho guardrails).

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

Hy vọng phân tích này giúp bạn nắm vững! 🚀 Nếu cần lab thực hành, dùng AWS Free Tier với Organizations.

Câu 492 Chọn nhiều đáp án
A company has deployed a new platform that runs on Amazon Elastic Kubernetes Service (Amazon EKS). The new platform hosts web applications that users frequently update. The application developers build the Docker images for the applications and deploy the Docker images manually to the platform.

The platform usage has increased to more than 500 users every day. Frequent updates, building the updated Docker images for the applications, and deploying the Docker images on the platform manually have all become difficult to manage.

The company needs to receive an Amazon Simple Notification Service (Amazon SNS) notification if Docker image scanning returns any HIGH or CRITICAL findings for operating system or programming language package vulnerabilities.

Which combination of steps will meet these requirements? (Choose two.)
  1. A Create an AWS CodeCommit repository to store the Dockerfile and Kubernetes deployment files. Create a pipeline in AWS CodePipeline. Use an Amazon S3 event to invoke the pipeline when a newer version of the Dockerfile is committed. Add a step to the pipeline to initiate the AWS CodeBuild project.
  2. B Create an AWS CodeCommit repository to store the Dockerfile and Kubernetes deployment files. Create a pipeline in AWS CodePipeline. Use an Amazon EventBridge event to invoke the pipeline when a newer version of the Dockerfile is committed. Add a step to the pipeline to initiate the AWS CodeBuild project.
  3. C Create an AWS CodeBuild project that builds the Docker images and stores the Docker images in an Amazon Elastic Container Registry (Amazon ECR) repository. Turn on basic scanning for the ECR repository. Create an Amazon EventBridge rule that monitors Amazon GuardDuty events. Configure the EventBridge rule to send an event to an SNS topic when the finding-severity-counts parameter is more than 0 at a CRITICAL or HIGH level.
  4. D Create an AWS CodeBuild project that builds the Docker images and stores the Docker images in an Amazon Elastic Container Registry (Amazon ECR) repository. Turn on enhanced scanning for the ECR repository. Create an Amazon EventBridge rule that monitors ECR image scan events. Configure the EventBridge rule to send an event to an SNS topic when the finding-severity-counts parameter is more than 0 at a CRITICAL or HIGH level.
  5. E Create an AWS CodeBuild project that scans the Dockerfile. Configure the project to build the Docker images and store the Docker images in an Amazon Elastic Container Registry (Amazon ECR) repository if the scan is successful. Configure an SNS topic to provide notification if the scan returns any vulnerabilities.
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ủ đề DevOps trên AWS, tập trung vào việc triển khai quy trình CI/CD tự động hóa cho ứng dụng chạy trên Amazon EKS (Elastic Kubernetes Service). 🛠️

  • Bối cảnh vấn đề: Công ty đã triển khai nền tảng trên EKS để host các web app, nơi developer build Docker images thủ công và deploy thủ công. Với hơn 500 users/ngày, việc update thường xuyên (build và deploy Docker images) trở nên khó quản lý.
  • Yêu cầu chính:
    • Tự động hóa pipeline để build và deploy Docker images khi có thay đổi (ví dụ: commit Dockerfile).
    • Nhận thông báo SNS nếu scanning Docker images phát hiện lỗ hổng HIGH hoặc CRITICAL liên quan đến OS hoặc programming language packages.
  • Loại câu hỏi: Chọn 2 bước kết hợp (combination of steps) để đáp ứng yêu cầu. Đây là câu hỏi thực tế trong kỳ thi AWS Certified DevOps Engineer - Professional (DOP-C02), nhấn mạnh vào AWS CodePipeline, CodeCommit, ECR scanning và EventBridge.
  • Kiến thức cập nhật đến 2026: Sử dụng enhanced scanning của Amazon ECR (tích hợp Amazon Inspector từ 2023), EventBridge làm trigger chính cho CodeCommit commits (thay thế CloudWatch Events cũ), và ECR image scan events cho notify vulnerabilities. ✅

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

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

Hai phương án đúng là:

  1. Create an AWS CodeCommit repository to store the Dockerfile and Kubernetes deployment files. Create a pipeline in AWS CodePipeline. Use an Amazon EventBridge event to invoke the pipeline khi a newer version of the Dockerfile is committed. Add a step to the pipeline to initiate the AWS CodeBuild project.
    Lý do: EventBridge là cách chuẩn để trigger CodePipeline từ commit CodeCommit (hỗ trợ event "CodeCommit Repository State Change"). Điều này tự động hóa build/deploy, giải quyết vấn đề manual. 🏗️

  2. Create an AWS CodeBuild project that builds the Docker images and stores the Docker images in an Amazon Elastic Container Registry (Amazon ECR) repository. Turn on enhanced scanning for the ECR repository. Create an Amazon EventBridge rule that monitors ECR image scan events. Configure the EventBridge rule to send an event to an SNS topic when the finding-severity-counts parameter is more than 0 at a CRITICAL or HIGH level.
    Lý do: Enhanced scanning (mới nhất từ AWS Inspector) quét chi tiết OS/lang vulnerabilities. EventBridge rule trên ECR image scan events filter chính xác HIGH/CRITICAL (finding-severity-counts > 0), gửi SNS notify. Hoàn hảo cho yêu cầu! 🚨

📋 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 cách chi tiết. Tôi giữ nguyên văn bản gốc tiếng Anh của phương án, chỉ giải thích bằng tiếng Việt.

  • ❌ SAI: Create an AWS CodeCommit repository to store the Dockerfile and Kubernetes deployment files. Create a pipeline in AWS CodePipeline. Use an Amazon S3 event to invoke the pipeline when a newer version of the Dockerfile is committed. Add a step to the pipeline to initiate the AWS CodeBuild project.
    Lý do sai: CodeCommit không lưu trữ qua S3 events (S3 dùng cho object storage). EventBridge mới là trigger đúng cho commit events trên CodeCommit. Sử dụng S3 sẽ không trigger khi commit Dockerfile. 🛑

  • ✅ ĐÚNG: Create an AWS CodeCommit repository to store the Dockerfile and Kubernetes deployment files. Create a pipeline in AWS CodePipeline. Use an Amazon EventBridge event to invoke the pipeline when a newer version of the Dockerfile is committed. Add a step to the pipeline to initiate the AWS CodeBuild project.
    Lý do đúng: Kết hợp CodeCommit + CodePipeline + EventBridge trigger chính xác cho "Repository State Change" event (commit mới). CodeBuild build images → tự động hóa toàn bộ quy trình EKS deploy. Hoàn thành phần CI/CD! 🔄

  • ❌ SAI: Create an AWS CodeBuild project that builds the Docker images and stores the Docker images in an Amazon Elastic Container Registry (Amazon ECR) repository. Turn on basic scanning for the ECR repository. Create an Amazon EventBridge rule that monitors Amazon GuardDuty events. Configure the EventBridge rule to send an event to an SNS topic when the finding-severity-counts parameter is more than 0 at a CRITICAL or HIGH level.
    Lý do sai: Basic scanning chỉ quét cơ bản, không chi tiết OS/lang như enhanced. GuardDuty detect threats runtime/malware, không phải image vulnerabilities (dùng cho ECR scan events). Không match yêu cầu scanning Docker images. 🔍❌

  • ✅ ĐÚNG: Create an AWS CodeBuild project that builds the Docker images and stores the Docker images in an Amazon Elastic Container Registry (Amazon ECR) repository. Turn on enhanced scanning for the ECR repository. Create an Amazon EventBridge rule that monitors ECR image scan events. Configure the EventBridge rule to send an event to an SNS topic when the finding-severity-counts parameter is more than 0 at a CRITICAL or HIGH level.
    Lý do đúng: Enhanced scanning (với Inspector) quét sâu OS/packages. ECR image scan events qua EventBridge filter finding-severity-counts > 0 cho HIGH/CRITICAL → SNS notify ngay. Tích hợp hoàn hảo với CodeBuild push ECR! 🛡️

  • ❌ SAI: Create an AWS CodeBuild project that scans the Dockerfile. Configure the project to build the Docker images and store the Docker images in an Amazon Elastic Container Registry (Amazon ECR) repository if the scan is successful. Configure an SNS topic to provide notification if the scan returns any vulnerabilities.
    Lý do sai: CodeBuild không có built-in scanning chuẩn cho vulnerabilities như ECR. Quét Dockerfile (source code) không đảm bảo quét built image (OS/packages runtime). Không có cơ chế EventBridge/SNS tự động cho HIGH/CRITICAL cụ thể. Thiếu độ tin cậy! ⚠️

Tóm tắt: Kết hợp 2 đáp án đúng tạo pipeline tự động + notify vulnerabilities, phù hợp best practices AWS DevOps 2026. Nếu deploy thực tế, thêm AWS IAM roles cho permissions và Kubernetes manifests vào pipeline! 🚀

Câu 493 Chọn nhiều đáp án
A company groups its AWS accounts in OUs in an organization in AWS Organizations. The company has deployed a set of Amazon API Gateway APIs in one of the Organizations accounts. The APIs are bound to the account's VPC and have no existing authentication mechanism. Only principals in a specific OU can have permissions to invoke the APIs.

The company applies the following policy to the API Gateway interface VPC endpoint:

{
  "Statement": [
    {
      "Action": "*",
      "Condition": {
        "ForAnyValue:StringLike": {
          "aws:PrincipalOrgPaths": "o-company-org/r-company-root/ou-company-ou"
        }
      },
      "Effect": "Allow",
      "Principal": {
        "AWS": "*"
      },
      "Resource": "*",
      "Sid": "RestrictToOU"
    }
  ],
  "Version": "2012-10-17"
}


The company also updates the API Gateway resource policies to deny invocations that do not come through the interface VPC endpoint. After the updates, the following error message appears during attempts to use the interface VPC endpoint URL to invoke an API: "User: anonymous is not authorized."

Which combination of steps will solve this problem? (Choose two.)
  1. A Enable IAM authentication on all API methods by setting AWS JAM as the authorization method.
  2. B Create a token-based AWS Lambda authorizer that passes the caller's identity in a bearer token.
  3. C Create a request parameter-based AWS Lambda authorizer that passes the caller's identity in a combination of headers, query string parameters, stage variables, and $cortext variables.
  4. D Use Amazon Cognito user pools as the authorizer to control access to the API.
  5. E Verify the identity of the requester by using Signature Version 4 to sign client requests by using AWS credentials.
Xem giải thích

🎯 Giải thích chi tiết nội dung câu hỏi

🧩 Tình huống vấn đề: Một công ty sử dụng AWS Organizations để nhóm các tài khoản AWS vào các Organizational Units (OUs). Họ đã triển khai các API Amazon API Gateway trong một tài khoản thuộc Organizations, và các API này được gắn với VPC của tài khoản đó mà không có cơ chế xác thực nào hiện tại. Yêu cầu bảo mật: Chỉ các principal (như IAM users/roles) từ một OU cụ thể mới được phép invoke (gọi) các API này.

🛠️ Cấu hình đã áp dụng:

  • Policy trên Interface VPC Endpoint của API Gateway: Policy này cho phép (Allow) tất cả actions (*) trên resource (*) chỉ khi principal thuộc đường dẫn OU cụ thể (aws:PrincipalOrgPaths: "o-company-org/r-company-root/ou-company-ou"). Principal là "AWS": "*" (bất kỳ AWS principal nào), nhưng bị giới hạn bởi condition OU.
  • Resource Policy trên API Gateway: Deny các lời gọi không đi qua Interface VPC Endpoint.

❌ Vấn đề xảy ra: Khi thử invoke API qua URL của Interface VPC Endpoint, nhận lỗi "User: anonymous is not authorized.". Lý do gốc rễ:

  • Client gọi API mà không ký request bằng Signature Version 4 (SigV4) với AWS credentials → AWS coi là "anonymous user".
  • Interface VPC Endpoint policy yêu cầu principal từ OU cụ thể, nhưng anonymous không khớp condition aws:PrincipalOrgPaths.
  • API Gateway chưa có IAM auth → Không verify được IAM identity.

📈 Mục tiêu: Chọn 2 bước kết hợp để giải quyết, đảm bảo chỉ principal từ OU được phép, qua VPC endpoint, với xác thực IAM dựa trên Organizations (theo best practice AWS đến 2026).

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

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

  1. Enable IAM authentication on all API methods by setting AWS IAM as the authorization method.
  2. Verify the identity of the requester by using Signature Version 4 to sign client requests by using AWS credentials.

Lý do lựa chọn 🏆:

  • 🔑 Kết hợp hoàn hảo:
    • Bước 1 kích hoạt IAM auth trên API Gateway methods → API Gateway sẽ verify SigV4 signature từ IAM credentials của principal, đảm bảo chỉ principals từ OU cụ thể (qua VPC endpoint policy) mới pass.
    • Bước 2 hướng dẫn client ký request bằng SigV4 với AWS IAM credentials từ account trong OU → Làm cho request có identity hợp lệ (không anonymous), khớp condition aws:PrincipalOrgPaths trong endpoint policy.
  • ✅ Giải quyết triệt để lỗi "anonymous": SigV4 + IAM auth là yêu cầu bắt buộc cho VPC endpoint policies dùng principal conditions (AWS docs 2026 xác nhận không thay đổi).
  • Không cần thay đổi Organizations policy, tận dụng sẵn có.

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

🧩 Danh sách phân tích từng lựa chọn (Giữ nguyên văn bản gốc, giải thích bằng tiếng Việt):

  • Enable IAM authentication on all API methods by setting AWS IAM as the authorization method.
    ✅ ĐÚNG 🛡️: Kích hoạt authorization type AWS_IAM trên tất cả HTTP methods của API Gateway. Điều này buộc API Gateway kiểm tra SigV4 signature từ IAM credentials. Kết hợp với VPC endpoint policy, chỉ principals từ OU cụ thể mới được allow. Đây là giải pháp chuẩn cho private API trong VPC với Organizations control (không cần Lambda/Cognito phức tạp).

  • Create a token-based AWS Lambda authorizer that passes the caller's identity in a bearer token.
    ❌ SAI 🚫: Lambda authorizer token-based (như JWT bearer token) dùng cho custom auth (ví dụ ID token từ Cognito), không verify IAM principals hay Organizations paths. Nó bỏ qua SigV4 và VPC endpoint policy, dẫn đến vẫn lỗi anonymous hoặc không khớp OU condition.

  • Create a request parameter-based AWS Lambda authorizer that passes the caller's identity in a combination of headers, query string parameters, stage variables, and $context variables.
    ❌ SAI 🚫: Request-based Lambda authorizer kiểm tra headers/query/stage vars, không tự động verify SigV4 hay Organizations membership. Phải custom logic phức tạp để parse aws:PrincipalOrgPaths, không scalable và không giải quyết lỗi anonymous trực tiếp từ endpoint policy.

  • Use Amazon Cognito user pools as the authorizer to control access to the API.
    ❌ SAI 🚫: Cognito User Pools dùng cho end-user auth (JWT tokens), không hỗ trợ IAM principals từ AWS Organizations. Nó yêu cầu Cognito integration riêng, bỏ qua VPC endpoint IAM-based policy và condition OU, dẫn đến mismatch với yêu cầu "principals in specific OU".

  • Verify the identity of the requester by using Signature Version 4 to sign client requests by using AWS credentials.
    ✅ ĐÚNG 🛡️: Client (từ account trong OU) phải ký request bằng SigV4 với IAM credentials → Tạo identity hợp lệ cho aws:PrincipalOrgPaths condition trong endpoint policy. Kết hợp IAM auth trên API, giải quyết "anonymous" error. AWS SDKs (như boto3, AWS CLI) hỗ trợ tự động SigV4 (cập nhật 2026).

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

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

Câu 494
A company wants to decrease the time it takes to develop new features. The company uses AWS CodeBuild and AWS CodeDeploy to build and deploy its applications. The company uses AWS CodePipeline to deploy each microservice with its own CI/CD pipeline.

The company needs more visibility into the average time between the release of new features and the average time to recover after a failed deployment.

Which solution will provide this visibility with the LEAST configuration effort?
  1. A Program an AWS Lambda function that creates Amazon CloudWatch custom metrics with information about successful runs and failed runs for each pipeline. Create an Amazon EventBridge rule to invoke the Lambda function every 5 minutes. Use the metrics to build a CloudWatch dashboard.
  2. B Program an AWS Lambda function that creates Amazon CloudWatch custom metrics with information about successful runs and failed runs for each pipeline. Create an Amazon EventBridge rule to invoke the Lambda function after every successful run and after every failed run. Use the metrics to build a CloudWatch dashboard.
  3. C Program an AWS Lambda function that writes information about successful runs and failed runs to Amazon DynamoDB. Create an Amazon EventBridge rule to invoke the Lambda function after every successful run and after every failed run. Build an Amazon QuickSight dashboard to show the information from DynamoDB.
  4. D Program an AWS Lambda function that writes information about successful runs and failed runs to Amazon DynamoDB. Create an Amazon EventBridge rule to invoke the Lambda function every 5 minutes. Build an Amazon QuickSight dashboard to show the information from DynamoDB.
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 khả năng quan sát (visibility) trong quy trình CI/CD trên AWS, cụ thể là đo lường hai chỉ số DORA metrics quan trọng:

  • Lead Time for Changes: Thời gian trung bình từ khi release tính năng mới đến khi deploy thành công.
  • Deployment Frequency và Time to Restore (liên quan đến thời gian recover sau failed deployment).

Công ty đang sử dụng AWS CodePipeline cho từng microservice riêng biệt (multi-pipeline), kết hợp CodeBuild (build) và CodeDeploy (deploy). Họ cần giải pháp cung cấp visibility vào các chỉ số này với ít nỗ lực cấu hình nhất (LEAST configuration effort).

🔍 Yêu cầu cốt lõi: Theo dõi successful runs (deploy thành công) và failed runs (deploy thất bại) từ CodePipeline, thu thập metrics để tính toán thời gian trung bình, và hiển thị trên dashboard. CodePipeline tự động emit events qua Amazon EventBridge (như CodePipeline_PipelineExecutionSucceeded, CodePipeline_PipelineExecutionFailed), giúp trigger xử lý mà không cần polling liên tục. Giải pháp tối ưu phải tận dụng events này để giảm effort (không poll định kỳ), sử dụng dịch vụ native cho metrics/dashboard.

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

Đáp án đúng:
Program an AWS Lambda function that creates Amazon CloudWatch custom metrics with information about successful runs and failed runs for each pipeline. Create an Amazon EventBridge rule to invoke the Lambda function after every successful run and after every failed run. Use the metrics to build a CloudWatch dashboard.

Lý do chọn đáp án này 🛠️:

  • Đây là giải pháp ít config effort nhất vì:
    • EventBridge rule trigger chính xác sau mỗi successful/failed run (sử dụng events native từ CodePipeline như PipelineExecutionSucceeded/Failed), không lãng phí tài nguyên polling every 5 phút.
    • Lambda publish CloudWatch custom metrics trực tiếp (dùng put_metric_data), dễ dàng aggregate (Sum, Average) để tính thời gian lead time/recover mà không cần lưu trữ trung gian như DynamoDB.
    • CloudWatch dashboard native, free cho metrics cơ bản, hỗ trợ widget metrics/alarm/math expressions để visualize DORA metrics ngay lập tức (cập nhật 2023-2026: CloudWatch hỗ trợ Contributor Insights cho pipelines).
  • Phù hợp multi-pipeline (tag pipeline name vào metric dimensions). Effort thấp: Chỉ cần 1 Lambda + 1 EventBridge rule pattern cho tất cả pipelines.

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

  • Phương án A ❌ (SAI):
    Program an AWS Lambda function that creates Amazon CloudWatch custom metrics with information about successful runs and failed runs for each pipeline. Create an Amazon EventBridge rule to invoke the Lambda function every 5 minutes. Use the metrics to build a CloudWatch dashboard.
    Giải thích sai: Polling every 5 minutes qua EventBridge (rate-based rule) gây overhead cao (gọi Lambda thừa khi không có event), không chính xác realtime, và effort cao hơn (phải query CodePipeline API trong Lambda để check status). Không tận dụng events native → Không LEAST effort.

  • Phương án B ✅ (ĐÚNG):
    Program an AWS Lambda function that creates Amazon CloudWatch custom metrics with information about successful runs and failed runs for each pipeline. Create an Amazon EventBridge rule to invoke the Lambda function after every successful run and after every failed run. Use the metrics to build a CloudWatch dashboard.
    Giải thích đúng: Như phần trên, event-driven (pattern: {"source": ["aws.codepipeline"], "detail-type": ["CodePipeline Action Execution State Changed"]} filter success/fail), CloudWatch metrics native cho dashboard nhanh. Least effort cho scale multi-pipeline.

  • Phương án C ❌ (SAI):
    Program an AWS Lambda function that writes information about successful runs and failed runs to Amazon DynamoDB. Create an Amazon EventBridge rule to invoke the Lambda function after every successful run and after every failed run. Build an Amazon QuickSight dashboard to show the information from DynamoDB.
    Giải thích sai: Event-driven tốt, nhưng DynamoDB + QuickSight thêm effort cao: Quản lý table/index, query SPICE dataset, config QuickSight (connectivity, refresh schedule, viz). Không native metrics → Phức tạp hơn CloudWatch, chi phí cao hơn cho scale.

  • Phương án D ❌ (SAI):
    Program an AWS Lambda function that writes information about successful runs and failed runs to Amazon DynamoDB. Create an Amazon EventBridge rule to invoke the Lambda function every 5 minutes. Build an Amazon QuickSight dashboard to show the information from DynamoDB.
    Giải thích sai: Kết hợp polling every 5 min (overhead) + DynamoDB/QuickSight (effort cao như C). Không realtime, dữ liệu duplicate → Tệ nhất về effort và hiệu quả.

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

Giải pháp này giúp công ty tối ưu DevOps velocity với zero-downtime visibility! 💡

Câu 495
A company has developed a static website hosted on an Amazon S3 bucket. The website is deployed using AWS CloudFormation. The CloudFormation template defines an S3 bucket and a custom resource that copies content into the bucket from a source location.

The company has decided that it needs to move the website to a new location, so the existing CloudFormation stack must be deleted and re-created. However, CloudFormation reports that the stack could not be deleted cleanly.

What is the MOST likely cause and how can the DevOps engineer mitigate this problem for this and future versions of the website?
  1. A Deletion has failed because the S3 bucket has an active website configuration. Modify the CloudFormation template to remove the WebsiteConfiguration property from the S3 bucket resource.
  2. B Deletion has failed because the S3 bucket is not empty. Modify the custom resource's AWS Lambda function code to recursively empty the bucket when RequestType is Delete.
  3. C Deletion has failed because the custom resource does not define a deletion policy. Add a DeletionPolicy property to the custom resource definition with a value of RemoveOnDeletion.
  4. D Deletion has failed because the S3 bucket is not empty. Modify the S3 bucket resource in the CloudFormation template to add a DeletionPolicy property with a value of Empty.
Xem giải thích

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

Câu hỏi mô tả một tình huống thực tế trong AWS: Một công ty đã triển khai static website trên Amazon S3 bucket bằng AWS CloudFormation. Template CloudFormation định nghĩa:

  • Một S3 bucket để lưu trữ nội dung website.
  • Một custom resource (thường là AWS Lambda-backed) chịu trách nhiệm copy nội dung từ một vị trí nguồn (source location) vào bucket.

Bây giờ, công ty muốn di chuyển website đến vị trí mới, nên cần xóa stack CloudFormation hiện tại và tạo lại stack mới. Tuy nhiên, CloudFormation báo lỗi không xóa stack sạch sẽ (cleanly).

Vấn đề cốt lõi: Tìm nguyên nhân NGUYÊN LIÊN NHẤT (MOST likely cause) dẫn đến lỗi xóa stack, và cách giảm thiểu (mitigate) vấn đề này cho phiên bản hiện tại lẫn tương lai.

  • 🛠️ Ngữ cảnh kỹ thuật: S3 bucket không thể xóa nếu chứa objects (không empty). CloudFormation mặc định không tự động xóa objects trong bucket khi delete stack (với DeletionPolicy: Delete). Custom resource phải tự handle logic xóa trong handler Lambda của nó.

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

  • AWS CloudFormation User Guide: Custom Resources (cập nhật 2024-2026, Lambda handler phải xử lý RequestType: Delete).
  • AWS S3 Docs: Deleting a bucket (bucket phải empty trước khi delete).
  • CloudFormation Resource Specification (2026): S3 Bucket không hỗ trợ DeletionPolicy: "Empty".

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

Đáp án đúng:
Deletion has failed because the S3 bucket is not empty. Modify the custom resource's AWS Lambda function code to recursively empty the bucket when RequestType is Delete.

Lý do chọn đáp án này (chi tiết):

  • ✅ Nguyên nhân chính: S3 bucket chứa nội dung website (do custom resource copy vào), nên không empty → CloudFormation không xóa được bucket khi delete stack (lỗi phổ biến DOP-C02).
  • ✅ Giải pháp mitigate: Sửa code Lambda của custom resource để xử lý RequestType: "Delete" bằng cách recursively delete all objects (sử dụng listObjectsV2 + deleteObjects API). Điều này đảm bảo bucket empty tự động mỗi khi delete stack, áp dụng cho hiện tại và tương lai.
  • 🛠️ Lợi ích: Custom resource là nơi logic deploy được định nghĩa, nên handle delete ở đây là best practice (idempotent và scalable). Không cần can thiệp thủ công (như aws s3 rm --recursive).

📋 Giải thích TẤT CẢ các phương án (đúng/sai)

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

  • ❌ SAI: Deletion has failed because the S3 bucket has an active website configuration. Modify the CloudFormation template to remove the WebsiteConfiguration property from the S3 bucket resource.
    Giải thích sai: WebsiteConfiguration (StaticWebsiteHosting) không ngăn cản xóa bucket (chỉ cần disable trước nếu muốn, nhưng bucket vẫn empty được). Nguyên nhân thực là bucket không empty, không phải config này. Xóa property chỉ là workaround tạm thời, không mitigate gốc rễ và không handle content.

  • ✅ ĐÚNG: Deletion has failed because the S3 bucket is not empty. Modify the custom resource's AWS Lambda function code to recursively empty the bucket when RequestType is Delete.
    Giải thích đúng: Như phần trên. Đây là MOST likely cause (bucket không empty do objects từ custom resource). Giải pháp sửa Lambda recursively empty (dùng S3 API loop delete) là standard pattern cho custom resources trong DOP-C02 exam (xử lý Delete event tự động).

  • ❌ SAI: Deletion has failed because the custom resource does not define a deletion policy. Add a DeletionPolicy property to the custom resource definition with a value of RemoveOnDeletion.
    Giải thích sai: Custom resource không sử dụng DeletionPolicy như resource gốc (nó backed bởi Lambda và self-handle qua RequestType: Delete). DeletionPolicy: RemoveOnDeletion không tồn tại cho custom resources (chỉ Retain/Delete/Snapshot cho S3). Phải code logic trong Lambda handler, không phải property YAML.

  • ❌ SAI: Deletion has failed because the S3 bucket is not empty. Modify the S3 bucket resource in the CloudFormation template to add a DeletionPolicy property with a value of Empty.
    Giải thích sai: Nguyên nhân đúng (bucket không empty), nhưng DeletionPolicy: "Empty" KHÔNG tồn tại cho S3 Bucket (chỉ hỗ trợ Retain/Delete/Snapshot). CloudFormation không tự empty objects với Delete policy → vẫn fail. Giải pháp sai, chỉ custom resource mới handle được.

🧩 Kết luận: Đáp án đúng tập trung vào custom resource logic – best practice DevOps để stack idempotent và delete cleanly! Nếu deploy thực tế, test với aws cloudformation delete-stack và check Lambda logs. 🚀

Câu 496
A company uses Amazon EC2 as its primary compute platform. A DevOps team wants to audit the company's EC2 instances to check whether any prohibited applications have been installed on the EC2 instances.

Which solution will meet these requirements with the MOST operational efficiency?
  1. A Configure AWS Systems Manager on each instance. Use AWS Systems Manager Inventory. Use Systems Manager resource data sync to synchronize and store findings in an Amazon S3 bucket. Create an AWS Lambda function that runs when new objects are added to the S3 bucket. Configure the Lambda function to identify prohibited applications.
  2. B Configure AWS Systems Manager on each instance. Use Systems Manager Inventory Create AWS Config rules that monitor changes from Systems Manager Inventory to identify prohibited applications.
  3. C Configure AWS Systems Manager on each instance. Use Systems Manager Inventory. Filter a trail in AWS CloudTrail for Systems Manager Inventory events to identify prohibited applications.
  4. D Designate Amazon CloudWatch Logs as the log destination for all application instances. Run an automated script across all instances to create an inventory of installed applications. Configure the script to forward the results to CloudWatch Logs. Create a CloudWatch alarm that uses filter patterns to search log data to identify prohibited applications.
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 audit các EC2 instances để kiểm tra xem có ứng dụng bị cấm (prohibited applications) được cài đặt hay không. Công ty sử dụng Amazon EC2 làm nền tảng compute chính, và đội DevOps cần một giải pháp hiệu quả vận hành nhất (MOST operational efficiency).

✅ Yêu cầu chính:

  • Sử dụng AWS Systems Manager (SSM) để thu thập inventory (danh sách phần mềm đã cài đặt) trên các EC2 instances.
  • Giải pháp phải tự động, ít can thiệp thủ công, scalable, và tận dụng các dịch vụ managed của AWS để giảm overhead vận hành.
  • Operational efficiency ưu tiên: Tích hợp native (không custom code), monitoring liên tục, alerting/compliance tự động, tránh script thủ công hoặc polling thủ công.

🛠️ Kiến thức liên quan (cập nhật AWS 2024-2026):

  • SSM Inventory thu thập metadata về software (applications, packages) trên instances mà không cần agent bên thứ ba (sử dụng SSM Agent).
  • AWS Config hỗ trợ rules tùy chỉnh hoặc managed để monitor dữ liệu từ SSM Inventory, đánh giá compliance (ví dụ: prohibited apps), và tự động remediate.
  • Giải pháp lý tưởng: Tích hợp SSM Inventory với AWS Config để theo dõi thay đổi (changes) liên tục, scalable cho hàng nghìn instances.

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

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

Đáp án đúng: Configure AWS Systems Manager on each instance. Use Systems Manager Inventory Create AWS Config rules that monitor changes from Systems Manager Inventory to identify prohibited applications.

Lý do 🏆:

  • Đây là giải pháp native và tự động nhất, sử dụng SSM Inventory để thu thập dữ liệu applications + AWS Config rules (managed/custom Lambda-free) để monitor thay đổi liên tục (changes), đánh giá compliance ngay lập tức.
  • Operational efficiency cao: Không cần custom script/Lambda/S3 sync, scalable toàn vùng/không gian làm việc, hỗ trợ remediation tự động (SSM Automation). Phù hợp DOP-C02 exam (2024-2026).
  • Theo dõi changes đảm bảo phát hiện prohibited apps mới/cập nhật, không chỉ snapshot.

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

  • ❌ Phương án SAI 1: Configure AWS Systems Manager on each instance. Use AWS Systems Manager Inventory. Use Systems Manager resource data sync to synchronize and store findings in an Amazon S3 bucket. Create an AWS Lambda function that runs when new objects are added to the S3 bucket. Configure the Lambda function to identify prohibited applications.
    Giải thích sai: Quá phức tạp và overhead cao (sync dữ liệu định kỳ đến S3 + custom Lambda trigger). Không theo dõi changes real-time, phải maintain Lambda code/list prohibited apps. Không efficient so với native Config rules. (Vi phạm nguyên tắc least privilege/operational overhead).

  • ✅ Phương án ĐÚNG: Configure AWS Systems Manager on each instance. Use Systems Manager Inventory Create AWS Config rules that monitor changes from Systems Manager Inventory to identify prohibited applications.
    Giải thích đúng: ✅ Tích hợp hoàn hảo: SSM Inventory cung cấp dữ liệu → AWS Config rules (ví dụ: ssm-managed-instance-compliance hoặc custom) monitor changes tự động, đánh giá NON_COMPLIANT nếu có prohibited apps. Hiệu quả nhất: Managed service, dashboard trung tâm, alerting qua SNS/EventBridge, không code thủ công. Scalable cho fleet lớn (2026 features: Enhanced Config Aggregators).

  • ❌ Phương án SAI 2: Configure AWS Systems Manager on each instance. Use Systems Manager Inventory. Filter a trail in AWS CloudTrail for Systems Manager Inventory events to identify prohibited applications.
    Giải thích sai: CloudTrail chỉ log API calls (như PutInventory), không chứa dữ liệu inventory chi tiết (app names/versions). Không thể filter để "identify prohibited applications" trực tiếp. Overhead cao khi query logs thủ công, không real-time monitoring.

  • ❌ Phương án SAI 3: Designate Amazon CloudWatch Logs as the log destination for all application instances. Run an automated script across all instances to create an inventory of installed applications. Configure the script to forward the results to CloudWatch Logs. Create a CloudWatch alarm that uses filter patterns to search log data to identify prohibited applications.
    Giải thích sai: Hand-rolled solution kém efficient: Script tùy chỉnh trên tất cả instances (cần SSM/State Manager để run), maintain code phức tạp, không native như SSM Inventory. CloudWatch Logs/alarms chỉ search text, dễ miss/false positive. Không scalable, tăng chi phí compute/maintenance so với managed services.

🧠 Kết luận: Giải pháp đúng tận dụng stack managed AWS (SSM + Config) để audit tự động, giảm toil – best practice cho DevOps Professional! 🚀

Câu 497 Chọn nhiều đáp án
A company has an event-driven JavaScript application. The application uses decoupled AWS managed services that publish, consume, and route events. During application testing, events are not delivered to the target that is specified by an Amazon EventBridge rule.

A DevOps team must provide application testers with additional functionality to view, troubleshoot, and prevent the loss of events without redeployment of the application.

Which combination of steps should the DevOps team take to meet these requirements? (Choose three.)
  1. A Launch AWS Device Farm with a standard test environment and project to run a specific build of the application.
  2. B Create an Amazon S3 bucket. Enable AWS CloudTrail. Create a CloudTrail trail that specifies the S3 bucket as the storage location.
  3. C Configure the EventBridge rule to use an Amazon Simple Queue Service (Amazon SQS) standard queue as a dead-letter queue.
  4. D Configure the EventBridge rule to use an Amazon Simple Queue Service (Amazon SQS) FIFO queue as a dead-letter queue.
  5. E Create a log group in Amazon CloudWatch Logs Specify the log group as an additional target of the EventBridge rule.
  6. F Update the application code base to use the AWS X-Ray SDK tracing feature to instrument the code with support for the X-Amzn-Trace-Id header.
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 một ứng dụng JavaScript event-driven (dựa trên sự kiện), sử dụng các dịch vụ AWS managed decoupled (tách rời) để publish (phát hành), consume (tiêu thụ) và route (định tuyến) events. Trong quá trình testing, events không được deliver (giao đến) target được chỉ định bởi một Amazon EventBridge rule. Nhiệm vụ của DevOps team là cung cấp cho testers thêm chức năng để view (xem), troubleshoot (khắc phục sự cố) và prevent loss (ngăn mất mát) events, mà không cần redeploy (triển khai lại) ứng dụng.

Mục tiêu chính:

  • 🔍 View & Troubleshoot: Theo dõi và phân tích events bị mất.
  • 🛡️ Prevent loss: Sử dụng cơ chế như dead-letter queue (DLQ) để lưu events thất bại.
  • ⚙️ Không redeploy: Các bước phải là cấu hình dịch vụ AWS, không chỉnh sửa code hoặc deploy mới.
  • 📋 Chọn 3 steps kết hợp để đáp ứng đầy đủ.

Dựa trên kiến thức AWS cập nhật đến năm 2026 (EventBridge version mới nhất hỗ trợ DLQ, CloudTrail insights, và multi-target rules), vấn đề nằm ở EventBridge rule failures (lỗi quy tắc định tuyến events).

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

Các đáp án đúng là:

  • Create an Amazon S3 bucket. Enable AWS CloudTrail. Create a CloudTrail trail that specifies the S3 bucket as the storage location.
  • Configure the EventBridge rule to use an Amazon Simple Queue Service (Amazon SQS) standard queue as a dead-letter queue.
  • Create a log group in Amazon CloudWatch Logs. Specify the log group as an additional target of the EventBridge rule.

Lý do lựa chọn:

  • 🛡️ Kết hợp hoàn hảo: CloudTrail cung cấp audit logs chi tiết về invocations của EventBridge (view/troubleshoot), SQS standard DLQ lưu events thất bại (prevent loss), CloudWatch Logs log events realtime làm target phụ (view mà không ảnh hưởng flow chính). Tất cả đều là cấu hình no-code, không redeploy, phù hợp testing.
  • 📈 Hiệu quả cao: Testers có thể query logs, xem DLQ messages, replay events từ DLQ nếu cần.
  • Nguồn tham khảo:

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

Dưới đây là phân tích chi tiết từng lựa chọn, giữ nguyên văn bản gốc bằng tiếng Anh. Mỗi phương án được đánh giá đúng/sai dựa trên yêu cầu (view, troubleshoot, prevent loss events không redeploy).

  • ❌ Launch AWS Device Farm with a standard test environment and project to run a specific build of the application.
    Sai vì: AWS Device Farm dùng để test ứng dụng mobile/web trên thiết bị thật, không liên quan đến EventBridge events hay troubleshooting events thất bại. Đây là testing UI/build, không giúp view/prevent loss events, và yêu cầu build mới (gần redeploy).

  • ✅ Create an Amazon S3 bucket. Enable AWS CloudTrail. Create a CloudTrail trail that specifies the S3 bucket as the storage location.
    Đúng vì: CloudTrail ghi log tất cả invocations của EventBridge rules (bao gồm failed deliveries), lưu vào S3 để testers query/search (view/troubleshoot). Giúp xác định lý do events không deliver (e.g., permission issues). No redeploy, chỉ enable trail. Hoàn hảo cho audit mà không thay đổi app.

  • ✅ Configure the EventBridge rule to use an Amazon Simple Queue Service (Amazon SQS) standard queue as a dead-letter queue.
    Đúng vì: EventBridge hỗ trợ SQS standard queue làm DLQ để lưu events thất bại sau max retries (prevent loss). Testers có thể view messages trong DLQ, troubleshoot (e.g., redrive), và replay nếu cần. Cấu hình rule trực tiếp, no redeploy. (Lưu ý: Chỉ standard, không FIFO – xem phân tích dưới).

  • ❌ Configure the EventBridge rule to use an Amazon Simple Queue Service (Amazon SQS) FIFO queue as a dead-letter queue.
    Sai vì: EventBridge KHÔNG hỗ trợ SQS FIFO làm DLQ (chỉ standard queues). FIFO đảm bảo order/dupe nhưng không tương thích DLQ của EventBridge, sẽ gây lỗi config. Không đáp ứng prevent loss đúng cách.

  • ✅ Create a log group in Amazon CloudWatch Logs. Specify the log group as an additional target of the EventBridge rule.
    Đúng vì: Thêm CloudWatch Logs group làm target phụ của rule để log toàn bộ events (bao gồm payload, metadata) realtime. Testers dễ view/search logs (troubleshoot), phát hiện events không deliver đến target chính. Multi-target no downtime, no redeploy.

  • ❌ Update the application code base to use the AWS X-Ray SDK tracing feature to instrument the code with support for the X-Amzn-Trace-Id header.
    Sai vì: Yêu cầu update code và redeploy (vi phạm "without redeployment"). X-Ray trace app logic, không trực tiếp troubleshoot EventBridge rule failures (events có thể fail trước khi đến app). Không phải giải pháp cho testers xem/prevent loss events AWS-managed.

🛠️ Khuyến nghị triển khai thực tế

  • Bước 1: Config DLQ + Logs target trước để prevent/view ngay.
  • Bước 2: Enable CloudTrail trail cho full audit.
  • Test: Publish test events qua EventBridge console, kiểm tra DLQ/Logs/CloudTrail.
  • 🚀 Lợi ích: Scalable, cost-effective (~$0.01/1k events), phù hợp DevOps Professional best practices.

Nếu cần demo CLI hoặc Terraform code, hãy cho tôi biết! 🌟

Câu 498 Chọn nhiều đáp án
A company is migrating its container-based workloads to an AWS Organizations multi-account environment. The environment consists of application workload accounts that the company uses to deploy and run the containerized workloads. The company has also provisioned a shared services account for shared workloads in the organization.

The company must follow strict compliance regulations. All container images must receive security scanning before they are deployed to any environment. Images can be consumed by downstream deployment mechanisms after the images pass a scan with no critical vulnerabilities. Pre-scan and post-scan images must be isolated from one another so that a deployment can never use pre-scan images.

A DevOps engineer needs to create a strategy to centralize this process.

Which combination of steps will meet these requirements with the LEAST administrative overhead? (Choose two.)
  1. A Create Amazon Elastic Container Registry (Amazon ECR) repositories in the shared services account: one repository for each pre-scan image and one repository for each post-scan image. Configure Amazon ECR image scanning to run on new image pushes to the pre-scan repositories. Use resource-based policies to grant the organization write access to the pre-scan repositories and read access to the post-scan repositories.
  2. B Create pre-scan Amazon Elastic Container Registry (Amazon ECR) repositories in each account that publishes container images. Create repositories for post-scan images in the shared services account. Configure Amazon ECR image scanning to run on new image pushes to the pre-scan repositories. Use resource-based policies to grant the organization read access to the post-scan repositories.
  3. C Configure image replication for each image from the image's pre-scan repository to the image's post-scan repository.
  4. D Create a pipeline in AWS CodePipeline for each pre-scan repository. Create a source stage that runs when new images are pushed to the pre-scan repositories. Create a stage that uses AWS CodeBuild as the action provider. Write a buildspec.yaml definition that determines the image scanning status and pushes images without critical vulnerabilities to the post-scan repositories.
  5. E Create an AWS Lambda function. Create an Amazon EventBridge rule that reacts to image scanning completed events and invokes the Lambda function. Write function code that determines the image scanning status and pushes images without critical vulnerabilities to the post-scan repositories.
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 di chuyển workload container sang môi trường AWS Organizations multi-account, bao gồm các tài khoản workload ứng dụng và một tài khoản shared services. Công ty phải tuân thủ quy định compliance nghiêm ngặt: Tất cả container images phải được scan security trước khi deploy. Chỉ images pass scan (không có critical vulnerabilities) mới được sử dụng bởi downstream deployment. Pre-scan images và post-scan images phải được isolated hoàn toàn để tránh deploy nhầm images chưa scan.

📋 Yêu cầu chính cho DevOps engineer:

  • Centralize quy trình scan và quản lý images.
  • Chọn kết hợp 2 steps với LEAST administrative overhead (ít công quản trị nhất), nghĩa là tránh tạo nhiều resources thủ công ở từng account, ưu tiên tự động hóa và chia sẻ qua Organizations.

🛠️ Giải pháp lý tưởng: Sử dụng Amazon ECR làm trung tâm lưu trữ images (centralized ở shared services account), ECR image scanning tự động trên push, resource-based policies để cấp quyền cross-account, và EventBridge + Lambda để tự động di chuyển images sạch sang repo post-scan. Điều này tận dụng tính năng native AWS (cập nhật đến 2024-2026: ECR scanning hỗ trợ continuous scanning, EventBridge rules cho ECR events chi tiết hơn).

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

Hai phương án sau kết hợp hoàn hảo để centralize, isolate pre/post-scan, tự động hóa với overhead thấp nhất:

  1. Create Amazon Elastic Container Registry (Amazon ECR) repositories in the shared services account: one repository for each pre-scan image and one repository for each post-scan image. Configure Amazon ECR image scanning to run on new image pushes to the pre-scan repositories. Use resource-based policies to grant the organization write access to the pre-scan repositories and read access to the post-scan repositories.
    🟢 Lý do đúng: Tạo repo centralized ở shared services account giúp tất cả workload accounts push images chung một nơi (pre-scan), scan tự động kích hoạt trên push. Policies resource-based cho phép Organizations write vào pre-scan và read post-scan → dễ quản lý quyền cross-account mà không cần IAM roles phức tạp ở từng account. Overhead thấp vì chỉ config một lần cho org.

  2. Create an AWS Lambda function. Create an Amazon EventBridge rule that reacts to image scanning completed events and invokes the Lambda function. Write function code that determines the image scanning status and pushes images without critical vulnerabilities to the post-scan repositories.
    🟢 Lý do đúng: EventBridge (native event bus) lắng nghe ECR image scanning completed events (sự kiện chi tiết từ ECR), trigger Lambda kiểm tra status và chỉ push images sạch sang post-scan repo. Tự động 100%, serverless, không cần polling → least overhead, scale tự động cho multi-account.

Kết hợp hai cái này: Workload accounts push → scan auto → Lambda push clean images → downstream chỉ pull post-scan. Hoàn hảo cho compliance và isolation!

❌ Giải thích tất cả các phương án

Dưới đây là phân tích từng phương á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 lý do chi tiết bằng tiếng Việt dựa trên best practices AWS DevOps (least overhead ưu tiên native integrations).

  • ✅ Create Amazon Elastic Container Registry (Amazon ECR) repositories in the shared services account: one repository for each pre-scan image and one repository for each post-scan image. Configure Amazon ECR image scanning to run on new image pushes to the pre-scan repositories. Use resource-based policies to grant the organization write access to the pre-scan repositories and read access to the post-scan repositories.
    🟢 Đúng: Centralized repos ở shared account giảm overhead quản lý (không cần repo riêng từng account). ECR scanning auto-run, resource-based policies (hỗ trợ Organizations delegation) cấp quyền chính xác → an toàn, dễ audit.

  • ❌ Create pre-scan Amazon Elastic Container Registry (Amazon ECR) repositories in each account that publishes container images. Create repositories for post-scan images in the shared services account. Configure Amazon ECR image scanning to run on new image pushes to the pre-scan repositories. Use resource-based policies to grant the organization read access to the post-scan repositories.
    🔴 Sai: Tạo pre-scan repo ở mỗi workload account → high administrative overhead (phải config scanning, policies ở từng account, khó centralize). Không isolate hoàn toàn vì mỗi account tự quản pre-scan, vi phạm yêu cầu "centralize process". Policies chỉ read post-scan là chưa đủ.

  • ❌ Configure image replication for each image from the image's pre-scan repository to the image's post-scan repository.
    🔴 Sai: ECR replication (cross-repo/account) không kiểm tra scan status – nó replicate tất cả images ngay lập tức, kể cả dirty ones → vi phạm isolation (deploy có thể dùng pre-scan). Không tự động filter critical vulnerabilities, overhead thấp nhưng không meet compliance. (Cập nhật 2026: Replication vẫn blind, không integrate scanning results).

  • ❌ Create a pipeline in AWS CodePipeline for each pre-scan repository. Create a source stage that runs when new images are pushed to the pre-scan repositories. Create a stage that uses AWS CodeBuild as the action provider. Write a buildspec.yaml definition that determines the image scanning status and pushes images without critical vulnerabilities to the post-scan repositories.
    🔴 Sai: Tạo CodePipeline riêng cho mỗi repo → high overhead (nhiều pipelines cần maintain, config source triggers, CodeBuild specs). Không native như EventBridge, tốn chi phí và phức tạp hơn Lambda cho event-driven scanning. Không least overhead so với serverless alternatives.

  • ✅ Create an AWS Lambda function. Create an Amazon EventBridge rule that reacts to image scanning completed events and invokes the Lambda function. Write function code that determines the image scanning status and pushes images without critical vulnerabilities to the post-scan repositories.
    🟢 Đúng: EventBridge rule target ECR_SCAN_ON_PUSH_COMPLETED event (native từ 2021+, chi tiết hơn ở 2024), Lambda parse scanFindings và chỉ push nếu critical = 0 → tự động, zero-maintenance sau setup. Perfect cho multi-account via shared account.

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

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

Câu 499
A company uses an Amazon Elastic Kubernetes Service (Amazon EKS) cluster to deploy its web applications on containers. The web applications contain confidential data that cannot be decrypted without specific credentials.

A DevOps engineer has stored the credentials in AWS Secrets Manager. The secrets are encrypted by an AWS Key Management Service (AWS KMS) customer managed key. A Kubernetes service account for a third-party tool makes the secrets available to the applications. The service account assumes an IAM role that the company created to access the secrets.

The service account receives an Access Denied (403 Forbidden) error while trying to retrieve the secrets from Secrets Manager.

What is the root cause of this issue?
  1. A The IAM role that is attached to the EKS cluster does not have access to retrieve the secrets from Secrets Manager.
  2. B The key policy for the customer managed key does not allow the Kubernetes service account IAM role to use the key.
  3. C The key policy for the customer managed key does not allow the EKS cluster IAM role to use the key.
  4. D The IAM role that is assumed by the Kubernetes service account does not have permission to access the EKS cluster.
Xem giải thích

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

Câu hỏi mô tả một tình huống thực tế trong môi trường Amazon EKS (Elastic Kubernetes Service), nơi công ty triển khai các ứng dụng web trên container chứa dữ liệu bí mật (confidential data). Các credentials (chứng chỉ) được lưu trữ an toàn trong AWS Secrets Manager, và secrets này được mã hóa bằng AWS KMS (Key Management Service) customer managed key (CMK) – một khóa do khách hàng tự quản lý.

Để ứng dụng truy cập secrets, một Kubernetes service account (SA) dành cho công cụ bên thứ ba (third-party tool) được sử dụng. SA này assumes (giả định vai trò) một IAM role mà công ty tạo ra, nhằm cấp quyền truy cập secrets từ Secrets Manager. Tuy nhiên, khi SA cố gắng retrieve (lấy) secrets, nó gặp lỗi Access Denied (403 Forbidden).

Vấn đề cốt lõi (root cause) cần xác định là lý do gốc rễ gây ra lỗi 403 này. Lưu ý:

  • EKS hỗ trợ IAM Roles for Service Accounts (IRSA), cho phép SA trong pod assume IAM role mà không cần lưu credentials trên cluster.
  • Secrets Manager yêu cầu quyền IAM trên resource secretsmanager:GetSecretValue.
  • Với CMK trong KMS, ngoài IAM policy, key policy (chính sách khóa) phải explicitly allow principal (như IAM role) thực hiện các action như kms:Decrypt để giải mã secrets. Đây là yêu cầu bắt buộc theo best practice AWS (cập nhật đến 2026, theo AWS Well-Architected Framework).

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

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

Đáp án đúng: The key policy for the customer managed key does not allow the Kubernetes service account IAM role to use the key.

Lý do:

  • Khi retrieve secrets từ Secrets Manager được mã hóa bằng CMK, IAM role (mà SA assumes) cần quyền kms:Decrypt trong IAM policy VÀ phải được key policy của CMK explicitly cho phép (allow principal là IAM role đó thực hiện kms:Decrypt, kms:DescribeKey, v.v.).
  • Lỗi 403 chính xác chỉ ra vấn đề giải mã KMS thất bại, do key policy không grant quyền cho IAM role của SA. Đây là root cause phổ biến nhất trong setup IRSA + Secrets Manager + KMS CMK (xác nhận qua AWS troubleshooting guides cập nhật 2026).
  • Nếu chỉ thiếu IAM policy trên Secrets Manager, lỗi sẽ là khác (như 400), nhưng 403 thường liên quan KMS key policy.

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

  • ❌ [SAI] The IAM role that is attached to the EKS cluster does not have access to retrieve the secrets from Secrets Manager.
    Phương án này sai vì IAM role gắn với EKS cluster (cluster IAM role) chỉ dùng cho control plane operations (như API server calls đến AWS services). Nó không liên quan đến việc SA trong pod assume role khác để retrieve secrets. SA sử dụng IRSA độc lập, không phụ thuộc cluster role cho access Secrets Manager.

  • ✅ [ĐÚNG] The key policy for the customer managed key does not allow the Kubernetes service account IAM role to use the key.
    Như đã giải thích ở trên: Key policy của CMK bắt buộc phải allow IAM role (của SA) để kms:Decrypt. Thiếu điều này dẫn đến 403 ngay cả khi IAM policy đúng. Đây là root cause chính xác, phù hợp với AWS security model (symmetric/asymmetric keys trong KMS).

  • ❌ [SAI] The key policy for the customer managed key does not allow the EKS cluster IAM role to use the key.
    Phương án này sai tương tự lựa chọn đầu: EKS cluster IAM role không tham gia vào việc SA retrieve secrets. Key policy chỉ cần allow IAM role cụ thể mà SA assumes, không phải cluster role. Cluster role chỉ xử lý cluster-level permissions.

  • ❌ [SAI] The IAM role that is assumed by the Kubernetes service account does not have permission to access the EKS cluster.
    Phương án này sai vì lỗi xảy ra khi retrieve secrets từ Secrets Manager, không phải access EKS cluster. IRSA đã cấu hình SA assume IAM role thành công (nếu không, lỗi sẽ là STS assume role failure). Vấn đề là quyền trên Secrets Manager/KMS sau khi assume role, không liên quan đến "access EKS cluster".

🧩 Tóm tắt troubleshooting steps khuyến nghị: Kiểm tra key policy của CMK → Add allow statement cho IAM role ARN của SA → Test với aws secretsmanager get-secret-value sử dụng role đó. Nếu cần hỗ trợ thêm, dùng AWS IAM Access Analyzer! 🚀

Câu 500
A company is migrating its product development teams from an on-premises data center to a hybrid environment. The new environment will add four AWS Regions and will give the developers the ability to use the Region that is geographically closest to them.

All the development teams use a shared set of Linux applications. The on-premises data center stores the applications on a NetApp ONTAP storage device. The storage volume is mounted read-only on the development on-premises VMs. The company updates the applications on the shared volume once a week.

A DevOps engineer needs to replicate the data to all the new Regions. The DevOps engineer must ensure that the data is always up to date with deduplication. The data also must not be dependent on the availability of the on-premises storage device.

Which solution will meet these requirements?
  1. A Create an Amazon S3 File Gateway in the on-premises data center. Create S3 buckets in each Region. Set up a cron job to copy the data from the storage device to the S3 File Gateway. Set up S3 Cross-Region Replication (CRR) to the S3 buckets in each Region.
  2. B Create an Amazon FSx File Gateway in one Region. Create file servers in Amazon FSx for Windows File Server in each Region. Set up a cron job to copy the data from the storage device to the FSx File Gateway.
  3. C Create Multi-AZ Amazon FSx for NetApp ONTAP instances and volumes in each Region. Configure a scheduled SnapMirror relationship between the on-premises storage device and the FSx for ONTAP instances.
  4. D Create an Amazon Elastic File System (Amazon EFS) file system in each Region. Deploy an AWS DataSync agent in the on-premises data center. Configure a schedule for DataSync to copy the data to Amazon EFS daily.
Xem giải thích

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

Câu hỏi mô tả một công ty đang di chuyển các đội ngũ phát triển sản phẩm từ data center on-premises sang môi trường hybrid với 4 Regions AWS mới. Các đội ngũ sử dụng chung một bộ ứng dụng Linux, lưu trữ trên thiết bị NetApp ONTAP (volume mounted read-only trên các VM on-premises). Ứng dụng được cập nhật một lần/tuần.

📋 Yêu cầu chính của DevOps engineer:

  • Replicate dữ liệu đến tất cả 4 Regions (developers chọn Region gần nhất).
  • Dữ liệu luôn up-to-date (đồng bộ kịp thời với cập nhật hàng tuần).
  • Hỗ trợ deduplication (loại bỏ dữ liệu trùng lặp để tiết kiệm lưu trữ).
  • Không phụ thuộc vào availability của on-premises storage (dữ liệu phải độc lập, có thể hoạt động ngay cả khi on-prem down).

🛠️ Thách thức kỹ thuật: NetApp ONTAP là file system doanh nghiệp hỗ trợ NFS/SMB với tính năng nâng cao như SnapMirror (replication), deduplication. Giải pháp phải tương thích native với ONTAP để đồng bộ hiệu quả, hỗ trợ Multi-AZ cho HA, và đảm bảo dữ liệu độc lập sau replicate.

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

Đáp án đúng: Create Multi-AZ Amazon FSx for NetApp ONTAP instances and volumes in each Region. Configure a scheduled SnapMirror relationship between the on-premises storage device and the FSx for ONTAP instances.

Lý do chọn:

  • Amazon FSx for NetApp ONTAP là dịch vụ managed hoàn toàn tương thích với ONTAP on-premises, hỗ trợ NFS/SMB protocols cho Linux apps, deduplication native (tính năng ONTAP), và Multi-AZ cho high availability ở mỗi Region.
  • SnapMirror là protocol replication native của NetApp, cho phép scheduled sync (hàng tuần) từ on-prem sang FSx ONTAP ở tất cả 4 Regions. Sau sync, volumes FSx hoàn toàn độc lập (không phụ thuộc on-prem).
  • Đảm bảo up-to-date với lịch snapmirror, dedup tự động, và developers mount FSx volumes ở Region gần nhất như on-prem.
  • ✅ Hoàn hảo match yêu cầu, hiệu suất cao, chi phí tối ưu (theo AWS Well-Architected Framework).

📝 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 (giữ nguyên văn bản gốc bằng tiếng Anh). Tôi đánh dấu ✅ đúng hoặc ❌ sai, kèm lý do chi tiết bằng tiếng Việt.

  • ❌ [SAI] Create an Amazon S3 File Gateway in the on-premises data center. Create S3 buckets in each Region. Set up a cron job to copy the data from the storage device to the S3 File Gateway. Set up S3 Cross-Region Replication (CRR) to the S3 buckets in each Region.

    • ❌ Không đáp ứng: S3 File Gateway dùng cho file sharing qua NFS/SMB đến S3 object storage, nhưng không hỗ trợ deduplication native như ONTAP (S3 có lifecycle nhưng không dedup block-level). Cron job + CRR là manual sync không native, chậm và không đảm bảo up-to-date realtime. Dữ liệu vẫn phụ thuộc on-prem qua gateway, và S3 không phải file system mounted read-only cho Linux apps hiệu quả (overhead cao).
  • ❌ [SAI] Create an Amazon FSx File Gateway in one Region. Create file servers in Amazon FSx for Windows File Server in each Region. Set up a cron job to copy the data from the storage device to the FSx File Gateway.

    • ❌ Không đáp ứng: FSx File Gateway cache files từ on-prem đến S3/FSx, nhưng chỉ ở một Region (không replicate tự động đến 4 Regions). FSx for Windows là SMB-focused (không lý tưởng cho Linux NFS), cron job không native với ONTAP, thiếu deduplication và Multi-AZ full. Dữ liệu phụ thuộc gateway và on-prem availability.
  • ✅ [ĐÚNG] Create Multi-AZ Amazon FSx for NetApp ONTAP instances and volumes in each Region. Configure a scheduled SnapMirror relationship between the on-premises storage device and the FSx for ONTAP instances.

    • ✅ Đúng hoàn toàn: FSx ONTAP tương thích 100% với NetApp on-prem, SnapMirror native replication (scheduled, efficient, dedup-aware) đến từng Region. Multi-AZ đảm bảo HA, volumes độc lập sau sync (không cần on-prem). Hỗ trợ Linux NFS read-only, up-to-date hàng tuần.
  • ❌ [SAI] Create an Amazon Elastic File System (Amazon EFS) file system in each Region. Deploy an AWS DataSync agent in the on-premises data center. Configure a schedule for DataSync to copy the data to Amazon EFS daily.

    • ❌ Không đáp ứng: EFS là NFS managed cho Linux, nhưng DataSync chỉ copy file-level hàng ngày (không realtime, không SnapMirror native), không hỗ trợ deduplication (EFS không có dedup như ONTAP). Sync daily chậm hơn weekly update, và nếu on-prem down giữa sync, dữ liệu không up-to-date. Không hiệu quả cho shared read-only volumes lớn.

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

  • AWS FSx for NetApp ONTAP Docs: Amazon FSx for NetApp ONTAP – Chi tiết SnapMirror replication từ on-prem.
  • SnapMirror Integration: Replicate data with SnapMirror (hỗ trợ scheduled, dedup, Multi-AZ).
  • AWS DataSync & EFS Limitations: DataSync with EFS – Xác nhận không dedup native.
  • AWS Well-Architected DevOps Pillar: Nhấn mạnh native replication cho hybrid (Storage Lens 2025+ updates).
  • NetApp AWS Partnership: NetApp on AWS – Certified cho ONTAP hybrid đến 2026.

🛠️ Khuyến nghị bổ sung: Sau implement, monitor với CloudWatch + FSx metrics, và test failover để đảm bảo zero-downtime!