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

Tìm thấy 681 câu.

Câu 601
A company runs several applications in the same AWS account. The applications send logs to Amazon CloudWatch.

A data analytics team needs to collect performance metrics and custom metrics from the applications. The analytics team needs to transform the metrics data before storing the data in an Amazon S3 bucket. The analytics team must automatically collect any new metrics that are added to the CloudWatch namespace.

Which solution will meet these requirements with the LEAST operational overhead?
  1. A Configure a CloudWatch metric stream to include metrics from the application and the CloudWatch namespace. Configure the metric stream to deliver the metrics to an Amazon Data Firehose delivery stream. Configure the Firehose delivery stream to invoke an AWS Lambda function to transform the data. Configure the delivery stream to send the transformed data to the S3 bucket.
  2. B Configure a CloudWatch metrics stream to include all the metrics and to deliver the metrics to an Amazon Data Firehose delivery stream. Configure the Firehose delivery stream to invoke an AWS Lambda function to transform the data. Configure the delivery stream to send the transformed data to the S3 bucket.
  3. C Configure metric filters for the CloudWatch logs to create custom metrics. Configure a CloudWatch metric stream to deliver the application metrics to the S3 bucket.
  4. D Configure subscription filters on the application log groups to target an Amazon Data Firehose delivery stream. Configure the Firehose delivery stream to invoke an AWS Lambda function to transform the data. Configure the delivery stream to send the transformed data to the S3 bucket.
Xem giải thích

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

Câu hỏi tập trung vào việc thiết kế giải pháp thu thập và xử lý metrics (bao gồm performance metrics và custom metrics) từ các ứng dụng chạy trên cùng một AWS account, với logs được gửi đến Amazon CloudWatch.

  • Yêu cầu chính:

    • Team data analytics cần thu thập metrics (không phải logs), transform dữ liệu metrics trước khi lưu vào Amazon S3.
    • Tự động thu thập bất kỳ metrics mới nào được thêm vào CloudWatch namespace (không cần cấu hình thủ công cho từng metrics mới).
    • Giải pháp phải có LEAST operational overhead (ít công vận hành nhất, tức là tự động hóa cao, không cần quản lý thủ công nhiều).
  • Bối cảnh AWS cập nhật 2026: CloudWatch hỗ trợ Metric Streams (ra mắt 2020, cải tiến liên tục) để stream real-time tất cả metrics từ một hoặc nhiều namespaces một cách tự động. Kết hợp với Amazon Kinesis Data Firehose (nay gọi là Amazon Data Firehose) để transform qua Lambda và lưu S3. Đây là cách chuẩn, serverless, scale tự động theo phiên bản mới nhất (CloudWatch Metric Streams v2 hỗ trợ filtering linh hoạt hơn).

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

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

Đáp án đúng: Configure a CloudWatch metrics stream to include all the metrics and to deliver the metrics to an Amazon Data Firehose delivery stream. Configure the Firehose delivery stream to invoke an AWS Lambda function to transform the data. Configure the delivery stream to send the transformed data to the S3 bucket.

Lý do 🛠️:

  • CloudWatch Metric Streams stream tất cả metrics (performance + custom) từ namespace một cách tự động, bao gồm metrics mới mà không cần config thêm (least overhead).
  • Data Firehose nhận stream, invoke Lambda để transform, rồi lưu S3 – hoàn toàn serverless, scale auto.
  • Phù hợp least operational overhead vì chỉ config stream một lần cho toàn bộ namespace, không cần quản lý từng metric/logs group.

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

  • ❌ Phương án SAI: Configure a CloudWatch metric stream to include metrics from the application and the CloudWatch namespace. Configure the metric stream to deliver the metrics to an Amazon Data Firehose delivery stream. Configure the Firehose delivery stream to invoke an AWS Lambda function to transform the data. Configure the delivery stream to send the transformed data to the S3 bucket.

    • Giải thích: Phương án này chỉ định "metrics from the application and the CloudWatch namespace" – không rõ ràng và có thể yêu cầu config riêng cho từng application, dẫn đến overhead cao (phải quản lý filter cho nhiều app). Không đảm bảo "all metrics" tự động như yêu cầu. Gần đúng nhưng thiếu tính tổng quát.
  • ✅ Phương án ĐÚNG (như đã phân tích ở trên): Configure a CloudWatch metrics stream to include all the metrics and to deliver the metrics to an Amazon Data Firehose delivery stream. Configure the Firehose delivery stream to invoke an AWS Lambda function to transform the data. Configure the delivery stream to send the transformed data to the S3 bucket.

    • Giải thích: Hoàn hảo khớp yêu cầu: "include all the metrics" → tự động collect new metrics, transform qua Lambda + Firehose → S3, least overhead (serverless end-to-end).
  • ❌ Phương án SAI: Configure metric filters for the CloudWatch logs to create custom metrics. Configure a CloudWatch metric stream to deliver the application metrics to the S3 bucket.

    • Giải thích: Metric filters chỉ extract custom metrics từ logs (không phải metrics gốc), không thu thập performance/custom metrics sẵn có. Metric stream không hỗ trợ deliver trực tiếp đến S3 (phải qua Kinesis/Firehose), và không có transform. Overhead cao vì phải config filter cho từng log pattern.
  • ❌ Phương án SAI: Configure subscription filters on the application log groups to target an Amazon Data Firehose delivery stream. Configure the Firehose delivery stream to invoke an AWS Lambda function to transform the data. Configure the delivery stream to send the transformed data to the S3 bucket.

    • Giải thích: Subscription filters chỉ áp dụng cho logs (CloudWatch Logs Insights/Subscriptions), không phải metrics. Câu hỏi cần metrics từ CloudWatch namespace, không phải logs. Dù có transform, vẫn sai nguồn dữ liệu và không tự động cho metrics mới.

Kết luận 🎯: Giải pháp đúng tận dụng Metric Streams – tính năng tối ưu cho streaming metrics real-time với zero-config cho new metrics, phù hợp DevOps best practices!

Câu 602
A company uses an HPC platform to run analysis jobs for data. The company uses AWS CodeBuild to create container images and store the images on Amazon Elastic Container Registry (Amazon ECR). The images are then deployed on Amazon Elastic Kubernetes Service (Amazon EKS).

To maintain compliance, the company needs to ensure that the images are signed before the images are deployed on Amazon EKS. The signing keys must be rotated periodically and must be managed automatically. The company needs to track who generates the signatures.

Which solution will meet these requirements with the LEAST operational effort?
  1. A Use CodeBuild to retrieve the image that was previously pushed to Amazon ECR. Use AWS Signer to sign the image. Use AWS CloudTrail to track who generates the signatures.
  2. B Use AWS Lambda to retrieve the image that was previously pushed to Amazon ECR. Use a Lambda function to sign the image. Use Amazon CloudWatch to track who generates the signatures.
  3. C Use AWS Lambda to retrieve the image that was previously pushed to Amazon ECR. Use AWS Signer to sign the image. Use Amazon CloudWatch to track who generates the signatures.
  4. D Use CodeBuild to build the image. Sign the image by using AWS Signer before pushing the image to Amazon ECR. Use AWS CloudTrail to track who generates the signatures.
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 quy trình DevOps cho HPC (High-Performance Computing) platform trên AWS, nơi công ty sử dụng AWS CodeBuild để build container images, lưu trữ trên Amazon ECR (Elastic Container Registry), và triển khai lên Amazon EKS (Elastic Kubernetes Service).

📌 Yêu cầu chính cần đáp ứng:

  • Đảm bảo images được ký (signed) trước khi deploy lên EKS để tuân thủ compliance.
  • Signing keys phải được rotate định kỳ và managed tự động (không cần can thiệp thủ công).
  • Theo dõi (track) ai là người tạo signatures (audit trail).
  • Giải pháp với LEAST operational effort (ít nỗ lực vận hành nhất, tức tích hợp tự động vào pipeline hiện tại).

🛠️ Bối cảnh kỹ thuật: AWS Signer là dịch vụ chuyên ký mã (code signing) cho container images, hỗ trợ tích hợp trực tiếp với CodeBuild, ECR và EKS. Nó tự động quản lý key rotation qua AWS KMS (Key Management Service). AWS CloudTrail ghi log tất cả API calls để track user/roles thực hiện signing.

✅ Đáp án đúng: Use CodeBuild to build the image. Sign the image by using AWS Signer before pushing the image to Amazon ECR. Use AWS CloudTrail to track who generates the signatures.

