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

Tìm thấy 681 câu.

Câu 261 Chọn nhiều đáp án AWS Compute

A web application runs on a custom port. The application has been deployed in an Auto Scaling group with an Application Load Balancer (ALB). After launching instances the Auto Scaling and Target Group health checks are returning a healthy status. However, users report that the application is not accessible.

Which steps should a DevOps engineer take to troubleshoot the issue? (Select TWO.)

  1. A

    Create a path-based routing rule to direct traffic to the custom port and path on the EC2 instances.

  2. B

    Modify the Target Group health check configuration to check the application process on the custom port and path.

  3. C

    Modify the Target Group configuration to specify targets by IP rather than instance ID to allow routing to any private IP address.

  4. D

    Modify the Auto Scaling group health check configuration to check the application process on the custom port and path.

  5. E

    Inspect the listener configuration on the ALB and check it is configured with the TCP protocol and the custom port.

Xem giải thích

Đáp án theo nguồn

B và D.

  • B — Sửa health check của target group để kiểm tra đúng cổng và đường dẫn của ứng dụng.
  • D — Sửa health check của Auto Scaling group để kiểm tra đúng cổng và đường dẫn ứng dụng.

Vì sao đúng

Triệu chứng rất đặc trưng: cả hai health check đều báo lành, nhưng người dùng không truy cập được. Điều đó nghĩa là health check đang kiểm tra sai thứ.

Ứng dụng chạy trên một cổng tuỳ chỉnh (ví dụ 8080), nhưng health check nhiều khả năng đang trỏ vào cổng mặc định hoặc vào một tiến trình khác đang lắng nghe. Kết quả: nó xác nhận "có cái gì đó đang chạy" chứ không xác nhận "ứng dụng đang phục vụ".

Sửa cho đúng:

aws elbv2 modify-target-group --target-group-arn <arn> \
  --health-check-protocol HTTP --health-check-port 8080 \
  --health-check-path /health --matcher HttpCode=200

Vì sao cần cả hai vế. Health check của target group quyết định ALB có gửi traffic tới instance không; health check của ASG quyết định instance hỏng có bị thay không. Để chúng nhất quán thì:

aws autoscaling update-auto-scaling-group --auto-scaling-group-name nhom-web \
  --health-check-type ELB --health-check-grace-period 300

Vì sao các phương án khác sai

  • A. Tạo path-based routing rule tới cổng tuỳ chỉnh — path-based rule định tuyến theo đường dẫn tới target group khác nhau; cổng của target đã được khai trong chính target group, không khai trong rule. Không giải quyết được vấn đề.
  • C. Đổi target type sang IP thay vì instance ID — cả hai kiểu đều hoạt động; kiểu IP cần thiết khi target nằm ngoài VPC hoặc dùng ENI. Nó không liên quan gì tới việc health check kiểm sai cổng.
  • E. Đặt listener của ALB dùng giao thức TCP — ALB không hỗ trợ listener TCP; listener của ALB chỉ có HTTP và HTTPS (TCP là của NLB). Phương án mô tả một cấu hình không tồn tại.

Ghi nhớ về chất lượng câu hỏi

Phương án D không diễn đạt đúng cách Auto Scaling hoạt động. Health check của ASG không có tham số cổng hay đường dẫn; nó chỉ có --health-check-type với hai giá trị: EC2 (dựa vào status check của EC2) hoặc ELB (dựa vào kết quả của load balancer). Việc kiểm tra cổng và đường dẫn hoàn toàn do target group quyết định.

Nên cách hiểu đúng của D là: đổi health check type của ASG sang ELB, để ASG kế thừa kết quả kiểm tra cổng/đường dẫn đã sửa ở B. Đó là một hành động thật và cần thiết — chỉ là câu chữ trong phương án mô tả nó sai.

Và nhớ điểm chung của toàn bộ câu hỏi: health check báo lành mà người dùng vẫn không vào được ⇒ health check đang kiểm sai thứ, gần như luôn là sai cổng hoặc sai đường dẫn.

Câu 262
A company has a mobile application that makes HTTP API calls to an Application Load Balancer (ALB). The ALB routes requests to an AWS Lambda function. Many different versions of the application are in use at any given time, including versions that are in testing by a subset of users. The version of the application is defined in the user-agent header that is sent with all requests to the API.
After a series of recent changes to the API, the company has observed issues with the application. The company needs to gather a metric for each API operation by response code for each version of the application that is in use. A DevOps engineer has modified the Lambda function to extract the API operation name, version information from the user-agent header and response code.
Which additional set of actions should the DevOps engineer take to gather the required metrics?
  1. A Modify the Lambda function to write the API operation name, response code, and version number as a log line to an Amazon CloudWatch Logs log group. Configure a CloudWatch Logs metric filter that increments a metric for each API operation name. Specify response code and application version as dimensions for the metric.
  2. B Modify the Lambda function to write the API operation name, response code, and version number as a log line to an Amazon CloudWatch Logs log group. Configure a CloudWatch Logs Insights query to populate CloudWatch metrics from the log lines. Specify response code and application version as dimensions for the metric.
  3. C Configure the ALB access logs to write to an Amazon CloudWatch Logs log group. Modify the Lambda function to respond to the ALB with the API operation name, response code, and version number as response metadata. Configure a CloudWatch Logs metric filter that increments a metric for each API operation name. Specify response code and application version as dimensions for the metric.
  4. D Configure AWS X-Ray integration on the Lambda function. Modify the Lambda function to create an X-Ray subsegment with the API operation name, response code, and version number. Configure X-Ray insights to extract an aggregated metric for each API operation name and to publish the metric to Amazon CloudWatch. Specify response code and application version as dimensions for the metric.
Xem giải thích

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

Câu hỏi xoay quanh một ứng dụng di động (mobile app) gửi các yêu cầu HTTP API đến Application Load Balancer (ALB), sau đó ALB định tuyến yêu cầu đến AWS Lambda function. 📱➡️ALB➡️Lambda.

  • Ứng dụng có nhiều phiên bản (versions) đang được sử dụng đồng thời, bao gồm cả phiên bản đang test trên một nhóm người dùng nhỏ. Phiên bản app được xác định qua user-agent header trong mọi request API.
  • Sau các thay đổi gần đây trên API, công ty gặp vấn đề (issues) với app. Họ cần thu thập metrics cụ thể: cho mỗi API operation (tên hoạt động API), phân loại theo response code (mã phản hồi), và theo từng version app đang dùng. 📊
  • Một DevOps engineer đã sửa Lambda để extract (trích xuất): tên API operation, thông tin version từ user-agent header, và response code. 🛠️
  • Yêu cầu thêm: Bộ hành động nào để gather metrics cần thiết? Cần giải pháp chi tiết, chính xác để tạo metrics có thể query theo dimensions (response code và app version).

Mục tiêu là metrics tùy chỉnh trong Amazon CloudWatch, dễ dàng filter theo dimensions cho monitoring và troubleshooting issues theo version cụ thể. 🔍

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

Đáp án đúng là lựa chọn đầu tiên (A).

Lý do:

  • Lambda đã extract đầy đủ dữ liệu cần thiết (API op name, response code, version). Chỉ cần ghi log vào CloudWatch Logs log group dưới dạng log line có cấu trúc, sau đó dùng CloudWatch Logs metric filter để parse log và increment metric cho mỗi API op name, với dimensions là response code + app version.
  • Đây là cách chuẩn AWS, hiệu quả cao, low-cost, hỗ trợ real-time metrics mà không cần code phức tạp thêm. Metric sẽ xuất hiện ngay trong CloudWatch Metrics namespace, dễ dashboard và alarm. 📈
  • Phù hợp kiến thức mới nhất AWS (2024-2026): Metric filters hỗ trợ lên đến 3 dimensions per metric, parse JSON/extract fields linh hoạt. 🚀

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

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

  • Modify the Lambda function to write the API operation name, response code, and version number as a log line to an Amazon CloudWatch Logs log group. Configure a CloudWatch Logs metric filter that increments a metric for each API operation name. Specify response code and application version as dimensions for the metric.
    ✅ Đúng. Như đã giải thích ở trên: Log line đơn giản (ví dụ JSON format), metric filter parse chính xác fields để tạo custom metric với dimensions. Không cần tool ngoài, tích hợp native CloudWatch. Hoàn hảo cho scale cao với Lambda. 💯

  • Modify the Lambda function to write the API operation name, response code, and version number as a log line to an Amazon CloudWatch Logs log group. Configure a CloudWatch Logs Insights query to populate CloudWatch metrics from the log lines. Specify response code and application version as dimensions for the metric.
    ❌ Sai. CloudWatch Logs Insights chỉ dùng để query và visualize logs (ad-hoc analysis), KHÔNG hỗ trợ tự động "populate" (tạo) metrics từ log lines một cách liên tục/real-time như metric filter. Insights query phải chạy thủ công hoặc scheduled (qua Lambda/EventBridge), không tạo metrics với dimensions tự động. Không phù hợp cho metrics monitoring liên tục. ⏱️

  • Configure the ALB access logs to write to an Amazon CloudWatch Logs log group. Modify the Lambda function to respond to the ALB with the API operation name, response code, and version number as response metadata. Configure a CloudWatch Logs metric filter that increments a metric for each API operation name. Specify response code and application version as dimensions for the metric.
    ❌ Sai. ALB access logs chỉ capture request info (như user-agent, response code HTTP từ ALB), KHÔNG capture response metadata tùy chỉnh từ Lambda (API op name, version). Lambda response là HTTP body/headers chuẩn, không inject metadata vào ALB logs. Không khả thi, vi phạm HTTP protocol. Thêm nữa, ALB logs không extract được API op name từ path dễ dàng nếu không config. 🚫

  • Configure AWS X-Ray integration on the Lambda function. Modify the Lambda function to create an X-Ray subsegment with the API operation name, response code, and version number. Configure X-Ray insights to extract an aggregated metric for each API operation name and to publish the metric to Amazon CloudWatch. Specify response code and application version as dimensions for the metric.
    ❌ Sai. AWS X-Ray chủ yếu cho tracing (trace requests end-to-end), subsegment annotations/metadata chỉ lưu trong trace data, KHÔNG tự động tạo custom metrics với dimensions cụ thể như vậy. X-Ray Insights rules detect anomalies/rules, nhưng publish sang CloudWatch chỉ là pre-defined metrics (như trace count, latency), không hỗ trợ custom aggregated metrics theo dimensions từ subsegment một cách linh hoạt. Phức tạp và overkill cho metrics đơn giản. 🔍❌

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

Giải pháp này giúp DevOps engineer nhanh chóng monitor issues theo version app, scale tốt với traffic cao! 🎯 Nếu cần ví dụ code Lambda log hoặc metric filter pattern, hãy hỏi thêm nhé! 😊

Câu 263
A company provides an application to customers. The application has an Amazon API Gateway REST API that invokes an AWS Lambda function. On initialization, the Lambda function loads a large amount of data from an Amazon DynamoDB table. The data load process results in long cold-start times of 8-10 seconds. The DynamoDB table has DynamoDB Accelerator (DAX) configured.
Customers report that the application intermittently takes a long time to respond to requests. The application receives thousands of requests throughout the day. In the middle of the day, the application experiences 10 times more requests than at any other time of the day. Near the end of the day, the application's request volume decreases to 10% of its normal total.
A DevOps engineer needs to reduce the latency of the Lambda function at all times of the day.
Which solution will meet these requirements?
  1. A Configure provisioned concurrency on the Lambda function with a concurrency value of 1. Delete the DAX cluster for the DynamoDB table.
  2. B Configure reserved concurrency on the Lambda function with a concurrency value of 0.
  3. C Configure provisioned concurrency on the Lambda function. Configure AWS Application Auto Scaling on the Lambda function with provisioned concurrency values set to a minimum of 1 and a maximum of 100.
  4. D Configure reserved concurrency on the Lambda function. Configure AWS Application Auto Scaling on the API Gateway API with a reserved concurrency maximum value of 100.
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 ứng dụng sử dụng Amazon API Gateway REST API để gọi AWS Lambda function. Khi khởi tạo (initialization), Lambda load một lượng dữ liệu lớn từ Amazon DynamoDB table, dẫn đến cold-start times kéo dài 8-10 giây. Bảng DynamoDB đã cấu hình DynamoDB Accelerator (DAX) để tăng tốc đọc.

📈 Mô hình traffic: Ứng dụng nhận hàng ngàn request/ngày. Giữa ngày, traffic tăng 10 lần (peak time). Cuối ngày, giảm xuống 10% tổng lượng bình thường. Khách hàng phàn nàn về latency cao không đều (intermittently long response times).

🎯 Yêu cầu: DevOps engineer cần giảm latency của Lambda function mọi lúc trong ngày, đặc biệt xử lý cold starts và biến động traffic cao/thấp.

🛠️ Vấn đề cốt lõi: Cold starts xảy ra vì Lambda init load data lớn (DAX giúp cache nhưng không giải quyết init phase). Traffic peak cần scale concurrency, nhưng cần giữ warm instances tối thiểu để tránh cold starts ngay cả low traffic.

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

Đáp án đúng:
Configure provisioned concurrency on the Lambda function. Configure AWS Application Auto Scaling on the Lambda function with provisioned concurrency values set to a minimum of 1 and a maximum of 100.

Lý do chi tiết:

  • Provisioned concurrency giữ một số Lambda instances luôn warm (không cold start), giảm latency init từ 8-10s xuống gần 0.
  • AWS Application Auto Scaling trên provisioned concurrency của Lambda:
    • Min = 1: Đảm bảo ít nhất 1 instance warm mọi lúc, tránh cold starts ngay cả low traffic (cuối ngày 10%).
    • Max = 100: Scale lên tự động khi peak traffic x10, xử lý hàng chục nghìn request mà không throttle.
  • Giải quyết toàn bộ yêu cầu: Latency thấp mọi lúc, scale theo traffic thực tế (utilization target-based scaling). Không ảnh hưởng DAX (vẫn giữ cache DynamoDB).

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

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

  • Phương án 1: Configure provisioned concurrency on the Lambda function with a concurrency value of 1. Delete the DAX cluster for the DynamoDB table.
    ❌ Sai vì: Provisioned concurrency fixed =1 chỉ giữ 1 instance warm, không scale với peak traffic x10 (hàng chục nghìn request → throttle/throttling). Delete DAX làm DynamoDB read chậm hơn (mất in-memory cache), tăng latency thêm. Không đáp ứng "giảm latency mọi lúc" vì thiếu scale.

  • Phương án 2: Configure reserved concurrency on the Lambda function with a concurrency value of 0.
    ❌ Sai vì: Reserved concurrency =0 chặn hoàn toàn Lambda chạy (không invocation nào). Đây là cách "tắt" function, trái ngược yêu cầu giảm latency (thực tế gây 100% failure).

  • Phương án 3: Configure provisioned concurrency on the Lambda function. Configure AWS Application Auto Scaling on the Lambda function with provisioned concurrency values set to a minimum of 1 and a maximum of 100.
    ✅ Đúng vì: Như giải thích trên – warm instances min 1 (low traffic), auto scale max 100 (peak), tối ưu chi phí và performance. Phù hợp traffic pattern (scale based trên Lambda metrics như Duration/Invocations).

  • Phương án 4: Configure reserved concurrency on the Lambda function. Configure AWS Application Auto Scaling on the API Gateway API with a reserved concurrency maximum value of 100.
    ❌ Sai vì: Reserved concurrency chỉ giới hạn max executions (không giữ warm, cold starts vẫn xảy ra). Auto Scaling trên API Gateway chỉ throttle request đến Gateway (không scale Lambda concurrency). Không giải quyết cold starts, chỉ giới hạn traffic → latency cao ở peak.