Lý do lựa chọn:

  • ✅ Tích hợp liền mạch vào pipeline CodeBuild hiện tại: Build image → Sign bằng AWS Signer trước khi push lên ECR → Deploy lên EKS. Điều này đảm bảo image đã signed before deployed, giảm thiểu rủi ro và effort (không cần retrieve lại image).
  • ✅ AWS Signer tự động quản lý key rotation: Sử dụng signing profiles liên kết với KMS keys, rotate tự động theo policy AWS-managed.
  • ✅ CloudTrail track chính xác: Ghi log sự kiện StartSigningJob hoặc PutContainerImageSigningCertificate, bao gồm principalId (user/role/IAM) thực hiện signing.
  • ✅ LEAST effort: Không thêm Lambda hay step retrieve, tận dụng CodeBuild natively hỗ trợ Signer qua signer:signImage action trong buildspec.yaml (tính năng ổn định từ 2023, cập nhật 2026 vẫn giữ nguyên).

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

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

  • ❌ Phương án SAI 1: Use CodeBuild to retrieve the image that was previously pushed to Amazon ECR. Use AWS Signer to sign the image. Use AWS CloudTrail to track who generates the signatures.
    Giải thích sai: Phương án này yêu cầu retrieve image đã push trước (sử dụng docker pull hoặc ECR API), rồi mới sign → Tăng operational effort cao (thêm step riêng sau build, có thể fail nếu image lớn HPC). Không "before pushing" nên vi phạm "sign before deployed" mượt mà. Dù dùng Signer (tốt cho key rotation) và CloudTrail (track tốt), nhưng không least effort vì phá vỡ pipeline linear.

  • ❌ Phương án SAI 2: Use AWS Lambda to retrieve the image that was previously pushed to Amazon ECR. Use a Lambda function to sign the image. Use Amazon CloudWatch to track who generates the signatures.
    Giải thích sai: Sử dụng Lambda custom code để sign (không dùng AWS Signer) → Không tự động rotate keys (phải tự manage KMS thủ công), rủi ro bảo mật cao. CloudWatch chỉ track metrics/logs, không track chính xác "who" (user/role) như CloudTrail. Retrieve image đã push → Effort cao, thêm Lambda trigger phức tạp (ECR event → Lambda).

  • ❌ Phương án SAI 3: Use AWS Lambda to retrieve the image that was previously pushed to Amazon ECR. Use AWS Signer to sign the image. Use Amazon CloudWatch to track who generates the signatures.
    Giải thích sai: Dù dùng Signer (tốt cho key rotation), nhưng retrieve image đã push → Effort cao tương tự SAI 1 (thêm Lambda pipeline). CloudWatch không track "who generates signatures" (chỉ logs/metrics, thiếu audit user-level). Không least effort vì tách rời khỏi CodeBuild gốc.

Kết luận: ✅ Chỉ phương án đúng tận dụng CodeBuild + Signer inline, tự động hóa toàn bộ, phù hợp best practice AWS DevOps 2026 cho EKS compliance (ECR image signing verification via EKS admission controller). 🚀

Câu 603
A company uses an AWS CodeArtifact repository to store Python packages that the company developed internally. A DevOps engineer needs to use AWS CodeDeploy to deploy an application to an Amazon EC2 instance. The application uses a Python package that is stored in the CodeArtifact repository. A BeforeInstall lifecycle event hook will install the package.

The DevOps engineer needs to grant the EC2 instance access to the CodeArtifact repository.

Which solution will meet this requirement?
  1. A Create a service-linked role for CodeArtifact. Associate the role with the EC2 instance. Use the aws codeartifact get-authorization-token CLI command on the instance.
  2. B Configure a resource-based policy for the CodeArtifact repository that allows the ReadFromRepository action for the EC2 instance principal.
  3. C Configure ACLs on the CodeArtifact repository to allow the EC2 instance to access the Python package.
  4. D Create an instance profile that contains an IAM role that has access to CodeArtifact. Associate the instance profile with the EC2 instance. Use the aws codeartifact login CLI command on the instance.
Xem giải thích

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

Câu hỏi xoay quanh việc cấp quyền truy cập cho một instance Amazon EC2 để có thể kéo (pull) và cài đặt Python package từ AWS CodeArtifact repository trong quá trình deploy ứng dụng bằng AWS CodeDeploy.

  • Bối cảnh chi tiết:
    • Công ty lưu trữ các Python package nội bộ trong CodeArtifact (dịch vụ quản lý package artifacts của AWS, tương tự Nexus hoặc Artifactory).
    • Ứng dụng được deploy lên EC2 qua CodeDeploy, và trong BeforeInstall lifecycle event hook (một script chạy trước khi install app), cần cài đặt package từ CodeArtifact.
    • Thách thức chính: EC2 instance phải xác thực (authenticate) với CodeArtifact để đọc package, vì CodeArtifact yêu cầu authorization token tạm thời để truy cập (hết hạn sau 12 giờ hoặc tùy chỉnh).
    • Yêu cầu: Giải pháp phải an toàn, tuân thủ least privilege, và phù hợp với mô hình IAM của AWS (không dùng access keys trực tiếp trên instance).

Mục tiêu là chọn cách grant access hiệu quả nhất cho EC2 mà không vi phạm best practices AWS (như sử dụng IAM roles thay vì keys tĩnh).

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

Đáp án đúng: Create an instance profile that contains an IAM role that has access to CodeArtifact. Associate the instance profile with the EC2 instance. Use the aws codeartifact login CLI command on the instance.

Lý do chọn:

  • Đây là best practice chuẩn của AWS cho EC2 access services: Sử dụng IAM role qua Instance Profile để cấp quyền tạm thời, tránh lưu credentials tĩnh.
  • IAM role cần policy cho phép codeartifact:GetAuthorizationToken (và các action liên quan như codeartifact:ReadFromRepository).
  • Lệnh aws codeartifact login --tool pip (hoặc tương tự) sẽ tự động lấy token từ metadata service của EC2 (IMDS), config cho pip để pull package.
  • Hoàn hảo cho lifecycle hook trong CodeDeploy vì script có thể chạy lệnh này trước khi pip install.
  • Cập nhật 2026: CodeArtifact vẫn giữ nguyên cơ chế này (không thay đổi lớn từ 2023-2026), hỗ trợ multi-account cross-domain.

📋 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 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 docs AWS mới nhất.

  • ❌ Create a service-linked role for CodeArtifact. Associate the role with the EC2 instance. Use the aws codeartifact get-authorization-token CLI command on the instance.

    • Sai vì: CodeArtifact không hỗ trợ service-linked roles (SLR chỉ dành cho các service như CodeDeploy, Lambda, không phải CodeArtifact). Không thể associate SLR trực tiếp với EC2. Lệnh get-authorization-token cần IAM credentials hợp lệ trước, nhưng thiếu IAM role cơ bản nên thất bại. Giải pháp này không tồn tại trong thực tế.
  • ❌ Configure a resource-based policy for the CodeArtifact repository that allows the ReadFromRepository action for the EC2 instance principal.

    • Sai vì: CodeArtifact không support resource-based policies (RBP) cho EC2 instance principals (EC2 không có "principal" trực tiếp như service principals). RBP chỉ áp dụng cho domain/repo ở mức cross-account IAM users/roles, không dành cho instances. Action ReadFromRepository không tồn tại (thực tế là codeartifact:ReadFromRepository). EC2 vẫn cần IAM role để lấy token.
  • ❌ Configure ACLs on the CodeArtifact repository to allow the EC2 instance to access the Python package.

    • Sai vì: CodeArtifact không sử dụng ACLs (Access Control Lists). Thay vào đó dùng IAM policies, resource policies trên domain/repo. ACLs là khái niệm của S3 hoặc khác, không áp dụng ở đây. Không thể grant trực tiếp cho "EC2 instance" mà không qua IAM role.
  • ✅ Create an instance profile that contains an IAM role that has access to CodeArtifact. Associate the instance profile with the EC2 instance. Use the aws codeartifact login CLI command on the instance.

    • Đúng vì: Như giải thích ở trên. Instance profile cung cấp IAM role tạm thời cho EC2 (qua IMDSv2 an toàn). Role cần policy ví dụ:
      {
        "Version": "2012-10-17",
        "Statement": [{
          "Effect": "Allow",
          "Action": ["codeartifact:GetAuthorizationToken", "codeartifact:ReadFromRepository", "sts:GetServiceBearerToken"],
          "Resource": "*"
        }]
      }
      
      Lệnh login tự động config ~/.pip/pip.conf với token. Hoạt động mượt trong CodeDeploy hooks. 🛠️ Best practice cho CI/CD và EC2.

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