🧠 Kết luận: Giải pháp đúng tận dụng Provisioned Concurrency + Auto Scaling (feature Lambda mới nhất 2024+), tối ưu cho workload spiky như mô tả. Chi phí provisioned chỉ tính khi scale, phù hợp low traffic cuối ngày! 🚀

Câu 264
A company is adopting AWS CodeDeploy to automate its application deployments for a Java-Apache Tomcat application with an Apache Webserver. The development team started with a proof of concept, created a deployment group for a developer environment, and performed functional tests within the application. After completion, the team will create additional deployment groups for staging and production.
The current log level is configured within the Apache settings, but the team wants to change this configuration dynamically when the deployment occurs, so that they can set different log level configurations depending on the deployment group without having a different application revision for each group.
How can these requirements be met with the LEAST management overhead and without requiring different script versions for each deployment group?
  1. A Tag the Amazon EC2 instances depending on the deployment group. Then place a script into the application revision that calls the metadata service and the EC2 API to identify which deployment group the instance is part of. Use this information to configure the log level settings. Reference the script as part of the AfterInstall lifecycle hook in the appspec.yml file.
  2. B Create a script that uses the CodeDeploy environment variable DEPLOYMENT_GROUP_ NAME to identify which deployment group the instance is part of. Use this information to configure the log level settings. Reference this script as part of the BeforeInstall lifecycle hook in the appspec.yml file.
  3. C Create a CodeDeploy custom environment variable for each environment. Then place a script into the application revision that checks this environment variable to identify which deployment group the instance is part of. Use this information to configure the log level settings. Reference this script as part of the ValidateService lifecycle hook in the appspec.yml file.
  4. D Create a script that uses the CodeDeploy environment variable DEPLOYMENT_GROUP_ID to identify which deployment group the instance is part of to configure the log level settings. Reference this script as part of the Install lifecycle hook in the appspec.yml file.
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 sử dụng AWS CodeDeploy để triển khai ứng dụng Java-Apache Tomcat kết hợp Apache Webserver trên các môi trường khác nhau (dev, staging, production). Công ty đã tạo deployment group cho môi trường dev và thực hiện POC thành công. Bây giờ, họ muốn thay đổi cấu hình log level động (ví dụ: DEBUG cho dev, INFO cho staging, ERROR cho prod) dựa trên deployment group, mà KHÔNG cần tạo application revision riêng biệt cho từng group và KHÔNG cần script version khác nhau. Yêu cầu chính là giải pháp có ít management overhead nhất (ít công quản lý, tự động hóa cao).

🔑 Vấn đề cốt lõi:

  • Log level hiện tại nằm trong file cấu hình Apache (httpd.conf hoặc tương tự).
  • Cần script/script hook trong appspec.yml để detect môi trường (deployment group) và chỉnh sửa log level động.
  • Giải pháp phải tận dụng tính năng sẵn có của CodeDeploy để tránh gọi API phức tạp, tagging thủ công hoặc custom vars.

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

Đáp án đúng: Create a script that uses the CodeDeploy environment variable DEPLOYMENT_GROUP_NAME to identify which deployment group the instance is part of. Use this information to configure the log level settings. Reference this script as part of the BeforeInstall lifecycle hook in the appspec.yml file.

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

  • CodeDeploy tự động set environment variables sẵn có như DEPLOYMENT_GROUP_NAME (tên deployment group, ví dụ: "dev", "staging") khi deployment chạy trên instance. Script có thể đọc biến này qua echo $DEPLOYMENT_GROUP_NAME trong bash/shell script, rồi chỉnh sửa file Apache config (sed/awk để thay log level) dựa trên giá trị.
  • BeforeInstall lifecycle hook lý tưởng vì chạy trước khi install ứng dụng, cho phép config môi trường (Apache settings) mà không ảnh hưởng revision app. Điều này đảm bảo log level được set đúng trước khi app start.
  • Least overhead: Không cần tagging EC2, gọi API, custom vars hay revision riêng. Một script duy nhất cho tất cả groups, tự động detect. Phù hợp kiến trúc EC2/On-Prem deployments (cập nhật AWS 2024-2026, không thay đổi core hooks).

📋 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, đánh dấu ✅/❌ và giải thích chi tiết bằng tiếng Việt:

  • ❌ Tag the Amazon EC2 instances depending on the deployment group. Then place a script into the application revision that calls the metadata service and the EC2 API to identify which deployment group the instance is part of. Use this information to configure the log level settings. Reference the script as part of the AfterInstall lifecycle hook in the appspec.yml file.
    Sai vì: Overhead cao – cần tag thủ công EC2 theo group, script phải gọi EC2 API (describe-instances) và IMDSv2 metadata (instance-id), yêu cầu IAM role phức tạp (permissions describe-tags). AfterInstall chạy sau install, có thể muộn cho config Apache. Không "least overhead", dễ lỗi và quản lý tag khó scale.

  • ✅ Create a script that uses the CodeDeploy environment variable DEPLOYMENT_GROUP_NAME to identify which deployment group the instance is part of. Use this information to configure the log level settings. Reference this script as part of the BeforeInstall lifecycle hook in the appspec.yml file.
    Đúng vì: Như giải thích trên – tận dụng env var built-in DEPLOYMENT_GROUP_NAME (tự động set bởi CodeDeploy), script đơn giản, BeforeInstall timing hoàn hảo, zero extra management.

  • ❌ Create a CodeDeploy custom environment variable for each environment. Then place a script into the application revision that checks this environment variable to identify which deployment group the instance is part of. Use this information to configure the log level settings. Reference this script as part of the ValidateService lifecycle hook in the appspec.yml file.
    Sai vì: CodeDeploy không hỗ trợ custom environment variables per deployment group một cách native (env vars chỉ cho deployment config toàn cục, không per group). ValidateService là lifecycle hook chỉ dành cho ECS/Lambda, không tồn tại cho EC2/On-Prem (sẽ fail deployment). Overhead quản lý custom vars thủ công.

  • ❌ Create a script that uses the CodeDeploy environment variable DEPLOYMENT_GROUP_ID to identify which deployment group the instance is part of to configure the log level settings. Reference this script as part of the Install lifecycle hook in the appspec.yml file.
    Sai vì: Mặc dù DEPLOYMENT_GROUP_ID tồn tại (ID số của group), nhưng không thân thiện như NAME (phải map ID-to-name thủ công trong script, tăng complexity). Install không phải lifecycle hook chuẩn trong appspec.yml cho EC2 (hooks đúng: ApplicationStop, DownloadBundle, BeforeInstall, AfterInstall, ApplicationStart, ValidateService – chỉ ValidateService cho Lambda). Sẽ gây lỗi deployment.

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

  • AWS CodeDeploy User Guide: Lifecycle event hooks for EC2/On-Premises – Xác nhận BeforeInstall, AfterInstall; env vars như DEPLOYMENT_GROUP_NAME.
  • Environment variables: CodeDeploy environment variables – DEPLOYMENT_GROUP_NAME/ID tự động available.
  • Appspec.yml structure: Reference – Không có "Install" hook.
  • Exam DOP-C02 tips: Nhấn mạnh built-in features (env vars) over custom API calls cho least overhead (AWS re:Post & A Cloud Guru 2024 updates).

Giải pháp này giúp team deploy mượt mà với một appspec.yml và script chung! 🚀 Nếu cần sample script bash chỉnh Apache log, hỏi thêm nhé!

Câu 265
A company requires its developers to tag all Amazon Elastic Block Store (Amazon EBS) volumes in an account to indicate a desired backup frequency. This requirement Includes EBS volumes that do not require backups. The company uses custom tags named Backup_Frequency that have values of none, dally, or weekly that correspond to the desired backup frequency. An audit finds that developers are occasionally not tagging the EBS volumes.
A DevOps engineer needs to ensure that all EBS volumes always have the Backup_Frequency tag so that the company can perform backups at least weekly unless a different value is specified.
Which solution will meet these requirements?
  1. A Set up AWS Config in the account. Create a custom rule that returns a compliance failure for all Amazon EC2 resources that do not have a Backup Frequency tag applied. Configure a remediation action that uses a custom AWS Systems Manager Automation runbook to apply the Backup_Frequency tag with a value of weekly.
  2. B Set up AWS Config in the account. Use a managed rule that returns a compliance failure for EC2::Volume resources that do not have a Backup Frequency tag applied. Configure a remediation action that uses a custom AWS Systems Manager Automation runbook to apply the Backup_Frequency tag with a value of weekly.
  3. C Turn on AWS CloudTrail in the account. Create an Amazon EventBridge rule that reacts to EBS CreateVolume events. Configure a custom AWS Systems Manager Automation runbook to apply the Backup_Frequency tag with a value of weekly. Specify the runbook as the target of the rule.
  4. D Turn on AWS CloudTrail in the account. Create an Amazon EventBridge rule that reacts to EBS CreateVolume events or EBS ModifyVolume events. Configure a custom AWS Systems Manager Automation runbook to apply the Backup_Frequency tag with a value of weekly. Specify the runbook as the target of the rule.
Xem giải thích

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

Câu hỏi xoay quanh một công ty yêu cầu developers phải tag tất cả Amazon EBS volumes trong tài khoản với tag tùy chỉnh tên Backup_Frequency, có giá trị là none, daily hoặc weekly để chỉ định tần suất backup mong muốn. Yêu cầu này áp dụng cho cả EBS volumes không cần backup (với giá trị none). Kết quả audit cho thấy developers đôi khi quên tag, dẫn đến rủi ro không backup đúng lịch.

📋 Mục tiêu của DevOps engineer:

  • Đảm bảo TẤT CẢ EBS volumes (bao gồm existing và mới tạo) luôn có tag Backup_Frequency.
  • Mặc định backup ít nhất weekly nếu không chỉ định khác (tức là tự động apply tag weekly khi thiếu).
  • Giải pháp phải enforce tự động, sử dụng remediation để fix non-compliance.

🛠️ Yêu cầu kỹ thuật:

  • Phải cover toàn bộ lifecycle của EBS volumes: existing (hiện tại), mới tạo, và thay đổi (như attach/detach).
  • Sử dụng AWS services như AWS Config (quét compliance), Systems Manager (SSM) Automation cho remediation.
  • Không chỉ reactive với events mới, mà cần continuous monitoring toàn bộ account.

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

Đáp án đúng:
Set up AWS Config in the account. Use a managed rule that returns a compliance failure for EC2::Volume resources that do not have a Backup Frequency tag applied. Configure a remediation action that uses a custom AWS Systems Manager Automation runbook to apply the Backup_Frequency tag with a value of weekly.

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

  • AWS Config managed rule required-tags (phiên bản mới nhất AWS 2024-2026) hỗ trợ chính xác EC2::Volume (EBS volumes), kiểm tra tag bắt buộc Backup_Frequency. Nếu thiếu, đánh dấu NON_COMPLIANT.
  • Managed rule (không custom) dễ quản lý, AWS maintain, và cover tất cả EBS volumes existing + new qua continuous evaluation (quét định kỳ và real-time).
  • Remediation action với SSM Automation runbook tùy chỉnh tự động apply tag weekly khi NON_COMPLIANT – phù hợp mặc định "ít nhất weekly".
  • Giải pháp toàn diện, scalable, không miss volumes hiện tại (như EventBridge chỉ catch events mới).

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

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

  • ❌ Phương án SAI:
    Set up AWS Config in the account. Create a custom rule that returns a compliance failure for all Amazon EC2 resources that do not have a Backup Frequency tag applied. Configure a remediation action that uses a custom AWS Systems Manager Automation runbook to apply the Backup_Frequency tag with a value of weekly.
    Lý do sai: Sử dụng custom rule (tự viết Lambda) thay vì managed rule – phức tạp hơn, không cần thiết vì AWS đã có managed required-tags sẵn. Đặc biệt, rule áp dụng cho tất cả EC2 resources (EC2 instances, etc.), không chỉ EC2::Volume như yêu cầu, dẫn đến over-enforcement và noise không mong muốn.

  • ✅ Phương án ĐÚNG (như đã giải thích ở trên):
    Set up AWS Config in the account. Use a managed rule that returns a compliance failure for EC2::Volume resources that do not have a Backup Frequency tag applied. Configure a remediation action that uses a custom AWS Systems Manager Automation runbook to apply the Backup_Frequency tag with a value of weekly.
    Ưu điểm nổi bật: Target chính xác EC2::Volume, continuous compliance, remediation tự động.

  • ❌ Phương án SAI:
    Turn on AWS CloudTrail in the account. Create an Amazon EventBridge rule that reacts to EBS CreateVolume events. Configure a custom AWS Systems Manager Automation runbook to apply the Backup_Frequency tag with a value of weekly. Specify the runbook as the target of the rule.
    Lý do sai: Chỉ react CreateVolume events (volumes mới), bỏ sót existing volumes (hiện tại chưa tag). CloudTrail + EventBridge là event-driven, không quét toàn bộ account như AWS Config. Không cover volumes từ snapshot hoặc attach existing.

  • ❌ Phương án SAI:
    Turn on AWS CloudTrail in the account. Create an Amazon EventBridge rule that reacts to EBS CreateVolume events or EBS ModifyVolume events. Configure a custom AWS Systems Manager Automation runbook to apply the Backup_Frequency tag with a value of weekly. Specify the runbook as the target of the rule.
    Lý do sai: Vẫn chỉ event-driven (CreateVolume hoặc ModifyVolume), miss existing volumes và nhiều scenarios (như AttachVolume, DetachVolume, snapshot restore). ModifyVolume chủ yếu cho size/IOPS, không trigger khi chỉ tag hoặc lifecycle khác. Không đảm bảo luôn có tag cho tất cả volumes.

Tóm tắt so sánh 🏆:
AWS Config (managed rule + remediation) là best practice cho tag compliance (cover 100% volumes, audit-ready). EventBridge chỉ partial (new volumes). Custom rule thừa thãi khi managed có sẵn!