Giải pháp này đảm bảo zero-trust credentials, scalable cho production! 🚀 Nếu cần ví dụ code policy chi tiết, hỏi thêm nhé!

Câu 604
A company has a file-reading application that saves files to a database that runs on Amazon EC2 instances. Regulations require the company to delete files from EC2 instances every day at a specific time. The company must delete database records that are older than 60 days.

The database record deletion must occur after the file deletions. The company has created scripts to delete files and database records. The company needs to receive an email notification for any failure of the deletion scripts.

Which solution will meet these requirements with the LEAST development effort?
  1. A Use AWS Systems Manager State Manager to automatically invoke a Systems Manager Automation document at the specified time each day. Configure the Automation document to use a run command to run the deletion scripts in sequential order. Create an Amazon EventBridge rule to use Amazon Simple Notification Service (Amazon SNS) to send failure notifications to the company.
  2. B Use AWS Systems Manager State Manager to automatically invoke a Systems Manager Automation document at the specified time each day. Configure the Automation document to use a run command to run the deletion scripts in sequential order. Create a conditional statement inside the Automation document as the last step to check for errors. Use Amazon Simple Email Service (Amazon SES) to send failure notifications as email messages to the company.
  3. C Create an Amazon EventBridge rule that invokes an AWS Lambda function at the specified time. Add the necessary permissions for the invocation to the Lambda function's resource-based policy. Configure the Lambda function to run the deletion scripts in sequential order. Configure the Lambda function to use Amazon Simple Notification Service (Amazon SNS) to send failure notifications to the company.
  4. D Create an Amazon EventBridge rule that invokes an AWS Lambda function at the specified time. Add the necessary permissions for the invocation to the Lambda function's resource-based policy. Configure the Lambda function to run the deletion scripts in sequential order. Configure the Lambda function to use Amazon Simple Email Service (Amazon SES) to send failure notifications as email messages to the company.
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 có ứng dụng đọc file và lưu trữ vào cơ sở dữ liệu (database) chạy trên các instance Amazon EC2. Các yêu cầu quy định nghiêm ngặt bao gồm:

  • 📅 Xóa file khỏi EC2 instances mỗi ngày vào một thời điểm cụ thể.
  • 🗑️ Xóa các bản ghi database cũ hơn 60 ngày, và phải thực hiện sau khi xóa file (tức là thứ tự sequential: xóa file trước, xóa DB sau).
  • Công ty đã có sẵn script để xóa file và bản ghi DB.
  • 📧 Gửi email thông báo nếu bất kỳ script nào thất bại (failure notification).
  • Mục tiêu chính: Giải pháp với LEAST development effort (ít nỗ lực phát triển nhất), nghĩa là ưu tiên các dịch vụ AWS managed, tự động hóa cao, không cần code phức tạp.

🛠️ Yêu cầu kỹ thuật cốt lõi: Lập lịch hàng ngày, chạy script sequential trên EC2, xử lý lỗi và notify qua email, tận dụng script sẵn có để giảm effort.

✅ Đáp án đúng: Lựa chọn đầu tiên (A)

Use AWS Systems Manager State Manager to automatically invoke a Systems Manager Automation document at the specified time each day. Configure the Automation document to use a run command to run the deletion scripts in sequential order. Create an Amazon EventBridge rule to use Amazon Simple Notification Service (Amazon SNS) to send failure notifications to the company.

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

  • 🚀 SSM State Manager là dịch vụ managed hoàn hảo cho việc quản lý trạng thái và chạy periodic tasks trên fleet EC2 với cron schedule native (không cần code thêm). Nó tự động invoke SSM Automation document vào thời gian chỉ định hàng ngày.
  • 📜 Automation document hỗ trợ run command để thực thi script sequential (xóa file trước, xóa DB sau) trực tiếp trên EC2 qua SSM Run Command – tận dụng script sẵn có, zero code dev.
  • 🔔 EventBridge rule monitor events failure từ SSM Automation (như ExecutionFailed), trigger SNS topic với email subscription – đơn giản, managed, LEAST effort cho notify (SNS hỗ trợ email out-of-box).
  • 💡 Đây là giải pháp native AWS DevOps, cập nhật đến 2024-2026: SSM State Manager tích hợp sâu EventBridge cho error handling (không cần custom logic).

Tài liệu tham khảo:

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

  • Phương án A (Đúng ✅):
    Use AWS Systems Manager State Manager to automatically invoke a Systems Manager Automation document at the specified time each day. Configure the Automation document to use a run command to run the deletion scripts in sequential order. Create an Amazon EventBridge rule to use Amazon Simple Notification Service (Amazon SNS) to send failure notifications to the company.
    🟢 Đúng vì: Giải pháp managed hoàn toàn, không code Lambda hay logic custom. SSM xử lý sequential scripts native, EventBridge + SNS notify failure tự động với effort thấp nhất. Phù hợp LEAST development.

  • Phương án B (Sai ❌):
    Use AWS Systems Manager State Manager to automatically invoke a Systems Manager Automation document at the specified time each day. Configure the Automation document to use a run command to run the deletion scripts in sequential order. Create a conditional statement inside the Automation document as the last step to check for errors. Use Amazon Simple Email Service (Amazon SES) to send failure notifications as email messages to the company.
    🔴 Sai vì: Dù dùng SSM tương tự A, nhưng yêu cầu conditional statement custom trong Automation document (phát triển YAML/JSON logic kiểm tra lỗi) và SES (cần verify domain, template code, IAM phức tạp hơn SNS). Tăng effort dev so với EventBridge + SNS native.

  • Phương án C (Sai ❌):
    Create an Amazon EventBridge rule that invokes an AWS Lambda function at the specified time. Add the necessary permissions for the invocation to the Lambda function's resource-based policy. Configure the Lambda function to run the deletion scripts in sequential order. Configure the Lambda function to use Amazon Simple Notification Service (Amazon SNS) to send failure try-catch notifications to the company.
    🔴 Sai vì: Lambda phải code custom (Python/Node.js) để gọi SSM Run Command chạy script sequential trên EC2 (thêm IAM, error handling, sequential logic). Cần resource-based policy cho EventBridge invoke. Effort dev cao hơn SSM State Manager native (viết function ~50-100 lines code).

  • Phương án D (Sai ❌):
    Create an Amazon EventBridge rule that invokes an AWS Lambda function at the specified time. Add the necessary permissions for the invocation to the Lambda function's resource-based policy. Configure the Lambda function to run the deletion scripts in sequential order. Configure the Lambda function to use Amazon Simple Email Service (Amazon SES) to send failure notifications as email messages to the company.
    🔴 Sai vì: Tương tự C, nhưng dùng SES thay SNS – SES yêu cầu code gửi email (SDK calls, verification), effort còn cao hơn. Không tận dụng managed scheduler như SSM State Manager.

🏆 Kết luận

Giải pháp A là optimal cho DevOps Professional với zero-to-low code, scale tự động trên EC2 fleet, và tuân thủ best practices AWS Well-Architected Framework (Reliability & Operations pillar). Nếu implement thực tế, test Automation document trước khi deploy! 🎯

Câu 605
A company uses an organization in AWS Organizations that has all features enabled to manage its AWS accounts. Amazon EQ instances run in the AWS accounts.

The company requires that all current EC2 instances must use Instance Metadata Service Version 2 (IMDSv2). The company needs to block AWS API calls that originate from EC2 instances that do not use IMDSv2.

Which solution will meet these requirements?
  1. A Create a new SCP statement that denies the ec2:RunInstances action when the ec2:MetadataHttpTokens condition key is not equal to the value of required. Attach the SCP to the root of the organization.
  2. B Create a new SCP statement that denies the ec2:RunInstances action when the ec2:MetadataHttpPutResponseHopLimit condition key value is greater than two. Attach the SCP to the root of the organization.
  3. C Create a new SCP statement that denies "*" when the ec2:RoleDelivery condition key value is less than two. Attach the SCP to the root of the organization.
  4. D Create a new SCP statement that denies when the ec2:MetadataHttpTokens condition key value is not equal to required. Attach the SCP to the root of the organization.
Xem giải thích

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