Câu 266
A company is using an Amazon Aurora cluster as the data store for its application. The Aurora cluster is configured with a single DB instance. The application performs read and write operations on the database by using the cluster's instance endpoint.
The company has scheduled an update to be applied to the cluster during an upcoming maintenance window. The cluster must remain available with the least possible interruption during the maintenance window.
What should a DevOps engineer do to meet these requirements?
  1. A Add a reader instance to the Aurora cluster. Update the application to use the Aurora cluster endpoint for write operations. Update the Aurora cluster's reader endpoint for reads.
  2. B Add a reader instance to the Aurora cluster. Create a custom ANY endpoint for the cluster. Update the application to use the Aurora cluster's custom ANY endpoint for read and write operations.
  3. C Turn on the Multi-AZ option on the Aurora cluster. Update the application to use the Aurora cluster endpoint for write operations. Update the Aurora cluster’s reader endpoint for reads.
  4. D Turn on the Multi-AZ option on the Aurora cluster. Create a custom ANY endpoint for the cluster. Update the application to use the Aurora cluster's custom ANY endpoint for read and write operations
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ối ưu hóa tính sẵn sàng (availability) của một Amazon Aurora cluster đang chạy với chỉ một DB instance duy nhất (single writer instance). Ứng dụng hiện tại sử dụng cluster's instance endpoint (endpoint của instance chính, dùng cho cả read và write operations). Công ty sắp thực hiện update trong maintenance window, và yêu cầu là giữ cluster available với ít interruption nhất (downtime thấp nhất có thể, thường chỉ vài giây).

🔍 Chi tiết vấn đề:

  • Với single DB instance, Aurora không có cơ chế failover tự động. Khi maintenance (như apply patch, upgrade engine), instance sẽ bị reboot hoặc thay thế, dẫn đến downtime đáng kể (có thể vài phút).
  • Cluster endpoint (hay writer endpoint) luôn trỏ đến primary instance (writer). Nếu chỉ có một instance, endpoint này sẽ "chết" tạm thời.
  • Giải pháp cần: Tạo redundancy bằng cách thêm replicas để Aurora hỗ trợ failover tự động trong maintenance window. Aurora sẽ promote reader instance thành writer mới một cách seamless, với RTO (Recovery Time Objective) chỉ ~30-60 giây.
  • Kiến thức cập nhật 2026: Aurora MySQL/PostgreSQL v3.x hỗ trợ fast failover với reader instances, và cluster endpoint tự động reroute traffic.

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

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

Đáp án đúng: Add a reader instance to the Aurora cluster. Update the application to use the Aurora cluster endpoint for write operations. Update the Aurora cluster's reader endpoint for reads.

Lý do chi tiết 🛠️:

  • ✅ Thêm reader instance: Tạo cluster multi-instance (writer + ít nhất 1 reader replica). Aurora tự động hỗ trợ failover khi primary instance maintenance – reader được promote thành writer mới nhanh chóng (RTO <60s).
  • ✅ Dùng cluster endpoint cho writes: Đây là writer endpoint chuẩn, luôn trỏ đến primary instance hiện tại (tự động reroute sau failover).
  • ✅ Dùng reader endpoint cho reads: Phân tải reads sang replicas, tránh overload writer. Sau failover, reader endpoint tự update để chỉ readers còn lại.
  • Kết quả: Ít interruption nhất – app không downtime lâu, chỉ gián đoạn ngắn khi failover. Hoàn hảo cho production.

❌ Phân tí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), chỉ rõ đúng/sai và lý do bằng tiếng Việt:

  • ✅ [ĐÚNG] Add a reader instance to the Aurora cluster. Update the application to use the Aurora cluster endpoint for write operations. Update the Aurora cluster's reader endpoint for reads.
    🛠️ Như đã giải thích ở trên: Tạo redundancy thực sự với reader replica, tận dụng cluster endpoint (writer) và reader endpoint chuẩn. Failover tự động, downtime tối thiểu. Đây là best practice AWS cho Aurora single-instance upgrade.

  • ❌ [SAI] Add a reader instance to the Aurora cluster. Create a custom ANY endpoint for the cluster. Update the application to use the Aurora cluster's custom ANY endpoint for read and write operations.
    🚫 Vấn đề: Custom ANY endpoint (hỗ trợ từ Aurora v3.x) dùng cho cả read/write, route writes đến writer và reads đến readers. Tuy thêm reader giúp failover, nhưng không cần thiết tạo custom ANY – phức tạp hóa mà không giảm downtime thêm. App vẫn gián đoạn ngắn khi writer failover (endpoint reroute). Không phải "least interruption" tối ưu, vì cluster/reader endpoints chuẩn đã đủ.

  • ❌ [SAI] Turn on the Multi-AZ option on the Aurora cluster. Update the application to use the Aurora cluster endpoint for write operations. Update the Aurora cluster’s reader endpoint for reads.
    🚫 Vấn đề: Aurora cluster luôn Multi-AZ theo mặc định nếu có replicas (không phải "turn on" riêng như RDS non-Aurora). Với single instance, bật Multi-AZ chỉ replicate storage (không tạo compute replicas), không có failover instance – maintenance vẫn downtime instance. Không giải quyết được vấn đề single instance, reader endpoint không tồn tại nếu không có replicas.

  • ❌ [SAI] Turn on the Multi-AZ option on the Aurora cluster. Create a custom ANY endpoint for the cluster. Update the application to use the Aurora cluster's custom ANY endpoint for read and write operations.
    🚫 Vấn đề: Kết hợp 2 sai lầm: "Turn on Multi-AZ" vô ích với single instance (không tạo replicas), custom ANY endpoint chỉ hữu ích nếu có readers. Vẫn downtime lớn khi maintenance single instance, không có failover thực. Phức tạp không cần thiết, không đáp ứng "least interruption".

Tóm tắt takeaway 🎯: Luôn thêm reader instances cho Aurora để enable failover trong maintenance. Sử dụng cluster endpoint (writes) + reader endpoint (reads) là pattern chuẩn, scale dễ dàng! Nếu cần code ví dụ (boto3), hỏi thêm nhé! 🚀

Câu 267 Chọn nhiều đáp án
A company must encrypt all AMIs that the company shares across accounts. A DevOps engineer has access to a source account where an unencrypted custom AMI has been built. The DevOps engineer also has access to a target account where an Amazon EC2 Auto Scaling group will launch EC2 instances from the AMI. The DevOps engineer must share the AMI with the target account.
The company has created an AWS Key Management Service (AWS KMS) key in the source account.
Which additional steps should the DevOps engineer perform to meet the requirements? (Choose three.)
  1. A In the source account, copy the unencrypted AMI to an encrypted AMI. Specify the KMS key in the copy action.
  2. B In the source account, copy the unencrypted AMI to an encrypted AMI. Specify the default Amazon Elastic Block Store (Amazon EBS) encryption key in the copy action.
  3. C In the source account, create a KMS grant that delegates permissions to the Auto Scaling group service-linked role in the target account.
  4. D In the source account, modify the key policy to give the target account permissions to create a grant. In the target account, create a KMS grant that delegates permissions to the Auto Scaling group service-linked role.
  5. E In the source account, share the unencrypted AMI with the target account.
  6. F In the source account, share the encrypted AMI with the target account.
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 quy trình chia sẻ AMI đã mã hóa (encrypted AMI) giữa các AWS account để đảm bảo tất cả AMI chia sẻ đều được mã hóa, sử dụng AWS KMS key do công ty tạo ở source account.

  • Bối cảnh: Một DevOps engineer có quyền truy cập vào source account (nơi có AMI tùy chỉnh chưa mã hóa - unencrypted custom AMI) và target account (nơi có Amazon EC2 Auto Scaling group - ASG sẽ launch EC2 instances từ AMI này). Công ty yêu cầu mã hóa tất cả AMI chia sẻ.
  • Yêu cầu chính: Thực hiện 3 bước bổ sung để share AMI an toàn, sử dụng KMS key ở source account. Quy trình phải hỗ trợ ASG ở target account sử dụng AMI encrypted cross-account mà không gặp vấn đề quyền KMS.
  • Thách thức kỹ thuật (dựa trên AWS best practices cập nhật 2026):
    • AMI unencrypted không thể share trực tiếp nếu yêu cầu mã hóa.
    • Để ASG launch encrypted AMI cross-account với KMS, cần copy AMI sang encrypted, chia sẻ AMI, và cấu hình KMS key policy + grant cho service-linked role của ASG (AWSThisAccountAutoScalingRole).
  • Mục tiêu: Đảm bảo tính bảo mật dữ liệu EBS snapshots trong AMI khi share và launch qua ASG.

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