📘 Nội dung câu hỏi:
Câu hỏi xoay quanh việc quản lý bảo mật EC2 instances trong AWS Organizations (với tất cả tính năng được kích hoạt). Công ty đang chạy các EC2 instances trong nhiều AWS accounts thuộc organization. Yêu cầu cụ thể là:

  • Buộc tất cả EC2 instances hiện tại phải sử dụng Instance Metadata Service Version 2 (IMDSv2) – IMDSv2 là phiên bản bảo mật hơn của Instance Metadata Service (IMDS), yêu cầu session token (HTTP PUT) thay vì IMDSv1 (HTTP GET không token), giúp chống SSRF attacks.
  • Chặn tất cả AWS API calls (gọi API từ các EC2 instances không dùng IMDSv2).
    Giải pháp phải sử dụng Service Control Policy (SCP) để enforce toàn organization, vì SCP áp dụng cho root/OU/accounts mà không ảnh hưởng đến IAM policies cá nhân. Điều này đảm bảo instances cũ (không cấu hình IMDSv2) không thể gọi API AWS nữa, buộc phải nâng cấp lên IMDSv2.
    (Kiến thức cập nhật 2026: AWS tiếp tục khuyến nghị IMDSv2 làm mặc định từ 2022, và SCP là cách chuẩn để enforce tại organization level – không thay đổi lớn trong DOP-C02 exam blueprint).

✅ Đáp án đúng:

Create a new SCP statement that denies when the ec2:MetadataHttpTokens condition key value is not equal to required. Attach the SCP to the root of the organization.

🛠️ Lý do chọn đáp án này:
SCP này sử dụng condition key ec2:MetadataHttpTokens (giá trị phải là "required" để cho phép IMDSv2). Nếu instance gọi AWS API mà không dùng token (IMDSv1), AWS sẽ detect và deny toàn bộ actions (* ngầm định). Attach vào root OU đảm bảo áp dụng cho tất cả accounts/instances hiện tại. Đây là cách chính xác để block API calls từ instances không tuân thủ IMDSv2, theo best practice AWS.
📚 Tài liệu tham khảo:

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

  • ❌ Phương án 1: Create a new SCP statement that denies the ec2:RunInstances action when the ec2:MetadataHttpTokens condition key is not equal to the value of required. Attach the SCP to the root of the organization.
    Phương án này chỉ deny action ec2:RunInstances (chỉ chặn tạo instances mới không hỗ trợ IMDSv2). Nó không block AWS API calls từ instances hiện tại (như sts:AssumeRole, s3:GetObject,...), nên không đáp ứng yêu cầu "block AWS API calls that originate from EC2 instances that do not use IMDSv2". SCP chỉ giới hạn scope quá hẹp.

  • ❌ Phương án 2: Create a new SCP statement that denies the ec2:RunInstances action when the ec2:MetadataHttpPutResponseHopLimit condition key value is greater than two. Attach the SCP to the root of the organization.
    Condition key ec2:MetadataHttpPutResponseHopLimit kiểm soát hop limit cho IMDS responses (mặc định 2, tránh proxy attacks). Phương án dùng sai ngữ cảnh: chỉ deny ec2:RunInstances với hop limit >2 (không liên quan IMDSv2 trực tiếp), và vẫn không block API calls từ instances hiện tại. Đây là condition cho network security, không phải enforce IMDSv2.

  • ❌ Phương án 3: Create a new SCP statement that denies "*" when the ec2:RoleDelivery condition key value is less than two. Attach the SCP to the root of the organization.
    Condition key ec2:RoleDelivery liên quan đến cách deliver instance profile credentials (1=PutRoleDocument, 2=GetRoleCredential). Giá trị <2 chỉ chặn kiểu deliver cũ, không liên quan đến IMDSv2 hay metadata tokens. Deny * là đúng scope, nhưng condition sai hoàn toàn, sẽ block nhầm instances hợp lệ và không enforce IMDSv2.

  • ✅ Phương án 4: Create a new SCP statement that denies when the ec2:MetadataHttpTokens condition key value is not equal to required. Attach the SCP to the root of the organization.
    Hoàn hảo khớp yêu cầu: Deny (ngầm *) nếu ec2:MetadataHttpTokens != "required", block mọi API calls từ IMDSv1. Root attach enforce toàn organization, ảnh hưởng ngay instances hiện tại. Đây là SCP mẫu chuẩn AWS cho DOP-C02.

💡 Lưu ý thêm: SCP không ảnh hưởng IAM users/roles ngoài EC2, chỉ check khi gọi API qua instance metadata. Test bằng curl IMDS endpoint để verify!

Câu 606 Chọn nhiều đáp án
A DevOps team supports an application that runs on a large number of Amazon EC2 instances in an Auto Scaling group. The DevOps team uses AWS CloudFormation to deploy the EC2 instances. The application recently experienced an issue. A single instance returned errors to a large percentage of requests. The EC2 instance responded as healthy to both Amazon EC2 and Elastic Load Balancing health checks.

The DevOps team collects application logs in Amazon CloudWatch by using the embedded metric format. The DevOps team needs to receive an alert if any EC2 instance is responsible for more than half of all errors.

Which combination of steps will meet these requirements with the LEAST operational overhead? (Choose two.)
  1. A Create a CloudWatch Contributor Insights rule that groups logs from the CloudWatch application logs based on instance ID and errors.
  2. B Create a resource group in AWS Resource Groups. Use the CloudFormation stack to group the resources for the application. Add the application to CloudWatch Application Insights. Use the resource group to identify the application.
  3. C Create a metric filter for the application logs to count the occurrence of the term "Error.'' Create a CloudWatch alarm that uses the METRIC_COUNT function to determine whether errors have occurred. Configure the CloudWatch alarm to send a notification to an Amazon Simple Notification Service (Amazon SNS) topic to notify the DevOps team.
  4. D Create a CloudWatch alarm that uses the INSIGHT_RULE_METRIC function to determine whether a specific instance is responsible for more than half of all errors reported by EC2 instances. Configure the CloudWatch alarm to send a notification to an Amazon Simple Notification Service (Amazon SNS) topic to notify the DevOps team.
  5. E Create a CloudWatch subscription filter for the application logs that filters for errors and invokes an AWS Lambda function. Configure the Lambda function to send the instance ID and error and in a notification to an Amazon Simple Notification Service (Amazon SNS) topic to notify the DevOps team.
Xem giải thích

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

Câu hỏi tập trung vào một đội DevOps quản lý ứng dụng chạy trên nhiều instance Amazon EC2 trong Auto Scaling group, được triển khai bằng AWS CloudFormation. Vấn đề chính: Một instance duy nhất gây ra lỗi cho hơn nửa số request, nhưng instance này vẫn được coi là healthy bởi health check của EC2 và Elastic Load Balancing (ELB). Đội ngũ thu thập logs ứng dụng vào Amazon CloudWatch qua embedded metric format.

Yêu cầu: Thiết lập cảnh báo (alert) nếu bất kỳ instance nào chịu trách nhiệm cho hơn 50% tổng số lỗi từ tất cả EC2 instances. Giải pháp phải có operational overhead thấp nhất (least operational overhead), và chọn hai bước kết hợp.

🔍 Điểm mấu chốt:

  • Logs đã có sẵn trong CloudWatch (embedded metric format hỗ trợ metrics từ logs dễ dàng).
  • Cần phân tích logs theo instance ID để xác định "top offender" (instance gây lỗi nhiều nhất).
  • Không thể dùng health check chuẩn vì instance vẫn healthy.
  • Giải pháp phải tự động, scalable cho Auto Scaling, và ít bảo trì nhất (không custom code phức tạp).

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

Hai lựa chọn đúng là sự kết hợp hoàn hảo giữa CloudWatch Contributor Insights để phân tích logs theo nhóm (group by instance ID và errors), và CloudWatch alarm sử dụng INSIGHT_RULE_METRIC để theo dõi metric từ rule đó.

Lý do chọn:

  • Contributor Insights (ra mắt 2020, cập nhật liên tục đến 2026) tự động phân tích logs lớn, tạo top contributors (ví dụ: instance ID nào gây >50% errors) mà không cần code custom hay ETL phức tạp. Overhead thấp vì serverless, tích hợp trực tiếp logs CloudWatch.
  • Alarm với INSIGHT_RULE_METRIC (metric đặc biệt từ Contributor Insights) cho phép đặt threshold chính xác (ví dụ: Sum(Error) của top instance > 50% tổng lỗi). Gửi notify qua SNS tự động.
  • Kết hợp: Insights rule tạo metric, alarm monitor metric → Detect chính xác, least overhead (không Lambda, không filter thủ công), phù hợp Auto Scaling (dynamic instances).
  • Theo best practice AWS DevOps (2026): Sử dụng native CloudWatch analytics cho log-based monitoring.

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

Dưới đây là phân tích chi tiết từng lựa chọn, giữ nguyên văn bản gốc tiếng Anh. Tôi đánh dấu ✅ (đúng) hoặc ❌ (sai), kèm giải thích lý do bằng tiếng Việt rõ ràng.

  • ✅ Create a CloudWatch Contributor Insights rule that groups logs from the CloudWatch application logs based on instance ID and errors.
    🛠️ Đúng vì: Rule này tự động nhóm (group by) logs theo instance ID và đếm errors, tạo top-N contributors (ví dụ: instance nào chiếm >50% errors). Hỗ trợ embedded metric format, scalable cho hàng triệu logs từ Auto Scaling. Overhead thấp (serverless, no code), cập nhật 2026 với AI insights tốt hơn. Kết hợp với alarm để alert hoàn chỉnh.

  • ❌ Create a resource group in AWS Resource Groups. Use the CloudFormation stack to group the resources for the application. Add the application to CloudWatch Application Insights. Use the resource group to identify the application.
    🚫 Sai vì: Resource Groups + Application Insights chỉ nhóm tài nguyên và monitor tổng quát (CPU, perf metrics), không phân tích logs theo instance ID hay detect >50% errors cụ thể. Application Insights (cập nhật 2026) tốt cho app perf nhưng không drill-down logs chi tiết như Contributor Insights. Overhead cao hơn vì setup thủ công, không giải quyết yêu cầu chính xác.

  • ❌ Create a metric filter for the application logs to count the occurrence of the term "Error.'' Create a CloudWatch alarm that uses the METRIC_COUNT function to determine whether errors have occurred. Configure the CloudWatch alarm to send a notification to an Amazon Simple Notification Service (Amazon SNS) topic to notify the DevOps team.
    🚫 Sai vì: Metric filter chỉ đếm tổng "Error" toàn bộ logs (không group by instance ID), METRIC_COUNT chỉ check tổng lỗi có xảy ra hay không, không detect instance cụ thể >50%. Không phân biệt lỗi từ instance nào, vô dụng cho Auto Scaling lớn. Overhead thấp nhưng không meet requirement.

  • ✅ Create a CloudWatch alarm that uses the INSIGHT_RULE_METRIC function to determine whether a specific instance is responsible for more than half of all errors reported by EC2 instances. Configure the CloudWatch alarm to send a notification to an Amazon Simple Notification Service (Amazon SNS) topic to notify the DevOps team.
    🛠️ Đúng vì: INSIGHT_RULE_METRIC là metric động từ Contributor Insights rule, cho phép threshold như TopContributor(Error_by_InstanceID) > 50% TotalErrors. Tự động alert qua SNS khi instance cụ thể vượt ngưỡng. Overhead thấp nhất (native integration), hỗ trợ dynamic instances đến 2026. Phải kết hợp với Insights rule để có metric này.

  • ❌ Create a CloudWatch subscription filter for the application logs that filters for errors and invokes an AWS Lambda function. Configure the Lambda function to send the instance ID and error and in a notification to an Amazon Simple Notification Service (Amazon SNS) topic to notify the DevOps team.
    🚫 Sai vì: Subscription filter + Lambda custom code để parse instance ID và tính tỷ lệ >50%, dẫn đến operational overhead cao (quản lý Lambda, code logic phức tạp, error-prone với volume logs lớn). Không scalable tự động như Insights, vi phạm "least overhead". AWS recommend tránh custom cho analytics cơ bản.

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

  • CloudWatch Contributor Insights: AWS Docs - Contributor Insights (Hỗ trợ group by instanceId, embedded metrics; cập nhật 2025 với ML anomaly detection).
  • INSIGHT_RULE_METRIC Alarms: AWS Docs - Alarm on Contributor Insights Metrics (Ví dụ threshold top contributor >50%).
  • Best Practices DevOps: AWS Well-Architected DevOps Pillar (Khuyến nghị native CloudWatch cho log analytics, tránh custom Lambda).
  • Exam Prep DOP-C02: AWS Certified DevOps Engineer Professional (2026 blueprint nhấn mạnh CloudWatch Logs Insights/Contributor cho troubleshooting Auto Scaling).

Giải pháp này đảm bảo proactive alerting với zero custom code! 🚀 Nếu cần demo CloudFormation template, hãy cho tôi biết nhé!

Câu 607
A company is using AWS CloudFormation to perform deployments of its application environment. A deployment failed during a recent update to the existing CloudFormation stack. A DevOps engineer discovered that some resources in the stack were manually modified.

The DevOps engineer needs a solution that detects manual modification of resources and sends an alert to the DevOps lead.

Which solution will meet these requirements with the LEAST operational effort?
  1. A Create an Amazon Simple Notification Service (Amazon SNS) topic. Subscribe the DevOps lead to the topic by using an email address. Create an AWS Config managed rule that has the CLOUDFORMATION_STACK_DRIFT_DETECTION_CHECK identifier. Create an Amazon EventBridge rule that is invoked on the NON_COMPLIANT resources status. Set the SNS topic as the rule target.
  2. B Tag all CloudFormation resources with a specific tag. Create an AWS Config custom rule by using the AWS Config Rules Development Kit Library (RDKlib) that checks all resource changes that have the specific tag. Configure the custom rule to mark all the tagged resource changes as NON_COMPLIANT when the change is not performed by CloudFormation. Create an Amazon EventBridge rule that is invoked on the NON_COMPUANT resources status. Create an AWS Lambda function that sends an email message to the DevOps lead. Set the Lambda function as the rule target.
  3. C Create an Amazon Simple Notification Service (Amazon SNS) topic. Subscribe the DevOps lead to the topic by using an email address. Create an AWS Config managed rule that has the CLOUDFORMATION_STACK_DRIFT_DETECTION_CHECK identifier. Create an Amazon EventBridge rule that is invoked on the COMPLIANT resources status. Set the SNS topic as the rule target.
  4. D Create an AWS Config managed rule that has the CLOUDFORMATION_STACK_DRIFT_DETECTION_CHECK identifier. Create an Amazon EventBridge rule that is invoked on the NON_COMPLIANT resources status. Create an AWS Lambda function that sends an email message to the DevOps lead. Set the Lambda function as the rule target.
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ả tình huống:
Một công ty đang sử dụng AWS CloudFormation để triển khai môi trường ứng dụng. Trong một lần cập nhật stack gần đây, deployment thất bại vì một số tài nguyên trong stack bị thay đổi thủ công (manual modification). Kỹ sư DevOps cần giải pháp phát hiện các thay đổi thủ công này và gửi cảnh báo (alert) đến DevOps lead, với ít nỗ lực vận hành nhất (LEAST operational effort).

🛠️ Các yếu tố chính cần giải quyết:

  • Phát hiện drift (sự lệch chuẩn): CloudFormation stack drift xảy ra khi tài nguyên bị thay đổi ngoài IaC (Infrastructure as Code), ví dụ: chỉnh sửa thủ công qua Console hoặc CLI.
  • Giám sát tự động: Sử dụng dịch vụ AWS để detect và alert.
  • Yêu cầu tối ưu: Giải pháp đơn giản, ít code/custom, tận dụng managed services (như AWS Config managed rules, EventBridge, SNS).
  • Kiến thức cập nhật 2026: AWS Config rule CLOUDFORMATION_STACK_DRIFT_DETECTION_CHECK (managed rule) là cách chuẩn để detect drift detection trên CloudFormation stacks (tích hợp sẵn từ AWS re:Invent 2020 và cập nhật liên tục). EventBridge (trước là CloudWatch Events) hỗ trợ trigger trên compliance status của Config rules. SNS cho phép gửi email trực tiếp, không cần Lambda.

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


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

Đáp án đúng:
Create an Amazon Simple Notification Service (Amazon SNS) topic. Subscribe the DevOps lead to the topic by using an email address. Create an AWS Config managed rule that has the CLOUDFORMATION_STACK_DRIFT_DETECTION_CHECK identifier. Create an Amazon EventBridge rule that is invoked on the NON_COMPLIANT resources status. Set the SNS topic as the rule target.