Các bước đúng là sự kết hợp hoàn chỉnh để mã hóa, chia sẻ và cấp quyền KMS cross-account:

  1. In the source account, copy the unencrypted AMI to an encrypted AMI. Specify the KMS key in the copy action.
  2. In the source account, modify the key policy to give the target account permissions to create a grant. In the target account, create a KMS grant that delegates permissions to the Auto Scaling group service-linked role.
  3. In the source account, share the encrypted AMI with the target account.

Lý do chọn:

  • Đây là quy trình chuẩn AWS (cập nhật 2026) cho cross-account encrypted AMI sharing với ASG. Bước 1 mã hóa AMI bằng KMS key cụ thể. Bước 2-3 xử lý quyền KMS (key policy cho phép target tạo grant, grant delegate cho ASG role để decrypt khi launch). Không có bước nào thừa hoặc sai, đảm bảo ASG ở target launch được instances mà không lỗi "KMS access denied".

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

Dưới đây là phân tích tất cả 6 phương án, 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 docs AWS mới nhất:

  • ✅ In the source account, copy the unencrypted AMI to an encrypted AMI. Specify the KMS key in the copy action.
    Đúng: Bước đầu tiên bắt buộc để mã hóa AMI unencrypted bằng KMS key của công ty (không dùng default). Khi copy AMI qua AWS Console/CLI/API (CreateImage với Encrypted=true và KmsKeyId), EBS snapshots sẽ được mã hóa. Điều này đáp ứng yêu cầu "encrypt all AMIs" trước khi share.

  • ❌ In the source account, copy the unencrypted AMI to an encrypted AMI. Specify the default Amazon Elastic Block Store (Amazon EBS) encryption key in the copy action.
    Sai: Default EBS key là AWS-managed key (aws/ebs), không phải KMS key do công ty tạo. Yêu cầu chỉ rõ "company has created an AWS KMS key", nên phải dùng KMS key tùy chỉnh để kiểm soát cross-account. Default key không hỗ trợ grant phức tạp cho ASG cross-account.

  • ❌ In the source account, create a KMS grant that delegates permissions to the Auto Scaling group service-linked role in the target account.
    Sai: Không thể tạo grant trực tiếp từ source account cho service-linked role (AWSThisAccountAutoScalingRole) ở target account. Grant phải được tạo trong target account (sử dụng KMS key ARN từ source), sau khi key policy cho phép. Tạo grant cross-account trực tiếp sẽ lỗi quyền (KMS chỉ grant cho principal trong cùng account hoặc được ủy quyền).

  • ✅ In the source account, modify the key policy to give the target account permissions to create a grant. In the target account, create a KMS grant that delegates permissions to the Auto Scaling group service-linked role.
    Đúng: Quy trình KMS cross-account chuẩn: Sửa key policy ở source (thêm Allow cho target account root/principal với kms:CreateGrant). Sau đó, ở target, dùng CLI/API tạo grant (kms:CreateGrant với KeyId từ source, GranteePrincipal là ASG role ARN). Grant cho phép ASG decrypt EBS khi launch instances.

  • ❌ In the source account, share the unencrypted AMI with the target account.
    Sai: Vi phạm yêu cầu "encrypt all AMIs that the company shares". Share unencrypted AMI sẽ giữ nguyên trạng thái không mã hóa, ASG ở target không đáp ứng chính sách bảo mật. Phải copy sang encrypted trước.

  • ✅ In the source account, share the encrypted AMI with the target account.
    Đúng: Sau khi copy encrypted (bước 1), dùng ModifyImageAttribute hoặc CLI (modify-image-attribute) để share AMI với target account ID. Target có thể launch từ AMI shared này qua ASG, miễn là quyền KMS được cấu hình đúng.

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

  • AMI Sharing: Sharing an AMI with a different AWS account – Chi tiết copy encrypted và share.
  • KMS Cross-Account cho ASG: Using KMS with EC2 Auto Scaling & KMS Grants.
  • Best Practices DevOps: AWS Well-Architected Framework - Security Pillar (2026 edition), phần Encrypted AMIs cross-account.
  • CLI Example: aws ec2 copy-image --source-ami-id ami-xxx --encrypted --kms-key-id arn:aws:kms:... và aws kms create-grant --key-id arn:... --grantee-principal arn:aws:iam::target:role/aws-service-role/auto-scaling.amazonaws.com/....

Quy trình này đảm bảo zero-downtime và compliance cho môi trường production! 🚀

Câu 268 Chọn nhiều đáp án
A company uses AWS CodePipeline pipelines to automate releases of its application A typical pipeline consists of three stages build, test, and deployment. The company has been using a separate AWS CodeBuild project to run scripts for each stage. However, the company now wants to use AWS CodeDeploy to handle the deployment stage of the pipelines.
The company has packaged the application as an RPM package and must deploy the application to a fleet of Amazon EC2 instances. The EC2 instances are in an EC2 Auto Scaling group and are launched from a common AMI.
Which combination of steps should a DevOps engineer perform to meet these requirements? (Choose two.)
  1. A Create a new version of the common AMI with the CodeDeploy agent installed. Update the IAM role of the EC2 instances to allow access to CodeDeploy.
  2. B Create a new version of the common AMI with the CodeDeploy agent installed. Create an AppSpec file that contains application deployment scripts and grants access to CodeDeploy.
  3. C Create an application in CodeDeploy. Configure an in-place deployment type. Specify the Auto Scaling group as the deployment target. Add a step to the CodePipeline pipeline to use EC2 Image Builder to create a new AMI. Configure CodeDeploy to deploy the newly created AMI.
  4. D Create an application in CodeDeploy. Configure an in-place deployment type. Specify the Auto Scaling group as the deployment target. Update the CodePipeline pipeline to use the CodeDeploy action to deploy the application.
  5. E Create an application in CodeDeploy. Configure an in-place deployment type. Specify the EC2 instances that are launched from the common AMI as the deployment target. Update the CodePipeline pipeline to use the CodeDeploy action to deploy the application.
Xem giải thích

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

Câu hỏi xoay quanh việc tích hợp AWS CodeDeploy vào pipeline AWS CodePipeline để xử lý giai đoạn deployment cho ứng dụng được đóng gói dưới dạng RPM package.

  • Bối cảnh: Công ty đang sử dụng CodePipeline với 3 stage (build, test, deployment) qua CodeBuild riêng biệt. Bây giờ, họ muốn chuyển deployment sang CodeDeploy để deploy lên fleet EC2 instances thuộc EC2 Auto Scaling Group (ASG), các instance được launch từ common AMI.
  • Yêu cầu chính:
    • Sử dụng in-place deployment (deploy trực tiếp lên instances đang chạy, không thay thế AMI).
    • Ứng dụng là RPM, nên CodeDeploy agent phải có trên instances để xử lý deployment.
    • Tích hợp với CodePipeline để tự động hóa.
    • Chọn TWO steps phù hợp nhất.
  • Thách thức:
    • EC2 từ common AMI → Cần đảm bảo CodeDeploy agent installed (thường bake vào AMI mới cho ASG).
    • IAM role của instances phải có quyền truy cập CodeDeploy (policy AWSCodeDeployRole hoặc tương tự).
    • Target deployment phải là ASG để handle scaling động.
    • Pipeline cần action CodeDeploy thay vì CodeBuild cho deployment stage.