Lý do chọn (chi tiết):
✅ Phù hợp hoàn hảo với yêu cầu: Sử dụng AWS Config managed rule CLOUDFORMATION_STACK_DRIFT_DETECTION_CHECK để tự động detect drift (thay đổi thủ công) trên stack – không cần custom code.
✅ Trigger chính xác: EventBridge rule kích hoạt khi status là NON_COMPLIANT (khi phát hiện drift).
✅ Alert đơn giản: SNS topic subscribe email DevOps lead trực tiếp làm target của EventBridge → LEAST operational effort (không code Lambda, chỉ config managed services).
✅ Tối ưu chi phí & vận hành: Managed rule + EventBridge + SNS là stack native AWS, deploy nhanh qua Console/CLI/CloudFormation.


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

  • ✅ Phương án ĐÚNG (như trên):
    Create an Amazon Simple Notification Service (Amazon SNS) topic. Subscribe the DevOps lead to the topic by using an email address. Create an AWS Config managed rule that has the CLOUDFORMATION_STACK_DRIFT_DETECTION_CHECK identifier. Create an Amazon EventBridge rule that is invoked on the NON_COMPLIANT resources status. Set the SNS topic as the rule target.
    Giải thích: Hoàn hảo vì dùng managed rule sẵn có để detect drift, trigger NON_COMPLIANT đúng logic, và SNS gửi email trực tiếp – ít nỗ lực nhất, không cần phát triển thêm.

  • ❌ Phương án SAI 1:
    Tag all CloudFormation resources with a specific tag. Create an AWS Config custom rule by using the AWS Config Rules Development Kit Library (RDKlib) that checks all resource changes that have the specific tag. Configure the custom rule to mark all the tagged resource changes as NON_COMPLIANT when the change is not performed by CloudFormation. Create an Amazon EventBridge rule that is invoked on the NON_COMPUANT resources status. Create an AWS Lambda function that sends an email message to the DevOps lead. Set the Lambda function as the rule target.
    Giải thích: ❌ Phức tạp thừa thãi! Yêu cầu tag thủ công tất cả resources, viết custom rule với RDKlib (cần code Python/Node.js, maintain), và dùng Lambda gửi email → operational effort cao, không dùng managed rule sẵn có cho drift detection.

  • ❌ Phương án SAI 2:
    Create an Amazon Simple Notification Service (Amazon SNS) topic. Subscribe the DevOps lead to the topic by using an email address. Create an AWS Config managed rule that has the CLOUDFORMATION_STACK_DRIFT_DETECTION_CHECK identifier. Create an Amazon EventBridge rule that is invoked on the COMPLIANT resources status. Set the SNS topic as the rule target.
    Giải thích: ❌ Trigger sai logic! Drift detection chỉ gửi alert khi NON_COMPLIANT (có thay đổi thủ công). Nếu trigger trên COMPLIANT (không drift), alert sẽ gửi nhầm khi stack bình thường – không detect được vấn đề.

  • ❌ Phương án SAI 3:
    Create an AWS Config managed rule that has the CLOUDFORMATION_STACK_DRIFT_DETECTION_CHECK identifier. Create an Amazon EventBridge rule that is invoked on the NON_COMPLIANT resources status. Create an AWS Lambda function that sends an email message to the DevOps lead. Set the Lambda function as the rule target.
    Giải thích: ❌ Gần đúng nhưng thừa Lambda! Detect và trigger NON_COMPLIANT tốt, nhưng dùng Lambda code gửi email thay vì SNS trực tiếp → tăng effort (viết/deploy/maintain Lambda), không phải LEAST operational effort. SNS đơn giản hơn nhiều.

💡 Lời khuyên DevOps: Triển khai ngay managed rule này để tránh drift trong production. Kết hợp CloudFormation Guard hoặc StackSets cho multi-account! 🚀

Câu 608
A DevOps engineer deployed multiple AWS accounts by using AWS Control Tower to support different business, technical, and administrative units in a company. A security team needs the DevOps engineer to automate AWS Control Tower guardrails for the company. The guardrails must be applied to all accounts in an OU of the company's organization in AWS Organizations.

The security team needs a solution that has version control and can be reviewed and rolled back if necessary. The security team will maintain the management of the solution in its OU. The security team wants to limit the type of guardrails that are allowed and allow only new guardrails that are approved by the security team.

Which solution will meet these requirements with the MOST operational efficiency?
  1. A Create individual AWS CloudFormation templates that align to a guardrail. Store the templates in an AWS CodeCommit repository. Create an AWS::ControlTower::EnableControl logical resource in the template for each OU in the organization. Configure an AWS Code Build project that an Amazon EventBridge rule will invoke for the security team's AWS CodeCommit changes.
  2. B Create individual AWS CloudFormation templates that align to a guardrail. Store the templates in an AWS CodeCommit repository. Create an AWS::ControlTower::EnableControl logical resource in the template for each account in the organization. Configure an AWS CodePipeline pipeline in the security team's account. Advise the security team to invoke the pipeline and provide these parameters when starting the pipeline.
  3. C Create individual AWS CloudFormation templates that align to a guardrail. Store the templates in an AWS CodeCommit repository. Create an AWS::ControlTower::EnableControl logical resource in the template for each OU in the organization. Configure an AWS CodePipeline pipeline in the security team's account that an Amazon EventBridge rule will invoke for the security team's CodeCommit changes.
  4. D Configure an AWS CodePipeline pipeline in the security team's account that an Amazon EventBridge rule will invoke for PutObject events to an Amazon S3 bucket. Create individual AWS CloudFormation templates that align to a guardrail. Store the templates in the S3 bucket. Create an AWS::ControlTower::EnableControl logical resource in the template for each OU in the organization.
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 tự động hóa (automate) các guardrails của AWS Control Tower trong một môi trường multi-account được triển khai bằng AWS Control Tower. Công ty có nhiều AWS accounts thuộc các đơn vị kinh doanh, kỹ thuật và quản trị khác nhau, được tổ chức trong AWS Organizations. Nhóm bảo mật (security team) yêu cầu áp dụng guardrails cho tất cả accounts trong một Organizational Unit (OU) cụ thể.

Yêu cầu chính của giải pháp:

  • ✅ Có version control (kiểm soát phiên bản) để review và rollback nếu cần.
  • ✅ Nhóm bảo mật tự quản lý (maintain) giải pháp trong OU của họ.
  • ✅ Giới hạn (limit) chỉ các guardrails được phê duyệt bởi security team.
  • ✅ Đạt operational efficiency cao nhất (MOST operational efficiency): Tức là tự động hóa tối ưu, không thủ công, dễ scale cho OU.

Bối cảnh AWS cập nhật (đến 2026): AWS Control Tower hỗ trợ AWS::ControlTower::EnabledControl resource trong CloudFormation để enable guardrails (preventive hoặc detective) cho OU hoặc account. Guardrails được quản lý qua Organizations, và automation thường dùng CI/CD với CodeCommit (Git repo), EventBridge (trigger), CodePipeline (orchestration deployment).

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

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

Đáp án đúng:
Create individual AWS CloudFormation templates that align to a guardrail. Store the templates in an AWS CodeCommit repository. Create an AWS::ControlTower::EnableControl logical resource in the template for each OU in the organization. Configure an AWS CodePipeline pipeline in the security team's account that an Amazon EventBridge rule will invoke for the security team's CodeCommit changes.