Câu hỏi kiểm tra kiến thức về CodeDeploy với EC2/ASG, tích hợp CodePipeline, và best practices cho agent installation (cập nhật đến 2024-2026: CodeDeploy hỗ trợ EC2/On-Premises với agent v1.0+, ASG integration native).

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

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

Hai phương án đúng là phương án 1 và phương án 4.

Lý do lựa chọn:

  • Chúng hoàn chỉnh và phù hợp nhất để enable in-place deployment RPM lên ASG qua CodePipeline:
    • Phương án 1: Đảm bảo prerequisites (agent trên AMI + IAM role) cho tất cả instances mới trong ASG.
    • Phương án 4: Tạo app/deployment group đúng config (in-place + ASG target) và tích hợp pipeline.
  • Kết hợp chúng tạo flow: Build → Test → CodeDeploy action → Deploy RPM artifact lên ASG instances (agent xử lý install/update RPM).

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

  • ✅ Phương án 1 (Đúng):
    "Create a new version of the common AMI with the CodeDeploy agent installed. Update the IAM role of the EC2 instances to allow access to CodeDeploy."
    Giải thích: Đây là bước prerequisite bắt buộc cho in-place deployment trên ASG. Bake CodeDeploy agent vào AMI mới để tất cả instances launch tự động có agent (tránh install runtime). Cập nhật IAM instance profile với policy AmazonEC2RoleforAWSCodeDeploy (cho phép agent gọi SSM/S3). Phù hợp với best practice AWS cho fleet lớn/ASG (không dùng UserData install vì ASG scale nhanh).

  • ❌ Phương án 2 (Sai):
    "Create a new version of the common AMI with the CodeDeploy agent installed. Create an AppSpec file that contains application deployment scripts and grants access to CodeDeploy."
    Giải thích: Bake agent vào AMI là đúng, nhưng AppSpec file KHÔNG grant access (AppSpec chỉ định lifecycle hooks như BeforeInstall, Install để chạy script RPM, không xử lý IAM). Access phải qua IAM role → Sai logic bảo mật.

  • ❌ Phương án 3 (Sai):
    "Create an application in CodeDeploy. Configure an in-place deployment type. Specify the Auto Scaling group as the deployment target. Add a step to the CodePipeline pipeline to use EC2 Image Builder to create a new AMI. Configure CodeDeploy to deploy the newly created AMI."
    Giải thích: In-place deployment KHÔNG deploy AMI mới (chỉ update app trên instances đang chạy). EC2 Image Builder dùng cho blue/green hoặc new AMI baking, không phù hợp in-place + RPM. Config ASG target đúng nhưng phần Image Builder + deploy AMI làm sai hoàn toàn.

  • ✅ Phương án 4 (Đúng):
    "Create an application in CodeDeploy. Configure an in-place deployment type. Specify the Auto Scaling group as the deployment target. Update the CodePipeline pipeline to use the CodeDeploy action to deploy the application."
    Giải thích: Core steps để tích hợp: Tạo CodeDeploy Application + Deployment Group với in-place (phù hợp RPM), target ASG (handle terminate/launch mới). Thay CodeBuild deployment stage bằng CodeDeploy action trong pipeline (input artifact là RPM từ build stage). Hoàn hảo cho automation.

  • ❌ Phương án 5 (Sai):
    "Create an application in CodeDeploy. Configure an in-place deployment type. Specify the EC2 instances that are launched from the common AMI as the deployment target. Update the CodePipeline pipeline to use the CodeDeploy action to deploy the application."
    Giải thích: Tích hợp pipeline đúng, nhưng target individual EC2 instances (tag/manual list) KHÔNG phù hợp fleet ASG (scale động → instances mới không tự deploy). Phải dùng ASG target để CodeDeploy theo dõi + deploy tự động lên instances mới (native support từ 2016, cập nhật 2024).

Kết luận 💡: Kết hợp 1+4 là solution tối ưu, scalable cho production. Nếu dùng blue/green, sẽ khác (nhưng câu hỏi chỉ định in-place ngầm qua RPM + existing fleet). Test trên AWS Console để verify! 🚀

Câu 269 Chọn nhiều đáp án
A company’s security team requires that all external Application Load Balancers (ALBs) and Amazon API Gateway APIs are associated with AWS WAF web ACLs. The company has hundreds of AWS accounts, all of which are included in a single organization in AWS Organizations. The company has configured AWS Config for the organization. During an audit, the company finds some externally facing ALBs that are not associated with AWS WAF web ACLs.
Which combination of steps should a DevOps engineer take to prevent future violations? (Choose two.)
  1. A Delegate AWS Firewall Manager to a security account.
  2. B Delegate Amazon GuardDuty to a security account.
  3. C Create an AWS Firewall Manager policy to attach AWS WAF web ACLs to any newly created ALBs and API Gateway APIs.
  4. D Create an Amazon GuardDuty policy to attach AWS WAF web ACLs to any newly created ALBs and API Gateway APIs.
  5. E Configure an AWS Config managed rule to attach AWS WAF web ACLs to any newly created ALBs and API Gateway APIs.
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 quản lý bảo mật AWS WAF (Web Application Firewall) trong một tổ chức lớn với hàng trăm AWS accounts được quản lý qua AWS Organizations. Đội ngũ bảo mật yêu cầu tất cả ALB (Application Load Balancers) hướng ngoại và API Gateway APIs phải được liên kết với AWS WAF web ACLs. Công ty đã kích hoạt AWS Config cho toàn tổ chức, nhưng cuộc kiểm toán phát hiện một số ALB hướng ngoại không có WAF web ACL.

Vấn đề cốt lõi: Làm thế nào để ngăn chặn các vi phạm tương lai (prevent future violations) một cách tự động, quy mô lớn? DevOps engineer cần chọn hai bước kết hợp để enforce chính sách bảo mật cho các resources mới tạo (newly created ALBs và API Gateway APIs). Giải pháp phải hỗ trợ multi-account và tự động hóa, dựa trên phiên bản AWS mới nhất (2024-2026: Firewall Manager hỗ trợ WAFv2 đầy đủ, tích hợp Organizations delegated admin).

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

Hai phương án đúng là sự kết hợp hoàn hảo để triển khai AWS Firewall Manager (FMS) – dịch vụ chuyên quản lý WAF quy mô tổ chức:

  1. Delegate AWS Firewall Manager to a security account.
    ✅ Lý do chọn: Phải ủy quyền (delegate) FMS cho một security account riêng trong Organizations để account này quản lý chính sách WAF cho tất cả accounts con. Không delegate thì không thể tạo policy tổ chức-wide. Đây là bước đầu tiên bắt buộc theo best practice AWS (2026: hỗ trợ delegated admin cho FMSv2).

  2. Create an AWS Firewall Manager policy to attach AWS WAF web ACLs to any newly created ALBs and API Gateway APIs.
    ✅ Lý do chọn: Sau khi delegate, tạo FMS policy loại Web ACL sẽ tự động attach WAF ACL đến ALB và API Gateway mới tạo ở mọi accounts. Policy này enforce proactive (ngăn vi phạm tương lai), hỗ trợ regional/global resources, và integrate với AWS Config để report compliance.

Kết hợp hai bước này đảm bảo tự động hóa 100%, không cần can thiệp thủ công, phù hợp DevOps Professional.

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