Lý do chọn (chi tiết):
🛠️ Giải pháp này đạt operational efficiency cao nhất vì:

  • Version control hoàn hảo với CodeCommit (Git repo) để lưu templates riêng cho từng guardrail → dễ review, approve, rollback.
  • Tự động hóa full CI/CD: EventBridge rule trigger CodePipeline khi có thay đổi CodeCommit → deploy tự động AWS::ControlTower::EnabledControl cho OU (không phải từng account, scale tốt).
  • Security team control: Pipeline nằm trong account của họ, chỉ approve guardrails mới → limit loại guardrails.
  • Hỗ trợ multi-OU nếu cần, và Control Tower 2026 vẫn dùng resource này cho guardrails OU-level.

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

  • Phương án 1 (SAI):
    Create individual AWS CloudFormation templates that align to a guardrail. Store the templates in an AWS CodeCommit repository. Create an AWS::ControlTower::EnableControl logical resource in the template for each OU in the organization. Configure an AWS Code Build project that an Amazon EventBridge rule will invoke for the security team's AWS CodeCommit changes.
    ❌ Sai vì: CodeBuild chỉ là build tool đơn lẻ, không phải pipeline orchestration đầy đủ (không có stages approve/review tự động như CodePipeline). Không đạt "MOST operational efficiency" vì thiếu deployment pipeline chuẩn cho CFN stack (rollback kém, không scale tốt). CodePipeline mới là best practice cho IaC automation trong AWS DevOps (Well-Architected).

  • Phương án 2 (SAI):
    Create individual AWS CloudFormation templates that align to a guardrail. Store the templates in an AWS CodeCommit repository. Create an AWS::ControlTower::EnableControl logical resource in the template for each account in the organization. Configure an AWS CodePipeline pipeline in the security team's account. Advise the security team to invoke the pipeline and provide these parameters when starting the pipeline.
    ❌ Sai vì: EnableControl cho từng account thay vì OU → kém efficient (phải duplicate templates/parameters cho hàng trăm accounts). Manual invoke pipeline → không tự động (vi phạm automate & efficiency). Không phù hợp scale OU lớn.

  • Phương án 3 (ĐÚNG):
    Create individual AWS CloudFormation templates that align to a guardrail. Store the templates in an AWS CodeCommit repository. Create an AWS::ControlTower::EnableControl logical resource in the template for each OU in the organization. Configure an AWS CodePipeline pipeline in the security team's account that an Amazon EventBridge rule will invoke for the security team's CodeCommit changes.
    ✅ Đúng vì: Như giải thích ở trên – full automation CI/CD với CodeCommit + EventBridge + CodePipeline, apply OU-level, version control, security-managed. Đây là pattern chính thức AWS cho Control Tower guardrails (2026).

  • Phương án 4 (SAI):
    Configure an AWS CodePipeline pipeline in the security team's account that an Amazon EventBridge rule will invoke for PutObject events to an Amazon S3 bucket. Create individual AWS CloudFormation templates that align to a guardrail. Store the templates in the S3 bucket. Create an AWS::ControlTower::EnableControl logical resource in the template for each OU in the organization.
    ❌ Sai vì: S3 bucket không có version control Git-like (chỉ object versioning cơ bản, khó review/rollback/merge như CodeCommit). Trigger trên PutObject → dễ lỗi (không track changes chi tiết), không hỗ trợ approve workflow. AWS khuyến nghị Git (CodeCommit) cho IaC, không phải S3 thuần.

Kết luận 🎯: Giải pháp đúng tận dụng Infrastructure as Code (IaC) với CI/CD pipeline tự động, phù hợp AWS best practices cho multi-account governance đến 2026!

Câu 609
A company runs a web application on Amazon Elastic Kubernetes Service (Amazon EKS). The company uses Amazon CloudFront to distribute the application. The company recently enabled AWS WAF. The company set up Amazon CloudWatch Logs to send logs to an aws-waf-logs log group.

The company wants a DevOps engineer to receive alerts if there are sudden changes in blocked traffic. The company does not want to receive alerts for other changes in AWS WAF log behavior. The company will tune AWS WAF rules over time.

The DevOps engineer is currently subscribed to an Amazon Simple Notification Service (Amazon SNS) topic in the environment.

Which solution will meet these requirements?
  1. A Create a CloudWatch Logs metrics filter for blocked requests on the AWS WAF log group to create a custom metric. Create a CloudWatch alarm by using CloudWatch anomaly detection and the published custom metric. Configure the alarm to notify the SNS topic to alert the DevOps engineer.
  2. B Create a CloudWatch anomaly detector for the log group. Create a CloudWatch alarm by using metrics that the CloudWatch anomaly detector publishes. Use the high setting for the LogAnomalyPriority metric. Configure the alarm to go into alarm state if a static threshold of one anomaly is detected. Configure the alarm to notify the SNS topic to alert the DevOps engineer.
  3. C Create a CloudWatch metrics filter for counted requests on the AWS WAF log group to create a custom metric. Create a CloudWatch alarm that activates when the sum of blocked requests in the custom metric during a period of 1 hour is greater than a static estimate for the acceptable number of blocked requests in 1 hour. Configure the alarm to notify the SNS topic to alert the DevOps engineer.
  4. D Create a CloudWatch anomaly detector for the log group. Create a CloudWatch alarm by using metrics that the CloudWatch anomaly detector publishes. Use the medium setting for the LogAnomalyPriority metric. Configure the alarm to go into alarm state if a sum of anomalies over 1 hour is greater than an expected value. Configure the alarm to notify the SNS topic to alert the DevOps engineer.
Xem giải thích

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

Câu hỏi xoay quanh một ứng dụng web chạy trên Amazon Elastic Kubernetes Service (Amazon EKS), được phân phối qua Amazon CloudFront. Công ty đã kích hoạt AWS WAF (Web Application Firewall) và cấu hình Amazon CloudWatch Logs để gửi logs vào log group aws-waf-logs.

Yêu cầu cụ thể của công ty 📋:

  • DevOps engineer cần nhận alert ngay lập tức nếu có thay đổi đột ngột (sudden changes) trong lượng traffic bị blocked (chặn).
  • KHÔNG muốn nhận alert cho các thay đổi khác trong hành vi logs của AWS WAF (ví dụ: counted requests hoặc các logs khác).
  • Công ty sẽ tối ưu hóa (tune) rules WAF theo thời gian, nên giải pháp phải linh hoạt, không dùng ngưỡng tĩnh (static threshold).
  • DevOps engineer đã subscribe vào một Amazon SNS topic sẵn có.

Thách thức chính 🛠️:

  • AWS WAF logs chứa nhiều loại action (blocked, counted, allowed, v.v.), nên cần lọc chính xác chỉ blocked requests.
  • Phát hiện sudden changes → Sử dụng CloudWatch anomaly detection (phát hiện bất thường dựa trên machine learning, học pattern lịch sử để detect spikes/deviations).
  • Giải pháp phải specific, linh hoạt và notify qua SNS.

Kiến thức AWS cập nhật đến 2026: AWS WAF v2 logs format chuẩn (JSON với fields như terminatingRuleId, action = "BLOCK"), CloudWatch Logs metrics filter hỗ trợ pattern matching chi tiết, CloudWatch anomaly detection trên custom metrics là best practice cho traffic spikes (không dùng Logs Anomaly Detection vì nó tổng quát cho toàn log group).

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

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

Đáp án đúng: Create a CloudWatch Logs metrics filter for blocked requests on the AWS WAF log group to create a custom metric. Create a CloudWatch alarm by using CloudWatch anomaly detection and the published custom metric. Configure the alarm to notify the SNS topic to alert the DevOps engineer.

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

  • Metrics filter trên log group aws-waf-logs với pattern lọc chỉ blocked requests (ví dụ: "{ $.action = \"BLOCK\" }"), tạo custom metric cụ thể (Sum của blocked requests).
  • CloudWatch anomaly detection trên custom metric này học pattern bình thường (xử lý tune rules theo thời gian), detect sudden changes/spikes chính xác, KHÔNG alert cho other log changes.
  • Alarm notify SNS → DevOps engineer nhận alert ngay. Đây là giải pháp precise, scalable theo best practice AWS DevOps (DOP-C02).

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

  • ✅ Phương án ĐÚNG (như trên):
    Create a CloudWatch Logs metrics filter for blocked requests on the AWS WAF log group to create a custom metric. Create a CloudWatch alarm by using CloudWatch anomaly detection and the published custom metric. Configure the alarm to notify the SNS topic to alert the DevOps engineer.
    (Giải pháp hoàn hảo: Specific cho blocked, anomaly detection linh hoạt cho sudden changes, không bị ảnh hưởng bởi tune rules).

  • ❌ Phương án SAI 1:
    Create a CloudWatch anomaly detector for the log group. Create a CloudWatch alarm by using metrics that the CloudWatch anomaly detector publishes. Use the high setting for the LogAnomalyPriority metric. Configure the alarm to go into alarm state if a static threshold of one anomaly is detected. Configure the alarm to notify the SNS topic to alert the DevOps engineer.
    Lý do sai ❌: Logs Anomaly Detection (feature mới) quét toàn bộ log group (bao gồm tất cả actions: blocked, counted,...), dẫn đến alert cho other changes (vi phạm yêu cầu). Dùng static threshold 1 anomaly không linh hoạt với tune rules, và priority "high" vẫn không specific cho blocked traffic.

  • ❌ Phương án SAI 2:
    Create a CloudWatch metrics filter for counted requests on the AWS WAF log group to create a custom metric. Create a CloudWatch alarm that activates when the sum of blocked requests in the custom metric during a period of 1 hour is greater than a static estimate for the acceptable number of blocked requests in 1 hour. Configure the alarm to notify the SNS topic to alert the DevOps engineer.
    Lý do sai ❌: Filter cho counted requests (KHÔNG phải blocked), và alarm dùng static threshold (estimate 1 giờ) → Không detect sudden changes linh hoạt, dễ miss spikes hoặc false positive khi tune rules. Không dùng anomaly detection.

  • ❌ Phương án SAI 3:
    Create a CloudWatch anomaly detector for the log group. Create a CloudWatch alarm by using metrics that the CloudWatch anomaly detector publishes. Use the medium setting for the LogAnomalyPriority metric. Configure the alarm to go into alarm state if a sum of anomalies over 1 hour is greater than an expected value. Configure the alarm to notify the SNS topic to alert the DevOps engineer.
    Lý do sai ❌: Tương tự SAI 1, Logs Anomaly Detection tổng quát toàn log group → Alert cho other WAF changes (không specific blocked). "Medium priority" + sum > expected vẫn static-like, không precise cho blocked traffic sudden changes.