Dưới đây là phân tích từng lựa chọn, giữ nguyên văn bản gốc tiếng Anh. Mỗi phương án được đánh giá đúng/sai với lý do cụ thể dựa trên tính năng AWS mới nhất:

  • Delegate AWS Firewall Manager to a security account.
    ✅ Đúng. Đây là bước bắt buộc đầu tiên trong AWS Organizations. Delegate FMS admin role cho security account cho phép quản lý policy cross-account. Nếu thiếu, không thể apply WAF đến resources ở accounts khác. (🛠️ Best practice: Sử dụng organizations:DelegateAdministration API.)

  • Delegate Amazon GuardDuty to a security account.
    ❌ Sai. GuardDuty là dịch vụ threat detection (phát hiện malware, recon, etc.), không liên quan đến quản lý/attach WAF ACL. Delegate GuardDuty chỉ giúp centralize findings, không enforce WAF cho ALB/API Gateway. (🚫 Không giải quyết vấn đề prevent violations.)

  • Create an AWS Firewall Manager policy to attach AWS WAF web ACLs to any newly created ALBs and API Gateway APIs.
    ✅ Đúng. FMS policy Web ACL tự động protect resources mới (ALB, API Gateway, AppSync, etc.) cross-region/account. Hỗ trợ mandatory protection từ 2024, integrate với AWS Config để remediate non-compliant resources. (🛡️ Hoàn hảo cho "future violations".)

  • Create an Amazon GuardDuty policy to attach AWS WAF web ACLs to any newly created ALBs and API Gateway APIs.
    ❌ Sai. GuardDuty không có policy attach WAF; nó chỉ tạo findings/detector, không enforce security controls như WAF. Đây là nhầm lẫn lớn – GuardDuty không hỗ trợ WAF integration kiểu này. (🔒 GuardDuty chỉ monitor, không protect.)

  • Configure an AWS Config managed rule to attach AWS WAF web ACLs to any newly created ALBs and API Gateway APIs.
    ❌ Sai. AWS Config managed rules (như elb-attached-to-waf) chỉ monitor/report non-compliance, không tự động attach WAF ACL. Config không có remediation tự động cho việc attach resources mới (chỉ trigger Lambda SSM thủ công). Không prevent future violations hiệu quả như FMS. (📊 Config tốt cho audit, kém cho enforcement.)

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

Giải pháp này đạt 100% compliance tự động, phù hợp kỳ thi AWS Certified DevOps Engineer Professional (DOP-C02)! 🚀

Câu 270
A company uses AWS Key Management Service (AWS KMS) keys and manual key rotation to meet regulatory compliance requirements. The security team wants to be notified when any keys have not been rotated after 90 days.
Which solution will accomplish this?
  1. A Configure AWS KMS to publish to an Amazon Simple Notification Service (Amazon SNS) topic when keys are more than 90 days old.
  2. B Configure an Amazon EventBridge event to launch an AWS Lambda function to call the AWS Trusted Advisor API and publish to an Amazon Simple Notification Service (Amazon SNS) topic.
  3. C Develop an AWS Config custom rule that publishes to an Amazon Simple Notification Service (Amazon SNS) topic when keys are more than 90 days old.
  4. D Configure AWS Security Hub to publish to an Amazon Simple Notification Service (Amazon SNS) topic when keys are more than 90 days old.
Xem giải thích

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

Câu hỏi xoay quanh việc giám sát và thông báo về các AWS KMS keys (khóa mã hóa do khách hàng quản lý) đang sử dụng manual key rotation (xoay vòng thủ công) để tuân thủ quy định pháp lý. 🛡️️ Công ty cần một giải pháp tự động thông báo cho security team qua Amazon SNS khi bất kỳ key nào chưa được xoay vòng sau 90 ngày.

  • Bối cảnh chính: AWS KMS hỗ trợ automatic rotation cho symmetric keys (mặc định 365 ngày), nhưng ở đây là manual rotation nên cần theo dõi thủ công qua key material's creation date và rotation status. Không có tính năng built-in trực tiếp từ KMS để notify dựa trên tuổi thọ 90 ngày.
  • Yêu cầu cốt lõi: Giải pháp phải phát hiện keys cũ >90 ngày chưa rotate và publish thông báo đến SNS topic. 📱
  • Kiến thức cập nhật 2026: AWS Config (phiên bản mới nhất) hỗ trợ custom rules linh hoạt cho compliance monitoring, tích hợp sâu với KMS APIs như DescribeKey để kiểm tra CreationDate và KeyRotationEnabled (false cho manual).

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

Đáp án đúng: Develop an AWS Config custom rule that publishes to an Amazon Simple Notification Service (Amazon SNS) topic when keys are more than 90 days old.

Lý do:

  • AWS Config cho phép tạo custom Lambda-backed rule để query KMS keys qua API ListKeys + DescribeKey, tính toán tuổi thọ từ CreationDate so với 90 ngày, và kiểm tra manual rotation status. 🛠️ Nếu non-compliant, tự động publish đến SNS topic (hỗ trợ qua rule configuration).
  • Linh hoạt tùy chỉnh ngưỡng 90 ngày (không như managed rules mặc định 365 ngày). Hoàn hảo cho regulatory compliance với continuous recording và remediation workflows.
  • Ưu điểm: Chi phí thấp, scalable, tích hợp EventBridge/SNS native. ✅

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

Dưới đây là phân tích chi tiết từng lựa chọn. Tôi giữ nguyên văn bản gốc bằng tiếng Anh, chỉ giải thích bằng tiếng Việt với lý do đúng/sai dựa trên tính năng AWS mới nhất.

  • ❌ Configure AWS KMS to publish to an Amazon Simple Notification Service (Amazon SNS) topic when keys are more than 90 days old.
    Sai vì: AWS KMS không có tính năng built-in publish metrics hoặc events đến SNS dựa trên tuổi key (chỉ hỗ trợ CloudWatch metrics như KeyRotations nhưng không trigger SNS tự động cho 90 ngày). KMS chỉ emit events qua CloudTrail/EventBridge cho actions như RotateKey, không phải monitoring tuổi thọ. Không khả thi mà không dùng dịch vụ ngoài. 🚫

  • ❌ Configure an Amazon EventBridge event to launch an AWS Lambda function to call the AWS Trusted Advisor API and publish to an Amazon Simple Notification Service (Amazon SNS) topic.
    Sai vì: Trusted Advisor check DOP351 (KMS keys rotation) chỉ cảnh báo keys chưa rotate trong 365 ngày hoặc nearing expiry, không tùy chỉnh 90 ngày. EventBridge không có pattern sẵn trigger cho Trusted Advisor results theo lịch; cần polling API phức tạp, không efficient/scalable. Security Hub mới tích hợp tốt hơn, nhưng cách này không chính xác và overhead cao. 🚫

  • ✅ Develop an AWS Config custom rule that publishes to an Amazon Simple Notification Service (Amazon SNS) topic when keys are more than 90 days old.
    Đúng vì: AWS Config hỗ trợ custom rules (Lambda function) để evaluate KMS keys theo logic tùy chỉnh (so sánh CreationDate với 90 ngày, kiểm tra KeyRotationEnabled: false). Khi non-compliant, tự động SNS notification qua rule SNS topic integration. Managed rule kms-key-rotation-status có thể extend. Hoàn chỉnh cho compliance. 🏆

  • ❌ Configure AWS Security Hub to publish to an Amazon Simple Notification Service (Amazon SNS) topic when keys are more than 90 days old.
    Sai vì: Security Hub có CIS/PCI controls cho KMS rotation (check ID: KMS.2 - rotation trong 365 ngày), không hỗ trợ tùy chỉnh 90 ngày. Insight/automation có SNS integration, nhưng không granular cho key age cụ thể; chủ yếu cho security findings, không phải compliance monitoring chi tiết như Config. 🚫

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

Giải pháp này đảm bảo tuân thủ zero-trust và automation! Nếu cần code sample Lambda cho custom rule, hãy hỏi thêm. 🚀