Kết luận 🚀: Giải pháp đúng tận dụng metrics filter + custom metric + anomaly detection để đạt độ chính xác cao nhất, phù hợp DOP-C02 exam (2024-2026 blueprint).

Câu 610
A video platform company is migrating its video catalog to AWS. The company will host MP4 videos files in an Amazon S3 bucket. The company will use Amazon CloudFront and Amazon EC2 instances to serve the video files.

Users first connect to a frontend application that redirects to a video URL. The video URL contains an authorization token in CloudFront. The cache is activated on the CloudFront distribution. Authorization token check activity needs to be logged in Amazon CloudWatch.

The company wants to prevent direct access to video files on CloudFront and Amazon S3 and wants to implement checks of the authorization token that the frontend application provides. The company also wants to perform regular rolling updates of the code that checks the authorization token signature.

Which solution will meet these requirements with the LEAST operational effort?
  1. A Implement an authorization token check in Lambda@Edge as a trigger on the CloudFront distribution. Enable CloudWatch logging for the Lambda@Edge function. Attach the Lambda@Edge function to the CloudFront distribution. Implement CloudFront continuous deployment to perform updates.
  2. B Implement an authorization token check in CloudFront Functions. Enable CloudWatch logging for the CloudFront function. Attach the CloudFront function to the CloudFront distribution. Implement CloudFront continuous deployment to perform updates.
  3. C Implement an authorization token check in the application code that is installed on the EC2 instances. Install the CloudWatch agent on the EC2 instances. Configure the application to log to the CloudWatch agent. Implement a second CloudFront distribution. Migrate the traffic from the first CloudFront distribution by using Amazon Route 53 weighted routing.
  4. D Implement an authorization token check in CloudFront Functions. Enable CloudWatch logging for the CloudFront function. Attach the CloudFront function to the CloudFront distribution. Implement a second CloudFront distribution. Migrate the traffic from the first CloudFront distribution by using Amazon Route 53 weighted routing.
Xem giải thích

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

Câu hỏi xoay quanh việc một công ty video đang di chuyển catalog video (các file MP4) lên AWS, lưu trữ trên Amazon S3 bucket, sử dụng Amazon CloudFront kết hợp Amazon EC2 instances để phân phối video. Quy trình hoạt động như sau:

  • Người dùng kết nối đến frontend application (chạy trên EC2?), frontend sẽ redirect đến video URL chứa authorization token ngay trong CloudFront.
  • Cache đã được kích hoạt trên CloudFront distribution.
  • Cần log hoạt động kiểm tra authorization token vào Amazon CloudWatch.

Yêu cầu chính (phải đáp ứng TẤT CẢ với LEAST operational effort - ít nỗ lực vận hành nhất):
✅ Ngăn chặn truy cập trực tiếp vào file video trên CloudFront và S3 (chỉ cho phép qua token hợp lệ).
✅ Kiểm tra authorization token do frontend cung cấp (bao gồm signature).
✅ Cập nhật rolling thường xuyên code kiểm tra token signature (rolling updates = cập nhật dần dần, không downtime).
🛠️ Giải pháp lý tưởng: Phải chạy tại edge (CloudFront) để kiểm tra token trước khi cache/serve, hỗ trợ logging CloudWatch, và dễ dàng rolling updates mà không phức tạp.

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

Đáp án đúng là lựa chọn thứ 2:
Implement an authorization token check in CloudFront Functions. Enable CloudWatch logging for the CloudFront function. Attach the CloudFront function to the CloudFront distribution. Implement CloudFront continuous deployment to perform updates.

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

  • CloudFront Functions là giải pháp nhẹ nhất tại edge (viewer request/response events), thực thi JS đơn giản (< 1MB, sub-millisecond latency), lý tưởng cho kiểm tra token/signature mà không cần Lambda@Edge (nặng hơn, cold start cao).
  • Enable CloudWatch logging: CloudFront Functions hỗ trợ log trực tiếp đến CloudWatch Logs (tích hợp native từ 2023, không cần agent).
  • Attach to distribution: Dễ dàng associate với CloudFront distro.
  • CloudFront continuous deployment (ra mắt 2023, cập nhật 2025+): Tự động blue-green deployment (2 stages: production/staging), rolling updates code mà KHÔNG downtime, LEAST effort (không cần Route53 hay multi-distro).
    🛠️ Least operational effort: Toàn bộ serverless tại edge, tự động scale, update nhanh (giây thay vì phút như Lambda@Edge), ngăn direct access hiệu quả (token check trước cache/S3). Hoàn hảo cho video streaming!

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

Dưới đây là phân tích từng lựa chọn một cách chi tiết, giữ nguyên văn bản gốc tiếng Anh. Mỗi phương án được đánh giá đúng/sai dựa trên yêu cầu (prevent direct access, token check, rolling updates, least effort).

  • ❌ Phương án 1 (SAI):
    Implement an authorization token check in Lambda@Edge as a trigger on the CloudFront distribution. Enable CloudWatch logging for the Lambda@Edge function. Attach the Lambda@Edge function to the CloudFront distribution. Implement CloudFront continuous deployment to perform updates.
    Giải thích sai: Lambda@Edge mạnh nhưng operational effort cao hơn (cold starts 100-500ms, replicate global 12 regions, package lớn hơn 1MB, update chậm hơn 5-10 phút). Không phải "least effort" so với CloudFront Functions (nhẹ hơn 10x). Continuous deployment hỗ trợ nhưng không tối ưu cho simple token check. Không đáp ứng fully "least effort".

  • ✅ Phương án 2 (ĐÚNG):
    Implement an authorization token check in CloudFront Functions. Enable CloudWatch logging for the CloudFront function. Attach the CloudFront function to the CloudFront distribution. Implement CloudFront continuous deployment to perform updates.
    Giải thích đúng: Như đã phân tích ở trên - hoàn hảo, least effort! Chạy tại 128+ edge locations, log CloudWatch native, attach instant, continuous deployment tự động rolling updates (validate staging trước prod). Ngăn direct access 100% (check token viewer request → deny nếu invalid → không hit S3/cache).

  • ❌ Phương án 3 (SAI):
    Implement an authorization token check in the application code that is installed on the EC2 instances. Install the CloudWatch agent on the EC2 instances. Configure the application to log to the CloudWatch agent. Implement a second CloudFront distribution. Migrate the traffic from the first CloudFront distribution by using Amazon Route 53 weighted routing.
    Giải thích sai: Không prevent direct access (token check ở EC2 backend, user vẫn hit CloudFront/S3 trực tiếp bypass EC2). EC2 cần manage scale/log agent → high effort. Route53 weighted cho rolling → phức tạp, có thể downtime/race conditions. Không chạy tại edge → latency cao cho video, vi phạm "least effort".

  • ❌ Phương án 4 (SAI):
    Implement an authorization token check in CloudFront Functions. Enable CloudWatch logging for the CloudFront function. Attach the CloudFront function to the CloudFront distribution. Implement a second CloudFront distribution. Migrate the traffic from the first CloudFront distribution by using Amazon Route 53 weighted routing.
    Giải thích sai: CloudFront Functions tốt, nhưng dùng second distro + Route53 weighted → effort cao (manage 2 distros, DNS propagation chậm, phức tạp validate traffic shift). Không dùng continuous deployment (native của CloudFront, ra mắt 2023) → không "least effort". Phức tạp thừa thãi!

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