Ngân hàng đề — AWS Certified Security Specialty

Tìm thấy 445 câu.

Câu 161 Chọn nhiều đáp án
A company has a legacy application that runs on a single Amazon EC2 instance. A security audit shows that the application has been using an IAM access key within its code to access an Amazon S3 bucket that is named DOC-EXAMPLE-BUCKET1 in the same AWS account. This access key pair has the s3:GetObject permission to all objects in only this S3 bucket. The company takes the application offline because the application is not compliant with the company’s security policies for accessing other AWS resources from Amazon EC2.
A security engineer validates that AWS CloudTrail is turned on in all AWS Regions. CloudTrail is sending logs to an S3 bucket that is named DOC-EXAMPLE-BUCKET2. This S3 bucket is in the same AWS account as DOC-EXAMPLE-BUCKET1. However, CloudTrail has not been configured to send logs to Amazon CloudWatch Logs.
The company wants to know if any objects in DOC-EXAMPLE-BUCKET1 were accessed with the IAM access key in the past 60 days. If any objects were accessed, the company wants to know if any of the objects that are text files (.txt extension) contained personally identifiable information (PII).
Which combination of steps should the security engineer take to gather this information? (Choose two.)
  1. A Use Amazon CloudWatch Logs Insights to identify any objects in DOC-EXAMPLE-BUCKET1 that contain PII and that were available to the access key.
  2. B Use Amazon OpenSearch Service to query the CloudTrail logs in DOC-EXAMPLE-BUCKET2 for API calls that used the access key to access an object that contained PII.
  3. C Use Amazon Athena to query the CloudTrail logs in DOC-EXAMPLE-BUCKET2 for any API calls that used the access key to access an object that contained PII.
  4. D Use AWS Identity and Access Management Access Analyzer to identify any API calls that used the access key to access objects that contained PII in DOC-EXAMPLE-BUCKET1.
  5. E Configure Amazon Macie to identify any objects in DOC-EXAMPLE-BUCKET1 that contain PII and that were available to the access key.
Xem giải thích

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

Câu hỏi mô tả một tình huống bảo mật thực tế trên AWS:
Một công ty có ứng dụng legacy chạy trên EC2 instance duy nhất, sử dụng IAM access key nhúng trong code để truy cập S3 bucket DOC-EXAMPLE-BUCKET1 (chỉ có quyền s3:GetObject trên bucket này). Ứng dụng bị tắt vì vi phạm chính sách bảo mật (không dùng access key nhúng trên EC2).

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

  • Kiểm tra trong 60 ngày qua, access key này có được dùng để truy cập bất kỳ object nào trong bucket DOC-EXAMPLE-BUCKET1 không?
  • Nếu có, kiểm tra xem các object là file text (phần mở rộng .txt) có chứa PII (Personally Identifiable Information - thông tin nhận dạng cá nhân) không?

🛤️ Thông tin nền:

  • AWS CloudTrail đã bật ở tất cả Regions, log được gửi vào S3 bucket DOC-EXAMPLE-BUCKET2 (cùng account).
  • CloudTrail chưa config gửi log đến CloudWatch Logs.

Mục tiêu: Chọn TWO steps (kết hợp 2 bước) để security engineer thu thập thông tin này một cách hiệu quả, dựa trên dữ liệu CloudTrail logs (để trace access) và công cụ scan PII.

Kiến thức AWS cập nhật (2026): CloudTrail ghi lại API calls chi tiết (bao gồm access key ID, event time, resources accessed). Athena là công cụ query S3 logs mạnh mẽ. Macie (Amazon Macie) chuyên scan S3 cho PII với ML, hỗ trợ filter theo access patterns và extensions như .txt.

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


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

Đáp án chính xác là:

  • Use Amazon Athena to query the CloudTrail logs in DOC-EXAMPLE-BUCKET2 for any API calls that used the access key to access an object that contained PII.
  • Configure Amazon Macie to identify any objects in DOC-EXAMPLE-BUCKET1 that contain PII and that were available to the access key.

Lý do lựa chọn 🏆:

  • Bước 1 (Athena): CloudTrail logs lưu ở S3 (DOC-EXAMPLE-BUCKET2), Athena cho phép query SQL trực tiếp trên logs để tìm API calls (như GetObject) sử dụng access key cụ thể trong 60 ngày qua. Query có thể filter theo userIdentity.accessKeyId, eventSource='s3.amazonaws.com', resources.ARN chứa bucket name, và event time. Điều này xác định objects đã được access. (Lưu ý: Logs không biết nội dung PII, nhưng query giúp list objects accessed để cross-check).
  • Bước 2 (Macie): Macie tự động scan DOC-EXAMPLE-BUCKET1 để detect PII trong files .txt (hỗ trợ managed data identifiers cho PII như SSN, email). Nó kiểm tra availability dựa trên IAM policies/access key, kết hợp với CloudTrail insights để confirm "available to the access key". Kết hợp hai bước: Athena trace access → Macie confirm PII.
    Đây là combo tối ưu, không cần di chuyển logs (vì chưa có CloudWatch Logs).

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

  • Use Amazon CloudWatch Logs Insights to identify any objects in DOC-EXAMPLE-BUCKET1 that contain PII and that were available to the access key.
    ❌ Sai: CloudWatch Logs Insights chỉ query logs đã được forward từ CloudTrail đến CloudWatch Logs, nhưng câu hỏi nêu rõ CloudTrail chưa config gửi đến CloudWatch Logs. Logs chỉ ở S3, không thể dùng Insights. Ngoài ra, Insights không scan nội dung object để detect PII (chỉ query metadata/events).

  • Use Amazon OpenSearch Service to query the CloudTrail logs in DOC-EXAMPLE-BUCKET2 for API calls that used the access key to access an object that contained PII.
    ❌ Sai: OpenSearch (trước là Elasticsearch) có thể index CloudTrail logs, nhưng không phải setup mặc định (cần Firehose/Lake Formation để stream logs vào OpenSearch). Câu hỏi không đề cập config này, và OpenSearch không tự detect PII trong object (chỉ query logs). Athena đơn giản hơn cho S3 logs.

  • Use Amazon Athena to query the CloudTrail logs in DOC-EXAMPLE-BUCKET2 for any API calls that used the access key to access an object that contained PII.
    ✅ Đúng: Athena query trực tiếp CloudTrail logs trên S3 với SQL (ví dụ: SELECT * FROM cloudtrail_logs WHERE userIdentity.accessKeyId = 'AKIA...' AND eventTime > ago(60d)). Xác định API calls đến bucket, list objects accessed bằng access key. Kết hợp Macie để check PII (query không đọc nội dung file, nhưng identify objects). Hỗ trợ partition bằng ngày để query 60 ngày nhanh.

  • Use AWS Identity and Access Management Access Analyzer to identify any API calls that used the access key to access objects that contained PII in DOC-EXAMPLE-BUCKET1.
    ❌ Sai: IAM Access Analyzer phân tích policies/IAM roles để tìm unused access hoặc external access tĩnh (policy findings), không query lịch sử API calls từ CloudTrail logs. Nó không trace past activities hay detect PII trong objects.

  • Configure Amazon Macie to identify any objects in DOC-EXAMPLE-BUCKET1 that contain PII and that were available to the access key.
    ✅ Đúng: Macie (với S3 jobs) scan bucket DOC-EXAMPLE-BUCKET1 để find PII trong .txt files (custom/job filters theo extension, sensitivity). Nó analyze access patterns từ CloudTrail/IAM để confirm "available to the access key" (integration tự động). Chạy one-time job cho 60 ngày data (hoặc continuous).

Tóm tắt combo lý tưởng 🚀: Athena → trace access lịch sử; Macie → scan PII thực tế. Không cần tool khác vì logs sẵn ở S3!

Câu 162
A security engineer creates an Amazon S3 bucket policy that denies access to all users. A few days later, the security engineer adds an additional statement to the bucket policy to allow read-only access to one other employee. Even after updating the policy, the employee sill receives an access denied message.
What is the likely cause of this access denial?
  1. A The ACL in the bucket needs to be updated.
  2. B The IAM policy does not allow the user to access the bucket.
  3. C It takes a few minutes for a bucket policy to take effect.
  4. D The allow permission is being overridden by the deny.
Xem giải thích

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

Câu hỏi này xoay quanh chính sách bảo mật (bucket policy) của Amazon S3, một dịch vụ lưu trữ đối tượng phổ biến trên AWS. Cụ thể:

  • Một kỹ sư bảo mật tạo bucket policy deny (từ chối) quyền truy cập cho tất cả người dùng (deny all users).
  • Vài ngày sau, kỹ sư thêm một statement mới vào policy đó để allow (cho phép) quyền đọc-only (read-only access) cho một nhân viên khác.
  • Tuy nhiên, nhân viên này vẫn nhận lỗi "access denied" ngay cả sau khi cập nhật policy.

Vấn đề cốt lõi: Tại sao quyền allow mới không có hiệu lực? Điều này liên quan đến logic đánh giá policy của AWS (policy evaluation logic), nơi explicit Deny luôn ưu tiên cao hơn Allow (theo thứ tự: Deny > Allow). Bucket policy được áp dụng ngay lập tức (không có độ trễ đáng kể), và nó có thể override các ACL hoặc IAM policy khác.

Kiến thức cập nhật đến 2026: AWS S3 bucket policy vẫn tuân thủ quy tắc Deny overrides Allow (xem AWS Well-Architected Framework và S3 Security Best Practices, không thay đổi cơ bản từ 2023-2026). 📘 Tài liệu tham khảo:

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

Đáp án đúng: The allow permission is being overridden by the deny.

Lý do chi tiết 🛠️:

  • Bucket policy ban đầu có statement Deny cho tất cả users (ví dụ: "Effect": "Deny", "Principal": "*"), điều này tạo ra explicit Deny áp dụng rộng rãi.
  • Khi thêm statement Allow read-only cho nhân viên cụ thể (ví dụ: "Effect": "Allow", "Principal": {"AWS": "arn:aws:iam::account:user/employee"}), AWS đánh giá policy theo thứ tự ưu tiên:
    1. Explicit Deny luôn thắng (override) bất kỳ Allow nào, ngay cả khi Allow cụ thể hơn.
    2. Để Allow có hiệu lực, phải xóa hoặc chỉnh sửa statement Deny ban đầu để loại trừ nhân viên đó (sử dụng Condition hoặc NotPrincipal).
  • Đây là nguyên nhân phổ biến nhất trong thực tế DevOps, đặc biệt khi policy được xây dựng theo kiểu "deny by default" rồi thêm exception.

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

Dưới đây là phân tích từng lựa chọn một cách chi tiết, dựa trên logic AWS S3 mới nhất:

  • ❌ [SAI] The ACL in the bucket needs to be updated.
    Giải thích: ACL (Access Control List) là cơ chế cũ, không liên quan trực tiếp đến bucket policy. Bucket policy override ACL nếu policy tồn tại (theo thứ tự đánh giá: Bucket Policy > ACL). Vấn đề ở đây là bucket policy, không phải ACL – cập nhật ACL cũng không giải quyết được explicit Deny từ policy. 🛑

  • ❌ [SAI] The IAM policy does not allow the user to access the bucket.
    Giải thích: IAM policy của user có thể ảnh hưởng, nhưng câu hỏi tập trung vào bucket policy (đã được cập nhật). Nếu IAM policy thiếu quyền (như s3:GetObject), user vẫn cần quyền cơ bản, nhưng explicit Deny từ bucket policy sẽ override mọi IAM policy Allow. Nguyên nhân chính không phải IAM, vì policy bucket là "deny all" rồi thêm allow. 🔒

  • ❌ [SAI] It takes a few minutes for a bucket policy to take effect.
    Giải thích: Bucket policy có hiệu lực ngay lập tức (propagation gần như tức thì, dưới 1 giây theo AWS 2025). Không có độ trễ "vài phút" như CloudFront hay Route53. Nếu vài ngày đã qua, policy đã active – vấn đề là logic override, không phải thời gian. ⏱️

  • ✅ [ĐÚNG] The allow permission is being overridden by the deny.
    Giải thích: Như đã nêu ở phần đáp án đúng, explicit Deny ưu tiên tuyệt đối trong AWS policy evaluation (Deny > List > Allow). Statement Deny "all users" vẫn match nhân viên, nên override Allow mới thêm. Giải pháp: Sửa Deny thành NotPrincipal hoặc di chuyển Allow lên trước (nhưng Deny vẫn thắng). 🎯

💡 Lời khuyên DevOps: Luôn test policy với aws s3api get-bucket-policy và IAM Policy Simulator. Tránh "deny all" mà không exception rõ ràng! 🚀

Câu 163
A company is using Amazon Macie, AWS Firewall Manager, Amazon Inspector, and AWS Shield Advanced in its AWS account. The company wants to receive alerts if a DDoS attack occurs against the account.
Which solution will meet this requirement?
  1. A Use Macie to detect an active DDoS event. Create Amazon CloudWatch alarms that respond to Macie findings.
  2. B Use Amazon inspector to review resources and to invoke Amazon CloudWatch alarms for any resources that are vulnerable to DDoS attacks.
  3. C Create an Amazon CloudWatch alarm that monitors Firewall Manager metrics for an active DDoS event.
  4. D Create an Amazon CloudWatch alarm that monitors Shield Advanced metrics for an active DDoS event.
Xem giải thích

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

Câu hỏi tập trung vào yêu cầu nhận thông báo (alerts) khi xảy ra cuộc tấn công DDoS (Distributed Denial of Service) đối với tài khoản AWS. Công ty đang sử dụng các dịch vụ: Amazon Macie (phát hiện dữ liệu nhạy cảm), AWS Firewall Manager (quản lý chính sách bảo mật mạng trung tâm), Amazon Inspector (quá trình quét lỗ hổng bảo mật), và AWS Shield Advanced (bảo vệ nâng cao chống DDoS).

Mục tiêu là chọn giải pháp tích hợp với Amazon CloudWatch để giám sát và kích hoạt alarm cho sự kiện DDoS đang diễn ra (active DDoS event). Đây là kịch bản thực tế trong môi trường AWS, nơi Shield Advanced là dịch vụ chuyên biệt cho DDoS với metrics thời gian thực (theo tài liệu AWS cập nhật 2024-2026, Shield Advanced hỗ trợ metrics như DDoSEventCount, DDoSEvaluatedResourceCount để detect và alert DDoS attacks).

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

✅ Đáp án đúng

Create an Amazon CloudWatch alarm that monitors Shield Advanced metrics for an active DDoS event.

Lý do lựa chọn (chi tiết):
🛠️ AWS Shield Advanced là dịch vụ chuyên bảo vệ chống DDoS Layer 3/4 và Layer 7, tự động detect và mitigate các cuộc tấn công đang diễn ra. Nó xuất bản metrics chi tiết vào CloudWatch như DDoSEventCount (số lượng DDoS events), DDoSDetected (phát hiện DDoS), và DDoSAttackTraffic (lưu lượng tấn công). Bằng cách tạo CloudWatch Alarm trên các metrics này, hệ thống sẽ gửi alerts ngay lập tức qua SNS, email, hoặc các kênh khác khi DDoS active. Các dịch vụ khác không có metrics DDoS-specific, nên đây là giải pháp chính xác, hiệu quả và tuân thủ best practices AWS (không cần code custom, scale tự động).

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

  • Use Macie to detect an active DDoS event. Create Amazon CloudWatch alarms that respond to Macie findings.
    ❌ Sai hoàn toàn: Amazon Macie chỉ phát hiện dữ liệu nhạy cảm (PII, PHI) trong S3 và các storage khác qua machine learning, không liên quan đến DDoS (network-layer attack). Macie findings không có metrics về DDoS, nên không thể dùng CloudWatch alarms cho mục đích này. (Tham khảo: Macie docs).

  • Use Amazon Inspector to review resources and to invoke Amazon CloudWatch alarms for any resources that are vulnerable to DDoS attacks.
    ❌ Sai: Amazon Inspector quét lỗ hổng (vulnerabilities) trên EC2, Lambda, containers qua CVE database, tập trung vào prevention chứ không detect active DDoS events thời gian thực. Nó không có metrics DDoS, chỉ findings về config risks (ví dụ: open ports có thể dễ bị DDoS, nhưng không monitor attack đang xảy ra). CloudWatch alarms từ Inspector chỉ cho scan results, không phù hợp. (Tham khảo: Inspector docs).

  • Create an Amazon CloudWatch alarm that monitors Firewall Manager metrics for an active DDoS event.
    ❌ Sai: AWS Firewall Manager quản lý policies cho WAF, Network Firewall, Shield trung tâm đa-account, nhưng không có metrics trực tiếp về active DDoS events. Metrics của nó chủ yếu về policy compliance (e.g., PolicyComplianceStatus), không detect/mitigate DDoS real-time như Shield Advanced. Phải dùng Shield metrics riêng. (Tham khảo: Firewall Manager metrics).

  • Create an Amazon CloudWatch alarm that monitors Shield Advanced metrics for an active DDoS event.
    ✅ Đúng: Như đã giải thích ở trên, đây là giải pháp chuẩn AWS với metrics chuyên dụng cho DDoS detection. Hỗ trợ proactive mitigation và alerts tức thì, phù hợp với multi-account setup (Shield Advanced tích hợp Firewall Manager). Best practice cho DevOps Engineer! 🚀

Câu 164
A company hosts a web application on an Apache web server. The application runs on Amazon EC2 instances that are in an Auto Scaling group. The company configured the EC2 instances to send the Apache web server logs to an Amazon CloudWatch Logs group that the company has configured to expire after 1 year.
Recently, the company discovered in the Apache web server logs that a specific IP address is sending suspicious requests to the web application. A security engineer wants to analyze the past week of Apache web server logs to determine how many requests that the IP address sent and the corresponding URLs that the IP address requested.
What should the security engineer do to meet these requirements with the LEAST effort?
  1. A Export the CloudWatch Logs group data to Amazon S3. Use Amazon Macie to query the logs for the specific IP address and the requested URL.
  2. B Configure a CloudWatch Logs subscription to stream the log group to an Amazon OpenSearch Service cluster. Use OpenSearch Service to analyze the logs for the specific IP address and the requested URLs.
  3. C Use CloudWatch Logs Insights and a custom query syntax to analyze the CloudWatch logs for the specific IP address and the requested URLs.
  4. D Export the CloudWatch Logs group data to Amazon S3. Use AWS Glue to crawl the S3 bucket for only the log entries that contain the specific IP address. Use AWS Glue to view the results.
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 web chạy trên máy chủ Apache trên các instance EC2 thuộc Auto Scaling group. Các instance này gửi log Apache vào một CloudWatch Logs group với chính sách hết hạn sau 1 năm. 🛡️ Gần đây, công ty phát hiện một IP address đáng ngờ gửi request lạ qua log Apache. Kỹ sư bảo mật cần phân tích log của tuần qua để xác định số lượng request từ IP đó và các URL tương ứng mà IP yêu cầu.

Yêu cầu chính: Thực hiện với LEAST effort (ít công sức nhất), nghĩa là ưu tiên giải pháp đơn giản, nhanh chóng, không cần thiết lập thêm dịch vụ phức tạp hay di chuyển dữ liệu. 📊 Dữ liệu log đã sẵn có trong CloudWatch Logs, chỉ cần công cụ query hiệu quả để filter theo IP, đếm request và extract URL (thường log Apache có format chứa IP và request line với URL).

Bối cảnh AWS cập nhật đến 2026: CloudWatch Logs hỗ trợ query mạnh mẽ qua CloudWatch Logs Insights (phiên bản mới nhất tích hợp AI/ML insights, filter thời gian linh hoạt, hỗ trợ syntax QL dễ dùng cho log structured/unstructured). Không cần export vì Logs Insights query trực tiếp trên log data mà không copy dữ liệu. ⏱️ Thời gian query chỉ vài giây cho tuần qua (retention 1 năm đủ).

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

Đáp án đúng: Use CloudWatch Logs Insights and a custom query syntax to analyze the CloudWatch logs for the specific IP address and the requested URLs.

Lý do chi tiết:

  • CloudWatch Logs Insights là công cụ native của AWS, cho phép query log trực tiếp trên Logs group mà KHÔNG cần export hay setup thêm bất kỳ service nào khác. 🛠️
  • Bạn chỉ cần chọn Logs group, đặt thời gian (past week: e.g., @timestamp >= now() - 7d), viết query đơn giản như: fields @timestamp, @message | filter @message like /IP_ADDRESS/ | stats count() by bin(1h), parse_url(@message) để filter IP, đếm request, extract URL từ log Apache (hỗ trợ regex/JSON parsing).
  • Least effort: Truy cập qua Console/CLI/API ngay lập tức, chi phí thấp (pay-per-query), scale tự động. Hoàn hảo cho phân tích ad-hoc bảo mật nhanh chóng. 🚀
  • Phù hợp best practice AWS Well-Architected Framework (Security pillar: analyze logs efficiently).

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

  • ❌ [SAI] Export the CloudWatch Logs group data to Amazon S3. Use Amazon Macie to query the logs for the specific IP address and the requested URL.
    Phương án này sai vì yêu cầu export log từ CloudWatch Logs sang S3 (quá trình mất thời gian, tốn effort: chọn thời gian export, đợi job hoàn thành ~giờ/ngày tùy dữ liệu). Sau đó dùng Macie (dịch vụ phát hiện sensitive data như PII/credentials) để "query", nhưng Macie KHÔNG phải công cụ query log – nó chỉ scan/classify data, không hỗ trợ đếm request hay extract URL chính xác theo IP. Macie phù hợp compliance hơn là log analysis. Không least effort, thêm chi phí S3 + Macie. 😵

  • ❌ [SAI] Configure a CloudWatch Logs subscription to stream the log group to an Amazon OpenSearch Service cluster. Use OpenSearch Service to analyze the logs for the specific IP address and the requested URLs.
    Phương án sai vì cần thiết lập subscription filter (lambda/real-time stream) và tạo OpenSearch cluster mới (provision domain, VPC/security, index mapping – effort cao, tốn ~30-60p setup + chi phí cluster chạy liên tục). Chỉ stream log tương lai, không query log quá khứ tuần qua ngay lập tức (phải đợi index). Không least effort cho ad-hoc analysis, phù hợp monitoring real-time hơn. 🕒

  • ✅ [ĐÚNG] Use CloudWatch Logs Insights and a custom query syntax to analyze the CloudWatch logs for the specific IP address and the requested URLs.
    Như đã giải thích ở trên: Query trực tiếp, zero setup, hỗ trợ filter IP (filter ip = "x.x.x.x"), stats count (stats count() by url), parse URL từ message. Least effort tuyệt đối – chỉ cần Console, chạy query trong <1 phút. Perfect match! 🎯

  • ❌ [SAI] Export the CloudWatch Logs group data to Amazon S3. Use AWS Glue to crawl the S3 bucket for only the log entries that contain the specific IP address. Use AWS Glue to view the results.
    Phương án sai vì lại export sang S3 (effort cao như trên), rồi dùng Glue crawler (setup job ETL, schema inference – mất giờ, tốn chi phí crawler). Glue KHÔNG crawl "only log entries chứa IP" tự động (crawler scan toàn bộ, không filter realtime; phải viết ETL job custom). Xem kết quả qua Glue Data Catalog/Athena, quá phức tạp cho task đơn giản. Không least effort, phù hợp big data pipeline chứ không phải quick analysis. 🔍

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

  • CloudWatch Logs Insights: AWS Docs - Query your logs – Ví dụ query log Apache: filter @message like /suspicious_ip/ | parse @message '"*" * * * * * "*" * * * * * * * * * * *' as status, user, time_taken | stats count() by status.
  • Best Practices Log Analysis: AWS Well-Architected - Logging.
  • So sánh Insights vs Export: CloudWatch Logs Features – Xác nhận least effort cho ad-hoc queries.

Giải pháp này đảm bảo tuân thủ Security best practices với tốc độ cao nhất! 🔒 Nếu cần ví dụ query cụ thể, hỏi thêm nhé! 😊

Câu 165
While securing the connection between a company’s VPC and its on-premises data center, a security engineer sent a ping command from an on-premises host (IP address 203.0.113.12) to an Amazon EC2 instance (IP address 172.31.16.139). The ping command did not return a response. The flow log in the VPC showed the following:
2 12345678910 eni-1235b8ca 203.0.113.12 172.31.16.139 0 0 1 4 336 1432917027 1432917142 ACCEPT OK  
2 12345678910 eni-1235b8ca 172.31.16.139 203.0.113.12 0 0 1 4 336 1432917094 1432917142 REJECT OK

What action should be performed to allow the ping to work?
  1. A In the security group of the EC2 instance, allow inbound ICMP traffic.
  2. B In the security group of the EC2 instance, allow outbound ICMP traffic.
  3. C In the VPC’s NACL, allow inbound ICMP traffic.
  4. D In the VPC’s NACL, allow outbound ICMP traffic.
Xem giải thích

🧩 Phân tích chi tiết câu hỏi trắc nghiệm AWS

📘 Nội dung câu hỏi:
Câu hỏi mô tả tình huống một kỹ sư bảo mật đang bảo mật kết nối giữa VPC của công ty và data center on-premises. Họ gửi lệnh ping từ host on-premises (IP: 203.0.113.12) đến instance Amazon EC2 (IP: 172.31.16.139), nhưng không nhận được phản hồi. VPC Flow Logs hiển thị hai dòng log sau:

2 12345678910 eni-1235b8ca 203.0.113.12 172.31.16.139 0 0 1 4 336 1432917027 1432917142 ACCEPT OK  
2 12345678910 eni-1235b8ca 172.31.16.139 203.0.113.12 0 0 1 4 336 1432917094 1432917142 REJECT OK
  • Giải thích Flow Logs (phiên bản 2):
    • Dòng 1: Gói tin ICMP Echo Request từ on-premises (203.0.113.12) → EC2 (172.31.16.139) được ACCEPT (cho phép inbound vào ENI của EC2).
    • Dòng 2: Gói tin ICMP Echo Reply (phản hồi ping) từ EC2 (172.31.16.139) → on-premises (203.0.113.12) bị REJECT (từ chối outbound từ ENI).
      Vấn đề cốt lõi: Ping request đến được EC2 (inbound OK), nhưng response không thể rời khỏi VPC (outbound bị chặn). Điều này thường xảy ra do Network ACL (NACL) stateless yêu cầu quy tắc riêng cho inbound/outbound, trong khi Security Group (SG) stateful tự động cho phép response nếu inbound đã OK.
      Câu hỏi yêu cầu hành động để ping hoạt động, tức là khắc phục REJECT ở outbound ICMP.

✅ Đáp án đúng:
In the VPC’s NACL, allow outbound ICMP traffic.

🛠️ Lý do chọn đáp án đúng (chi tiết):

  • Flow Logs cho thấy inbound ICMP (từ on-premises → EC2) đã ACCEPT, nghĩa là SG và NACL inbound đã cho phép ICMP Echo Request (protocol 1, type 8).
  • Outbound ICMP Echo Reply (từ EC2 → on-premises) bị REJECT, chỉ có thể do NACL outbound rule thiếu quy tắc cho phép ICMP (ALL ICMP hoặc cụ thể Echo Reply: type 0).
  • NACL là stateless: Phải explicit allow cả hai chiều (inbound/outbound). SG stateful sẽ tự động allow response, nên không cần chỉnh SG outbound.
  • Hành động: Thêm rule trong NACL của subnet chứa ENI (eni-1235b8ca): Outbound → ICMP → All ICMP - IPv4 → Allow → 0.0.0.0/0 (hoặc cụ thể hơn).
  • Kiến thức cập nhật 2026: VPC Flow Logs vẫn hỗ trợ version 2 (AWS VPC User Guide), NACL quy tắc không thay đổi cơ bản (AWS docs: "NACLs are stateless").

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

  • ❌ [SAI] In the security group of the EC2 instance, allow inbound ICMP traffic.
    Inbound ICMP đã ACCEPT trong Flow Logs (request vào ENI OK). SG inbound nếu chưa allow thì request đã bị REJECT ngay từ đầu. Không cần chỉnh vì vấn đề ở outbound.

  • ❌ [SAI] In the security group of the EC2 instance, allow outbound ICMP traffic.
    SG là stateful: Nếu inbound ICMP đã allow (như log ACCEPT), SG tự động cho phép outbound response (Echo Reply). Vấn đề REJECT ở NACL outbound, không phải SG (SG reject sẽ là REJECT ở cả hai chiều hoặc sớm hơn).

  • ❌ [SAI] In the VPC’s NACL, allow inbound ICMP traffic.
    Inbound ICMP đã ACCEPT (request từ on-premises vào subnet/EC2 OK). Chỉ outbound bị REJECT, nên chỉnh inbound NACL là thừa và không giải quyết vấn đề.

  • ✅ [ĐÚNG] In the VPC’s NACL, allow outbound ICMP traffic.
    Đúng như giải thích trên: REJECT chỉ ở outbound Echo Reply → Thêm rule NACL outbound cho ICMP để response rời khỏi ENI/subnet. Ping sẽ thành công ngay sau đó.

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

Câu 166
A company developed an application by using AWS Lambda, Amazon S3, Amazon Simple Notification Service (Amazon SNS), and Amazon DynamoDB. An external application puts objects into the company's S3 bucket and tags the objects with date and time. A Lambda function periodically pulls data from the company's S3 bucket based on date and time tags and inserts specific values into a DynamoDB table for further processing.
The data includes personally identifiable information (PII). The company must remove data that is older than 30 days from the S3 bucket and the DynamoDB table.
Which solution will meet this requirement with the MOST operational efficiency?
  1. A Update the Lambda function to add a TTL S3 flag to S3 objects. Create an S3 Lifecycle policy to expire objects that are older than 30 days by using the TTL S3 flag.
  2. B Create an S3 Lifecycle policy to expire objects that are older than 30 days. Update the Lambda function to add the TTL attribute in the DynamoDB table. Enable TTL on the DynamoDB table to expire entries that are older than 30 days based on the TTL attribute.
  3. C Create an S3 Lifecycle policy to expire objects that are older than 30 days and to add all prefixes to the S3 bucket. Update the Lambda function to delete entries that are older than 30 days.
  4. D Create an S3 Lifecycle policy to expire objects that are older than 30 days by using object tags. Update the Lambda function to delete entries that are older than 30 days.
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 AWS sử dụng AWS Lambda, Amazon S3, Amazon SNS (dù không trực tiếp liên quan đến yêu cầu xóa dữ liệu), và Amazon DynamoDB. Một ứng dụng bên ngoài đẩy các object vào bucket S3 và gắn tag với date và time. Hàm Lambda định kỳ pull dữ liệu từ S3 dựa trên các tag này rồi insert các giá trị cụ thể vào bảng DynamoDB để xử lý tiếp. Dữ liệu chứa PII (Personally Identifiable Information - thông tin nhận dạng cá nhân), nên công ty phải xóa dữ liệu cũ hơn 30 ngày khỏi cả S3 bucket và DynamoDB table.

Yêu cầu chính: Giải pháp nào đáp ứng với MOST operational efficiency (hiệu quả vận hành cao nhất)? Nghĩa là ưu tiên giải pháp tự động, serverless, không cần can thiệp thủ công thường xuyên, chi phí thấp, và tận dụng tính năng native của AWS (theo best practices AWS đến năm 2026, tập trung vào automation và managed services).

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

  • Amazon S3 Lifecycle Management (hỗ trợ expire object dựa trên age mà không cần tag đặc biệt).
  • Amazon DynamoDB TTL (Time to Live) (tự động xóa item sau thời gian định sẵn, hiệu quả cao đến 2026).
  • AWS Well-Architected Framework: Reliability & Cost Optimization Pillars (tối ưu hóa lifecycle tự động).

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

Đáp án đúng là phương án thứ 2.

🛠️ Lý do:

  • S3 Lifecycle policy có thể expire object dựa trực tiếp trên độ tuổi (age > 30 ngày) mà không cần tag hay flag đặc biệt, tự động và serverless – đây là tính năng native hiệu quả nhất, không tốn Lambda invocation thêm.
  • Lambda update để thêm TTL attribute vào DynamoDB item (ví dụ: timestamp), rồi enable TTL trên table sẽ tự động xóa item cũ hơn 30 ngày mà không cần query/delete thủ công, tiết kiệm chi phí (TTL free, xóa background).
  • Operational efficiency cao nhất: Toàn bộ tự động, không custom code phức tạp, scale vô hạn, phù hợp dữ liệu PII (tuân thủ GDPR/HIPAA). Theo AWS 2026, đây là best practice cho data retention.

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

  • Phương án 1: Update the Lambda function to add a TTL S3 flag to S3 objects. Create an S3 Lifecycle policy to expire objects that are older than 30 days by using the TTL S3 flag.
    ❌ Sai: S3 không có "TTL S3 flag" native (TTL chỉ có ở DynamoDB). S3 Lifecycle expire dựa trên age, tag, hoặc storage class, không dùng "flag" tùy chỉnh từ Lambda. Việc update Lambda để add flag là over-engineering, tốn chi phí invocation, kém hiệu quả. Không tận dụng native features.

  • Phương án 2 (ĐÚNG): Create an S3 Lifecycle policy to expire objects that are older than 30 days. Update the Lambda function to add the TTL attribute in the DynamoDB table. Enable TTL on the DynamoDB table to expire entries that are older than 30 days based on the TTL attribute.
    ✅ Đúng: Như giải thích trên. S3 Lifecycle expire pure bằng age (không cần tag date/time hiện có), DynamoDB TTL tự động xóa dựa trên attribute từ Lambda – zero-effort vận hành sau setup, scale tốt, chi phí thấp nhất.

  • Phương án 3: Create an S3 Lifecycle policy to expire objects that are older than 30 days and to add all prefixes to the S3 bucket. Update the Lambda function to delete entries that are older than 30 days.
    ❌ Sai: Lifecycle không "add all prefixes" (prefix chỉ filter rule, không phải action). Phần DynamoDB yêu cầu Lambda delete thủ công (query + delete loop) là inefficient: tốn RCU/WCU, invocation thường xuyên, dễ lỗi scale, không serverless. Kém hơn TTL native.

  • Phương án 4: Create an S3 Lifecycle policy to expire objects that are older than 30 days by using object tags. Update the Lambda function to delete entries that are older than 30 days.
    ❌ Sai: S3 Lifecycle có thể expire bằng tag, nhưng object đã có tag date/time từ external app – tuy nhiên, không cần thiết vì expire by age đơn giản hơn, hiệu quả hơn (tag có thể không chuẩn format). DynamoDB lại Lambda delete thủ công như phương án 3: không scalable, tốn kém, không best practice so với TTL.

🧠 Kết luận: Giải pháp đúng tận dụng native automation của AWS (S3 Lifecycle + DynamoDB TTL), giảm thiểu custom code và vận hành thủ công – phù hợp DevOps Professional! 🚀

Câu 167 Chọn nhiều đáp án
What are the MOST secure ways to protect the AWS account root user of a recently opened AWS account? (Choose two.)
  1. A Use the AWS account root user access keys instead of the AWS Management Console.
  2. B Enable multi-factor authentication for the AWS IAM users with the AdministratorAccess managed policy attached to them.
  3. C Use AWS KMS to encrypt all AWS account root user and AWS IAM access keys and set automatic rotation to 30 days.
  4. D Do not create access keys for the AWS account root user; instead, create AWS IAM users.
  5. E Enable multi-factor authentication for the AWS account root user.
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 các cách bảo mật NHẤT (MOST secure ways) để bảo vệ tài khoản root user của một tài khoản AWS mới mở (recently opened AWS account).

  • Root user là tài khoản gốc được tạo tự động khi mở tài khoản AWS, sở hữu quyền toàn diện (full privileges) trên toàn bộ dịch vụ AWS, không thể thay đổi hoặc xóa. Đây là "chìa khóa vạn năng" nên rất dễ bị tấn công nếu không bảo vệ đúng cách (ví dụ: phishing, credential leak).
  • AWS khuyến nghị tránh sử dụng root user hàng ngày, chỉ dùng cho các nhiệm vụ đặc biệt như thay đổi billing, kích hoạt MFA, hoặc tạo IAM users đầu tiên.
  • Câu hỏi yêu cầu chọn TWO (2) phương án tốt nhất theo best practices mới nhất của AWS (cập nhật đến 2024-2026), nhấn mạnh vào việc giảm thiểu rủi ro credential exposure và tăng cường xác thực.

Mục tiêu chính: Giảm sử dụng root user, loại bỏ access keys (vì chúng dễ bị đánh cắp), và bật MFA để chống brute-force/phishing. 🛡️

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

Hai đáp án đúng là (theo AWS IAM Best Practices và Security Pillar trong Well-Architected Framework):

  • Do not create access keys for the AWS account root user; instead, create AWS IAM users.
  • Enable multi-factor authentication for the AWS account root user.

Lý do lựa chọn:

  • Đây là hai biện pháp cốt lõi, ưu tiên hàng đầu mà AWS khuyến nghị ngay khi mở tài khoản mới. Không tạo access keys cho root user giúp tránh rò rỉ credential qua API/CLI (root access keys không thể xoay vòng tự động và rất nguy hiểm). Thay vào đó, dùng IAM users với quyền hạn chế cho công việc hàng ngày.
  • Bật MFA cho root user là bắt buộc, tăng lớp bảo vệ thứ hai (something you know + something you have), giảm 99.9% rủi ro từ credential bị đánh cắp. AWS gửi email nhắc nhở bật MFA ngay khi đăng nhập lần đầu. 🛡️
  • Các biện pháp này đơn giản, hiệu quả cao nhất, phù hợp với nguyên tắc "least privilege" và "zero trust" trong AWS Guardrails (cập nhật GuardDuty và IAM Access Analyzer 2024-2026).

🧩 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, giữ nguyên văn bản gốc bằng tiếng Anh. Mỗi phương án được đánh giá dựa trên AWS documentation mới nhất (2026):

  • ❌ Use the AWS account root user access keys instead of the AWS Management Console.
    Sai hoàn toàn: Phương án này tăng rủi ro thay vì bảo vệ! AWS cấm khuyến nghị tạo access keys cho root user vì chúng có quyền vô hạn, dễ bị lộ qua code/script, và không thể thu hồi dễ dàng. Nên dùng Console với MFA thay vì access keys. (Vi phạm nguyên tắc "Avoid root user programmatic access").

  • ❌ Enable multi-factor authentication for the AWS IAM users with the AdministratorAccess managed policy attached to them.
    Sai vì lệch trọng tâm: Câu hỏi chỉ hỏi về root user, không phải IAM users. MFA cho IAM admins là tốt nhưng không bảo vệ root (root vẫn có thể bị tấn công độc lập). AWS yêu cầu MFA riêng cho root trước tiên.

  • ❌ Use AWS KMS to encrypt all AWS account root user and AWS IAM access keys and set automatic rotation to 30 days.
    Sai về kỹ thuật và logic:

    • Access keys không thể mã hóa bằng KMS theo cách này (KMS dùng cho data-at-rest như S3/EBS, không phải credentials).
    • Root access keys không hỗ trợ rotation tự động (chỉ IAM keys mới có). AWS cấm tạo root keys từ đầu, và 30 ngày quá ngắn so với best practice (90-180 ngày cho IAM). Đây là hiểu lầm về KMS Customer Managed Keys.
  • ✅ Do not create access keys for the AWS account root user; instead, create AWS IAM users.
    Đúng tuyệt đối: Đây là best practice số 1 từ AWS. Không tạo root access keys → loại bỏ rủi ro API exposure. Dùng IAM users với scoped policies cho daily ops (tạo IAM master user ngay sau khi mở account). Giảm bề mặt tấn công 100%.

  • ✅ Enable multi-factor authentication for the AWS account root user.
    Đúng tuyệt đối: Biện pháp bảo mật đầu tiên và bắt buộc. MFA (virtual/hardware như YubiKey) chặn 100% account takeover từ password bị lộ. AWS tự động nhắc và hỗ trợ FIDO2 WebAuthn từ 2023 (cập nhật 2026).

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

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

Câu 168
A company is expanding its group of stores. On the day that each new store opens, the company wants to launch a customized web application for that store. Each store's application will have a non-production environment and a production environment. Each environment will be deployed in a separate AWS account. The company uses AWS Organizations and has an OU that is used only for these accounts.
The company distributes most of the development work to third-party development teams. A security engineer needs to ensure that each team follows the company's deployment plan for AWS resources. The security engineer also must limit access to the deployment plan to only the developers who need access. The security engineer already has created an AWS CloudFormation template that implements the deployment plan.
What should the security engineer do next to meet the requirements in the MOST secure way?
  1. A Create an AWS Service Catalog portfolio in the organization's management account. Upload the CloudFormation template. Add the template to the portfolio's product list. Share the portfolio with the OU.
  2. B Use the CloudFormation CLI to create a module from the CloudFormation template. Register the module as a private extension in the CloudFormation registry. Publish the extension. In the OU, create an SCP that allows access to the extension.
  3. C Create an AWS Service Catalog portfolio in the organization's management account. Upload the CloudFormation template. Add the template to the portfolio's product list. Create an IAM role that has a trust policy that allows cross-account access to the portfolio for users in the OU accounts. Attach the AWSServiceCatalogEndUserFullAccess managed policy to the role.
  4. D Use the CloudFormation CLI to create a module from the CloudFormation template. Register the module as a private extension in the CloudFormation registry. Publish the extension. Share the extension with the OU.
Xem giải thích

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

Câu hỏi mô tả một công ty đang mở rộng chuỗi cửa hàng, với mỗi cửa hàng mới cần triển khai ứng dụng web tùy chỉnh có hai môi trường riêng biệt (non-production và production), mỗi môi trường nằm trong tài khoản AWS riêng. Công ty sử dụng AWS Organizations với một Organizational Unit (OU) dành riêng cho các tài khoản này.
Phần lớn công việc phát triển được giao cho các đội third-party, và kỹ sư bảo mật cần:

  • Đảm bảo mỗi đội tuân thủ kế hoạch triển khai tài nguyên AWS (đã có sẵn dưới dạng AWS CloudFormation template).
  • Giới hạn truy cập vào kế hoạch triển khai chỉ cho các developer cần thiết.

Yêu cầu là chọn giải pháp an toàn nhất (MOST secure) để đạt được điều này.
🛠️ Mục tiêu chính: Phân phối template CloudFormation một cách kiểm soát, tuân thủ, và bảo mật cao trong môi trường multi-account với Organizations, tránh cấp quyền rộng rãi cho third-party.

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

Đáp án đúng: Create an AWS Service Catalog portfolio in the organization's management account. Upload the CloudFormation template. Add the template to the portfolio's product list. Share the portfolio with the OU.

Lý do chọn đáp án này (theo phiên bản AWS mới nhất 2024-2026):

  • AWS Service Catalog là dịch vụ lý tưởng để quản lý và phân phối CloudFormation templates dưới dạng products trong portfolios. Tạo portfolio ở management account của Organizations, upload template, thêm vào product list, rồi chia sẻ trực tiếp với OU (feature "Portfolio sharing with AWS Organizations").
  • Điều này cho phép các tài khoản trong OU tự động truy cập portfolio mà không cần cấu hình IAM role phức tạp, chỉ end-users (developers) với quyền Service Catalog cơ bản có thể launch products (triển khai stack từ template).
  • MOST secure vì:
    • Kiểm soát chặt chẽ (chỉ template được phê duyệt mới deploy được).
    • Third-party chỉ access những gì cần, không full admin.
    • Tích hợp Organizations, hỗ trợ SCP để giới hạn thêm nếu cần.
  • Hoàn hảo cho multi-account, đảm bảo compliance và least privilege.

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

📋 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, giữ nguyên nội dung gốc bằng tiếng Anh. Mỗi phương án được đánh giá đúng/sai với lý do cụ thể dựa trên best practices AWS DevOps và security.

  • Create an AWS Service Catalog portfolio in the organization's management account. Upload the CloudFormation template. Add the template to the portfolio's product list. Share the portfolio with the OU.
    ✅ Đúng - Như đã giải thích ở trên. Đây là cách chuẩn và an toàn nhất, tận dụng tính năng native sharing của Service Catalog với OU, không cần thêm role hay SCP phức tạp, đảm bảo third-party chỉ deploy đúng template mà không vượt quyền.

  • Use the CloudFormation CLI to create a module from the CloudFormation template. Register the module as a private extension in the CloudFormation registry. Publish the extension. In the OU, create an SCP that allows access to the extension.
    ❌ Sai - CloudFormation modules/extensions dùng để tái sử dụng code (như macros hoặc reusable components) trong template, không phải để phân phối deployment plan cho third-party.

    • Private extensions chỉ đăng ký ở một region/account, không share dễ dàng với OU.
    • SCP chỉ "allow access" nhưng không cung cấp UI/control như Service Catalog, dẫn đến rủi ro deploy không kiểm soát. Không phải MOST secure cho multi-account.
  • Create an AWS Service Catalog portfolio in the organization's management account. Upload the CloudFormation template. Add the template to the portfolio's product list. Create an IAM role that has a trust policy that allows cross-account access to the portfolio for users in the OU accounts. Attach the AWSServiceCatalogEndUserFullAccess managed policy to the role.
    ❌ Sai - Mặc dù dùng Service Catalog đúng hướng, nhưng thêm IAM role cross-account là thừa và kém an toàn hơn.

    • Service Catalog hỗ trợ share trực tiếp với OU mà không cần role (tính năng ưu tiên).
    • Role với AWSServiceCatalogEndUserFullAccess cấp quyền rộng ("FullAccess"), có thể bị lạm dụng bởi third-party, vi phạm least privilege. Không phải cách tối ưu/MOST secure.
  • Use the CloudFormation CLI to create a module from the CloudFormation template. Register the module as a private extension in the CloudFormation registry. Publish the extension. Share the extension with the OU.
    ❌ Sai - CloudFormation extensions/modules không hỗ trợ "share with OU" trực tiếp như Service Catalog.

    • Extensions là global/private trong registry, nhưng phân phối yêu cầu publish public (rủi ro bảo mật cao) hoặc manual setup per-account.
    • Không có cơ chế kiểm soát access cho developers/third-party như portfolio, dễ dẫn đến deploy sai hoặc không compliance. Không phù hợp cho yêu cầu.

🛠️ Tóm tắt best practice: Trong AWS Organizations (2026), ưu tiên Service Catalog + OU sharing cho governance CloudFormation ở multi-account. Tránh extensions cho phân phối template lớn, và không dùng role thừa để giữ security cao! 🚀

Câu 169
A team is using AWS Secrets Manager to store an application database password. Only a limited number of IAM principals within the account can have access to the secret. The principals who require access to the secret change frequently. A security engineer must create a solution that maximizes flexibility and scalability.
Which solution will meet these requirements?
  1. A Use a role-based approach by creating an IAM role with an inline permissions policy that allows access to the secret. Update the IAM principals in the role trust policy as required.
  2. B Deploy a VPC endpoint for Secrets Manager. Create and attach an endpoint policy that specifies the IAM principals that are allowed to access the secret. Update the list of IAM principals as required.
  3. C Use a tag-based approach by attaching a resource policy to the secret. Apply tags to the secret and the IAM principals. Use the aws:PrincipalTag and aws:ResourceTag IAM condition keys to control access.
  4. D Use a deny-by-default approach by using IAM policies to deny access to the secret explicitly. Attach the policies to an IAM group. Add all IAM principals to the IAM group. Remove principals from the group when they need access. Add the principals to the group again when access is no longer allowed.
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 quản lý quyền truy cập vào một bí mật (secret) được lưu trữ trong AWS Secrets Manager, cụ thể là mật khẩu cơ sở dữ liệu của ứng dụng. 🔒

  • Yêu cầu chính: Chỉ một số IAM principals (như users, roles) hạn chế trong account được phép truy cập secret này.
  • Thách thức: Các principals cần truy cập thay đổi thường xuyên, đòi hỏi giải pháp phải tối ưu hóa tính linh hoạt (flexibility) và khả năng mở rộng (scalability).
  • Mục tiêu: Security engineer cần thiết kế solution cho phép dễ dàng cấp/thu hồi quyền mà không làm gián đoạn hệ thống, phù hợp với best practices của AWS về Attribute-Based Access Control (ABAC) sử dụng tags.
    📘 Tài liệu tham khảo: AWS Secrets Manager User Guide - Resource-based policies và IAM Condition Keys for Secrets Manager (cập nhật đến 2026, hỗ trợ ABAC với tags cho scalability cao).

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

Đáp án đúng: Use a tag-based approach by attaching a resource policy to the secret. Apply tags to the secret and the IAM principals. Use the aws:PrincipalTag and aws:ResourceTag IAM condition keys to control access.

Lý do chọn 🛠️:

  • Phương án này sử dụng resource policy (chính sách dựa trên tài nguyên) gắn trực tiếp vào secret trong Secrets Manager, kết hợp tags trên secret và IAM principals.
  • Sử dụng condition keys như aws:PrincipalTag (kiểm tra tag trên principal) và aws:ResourceTag (kiểm tra tag trên secret) để cấp quyền động. Ví dụ: Principal có tag AccessLevel: Admin mới được GetSecretValue.
  • Linh hoạt & scalable: Khi principals thay đổi, chỉ cần thêm/xóa tags trên IAM users/roles (qua AWS CLI/API), không cần chỉnh sửa policy. Hỗ trợ hàng nghìn principals mà không vượt limit policy (resource policy Secrets Manager cho phép lên đến 10 policies/secret). Đây là ABAC best practice của AWS, giảm admin overhead.

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

Dưới đây là phân tích chi tiết từng lựa chọn, giữ nguyên nội dung gốc bằng tiếng Anh. Mỗi phương án được đánh giá đúng/sai với lý do cụ thể dựa trên tính linh hoạt và scalability.

  • ❌ Phương án SAI: Use a role-based approach by creating an IAM role with an inline permissions policy that allows access to the secret. Update the IAM principals in the role trust policy as required.
    Giải thích: Cách này tạo IAM role với permissions policy cho phép truy cập secret, rồi chỉnh trust policy để chỉ định principals assume role. Tuy nhiên, không scalable vì trust policy có giới hạn số principals (max 2 statements/role theo IAM limits 2026), và chỉnh sửa thường xuyên gây downtime + rủi ro lỗi syntax. Không phù hợp khi principals thay đổi liên tục.

  • ❌ Phương án SAI: Deploy a VPC endpoint for Secrets Manager. Create and attach an endpoint policy that specifies the IAM principals that are allowed to access the secret. Update the list of IAM principals as required.
    Giải thích: VPC endpoint policy chỉ kiểm soát traffic qua endpoint (từ VPC đến Secrets Manager), không trực tiếp grant access đến secret cho IAM principals. Phải liệt kê principals cụ thể trong policy, dẫn đến không linh hoạt khi update thường xuyên (giới hạn policy size, cần redeploy endpoint). Không giải quyết core vấn đề IAM access control.

  • ✅ Phương án ĐÚNG: Use a tag-based approach by attaching a resource policy to the secret. Apply tags to the secret and the IAM principals. Use the aws:PrincipalTag and aws:ResourceTag IAM condition keys to control access.
    Giải thích: Như đã nêu ở phần đáp án đúng. Đây là giải pháp tối ưu, tận dụng resource-based policy của Secrets Manager (hỗ trợ từ 2018, cập nhật ABAC đầy đủ đến 2026). Tags dễ quản lý qua automation (Lambda + EventBridge), hỗ trợ audit qua CloudTrail.

  • ❌ Phương án SAI: Use a deny-by-default approach by using IAM policies to deny access to the secret explicitly. Attach the policies to an IAM group. Add all IAM principals to the IAM group. Remove principals from the group when they need access. Add the principals to the IAM group again when access is no longer allowed.
    Giải thích: Cách "deny-by-default" với IAM group yêu cầu add/remove principals khỏi group thường xuyên, ngược với logic (remove để grant access?). Không hiệu quả & rủi ro cao: Quản lý group thủ công gây hỗn loạn , khó scale với principals thay đổi nhanh, và vi phạm least privilege (toàn bộ principals ban đầu bị deny). IAM groups không phải thiết kế cho dynamic access.

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

  • Ví dụ policy resource (JSON snippet):
    {
      "Version": "2012-10-17",
      "Statement": [{
        "Effect": "Allow",
        "Principal": "*",
        "Action": "secretsmanager:GetSecretValue",
        "Resource": "*",
        "Condition": {
          "StringEquals": {"aws:PrincipalTag/AccessTier": "${aws:ResourceTag/AccessTier}"}
        }
      }]
    }
    
  • Automation: Sử dụng Lambda để auto-tag principals dựa trên request từ service catalog.
    📘 Tài liệu bổ sung: AWS Well-Architected Framework - Security Pillar (2026 edition nhấn mạnh ABAC cho Secrets Manager).

Hy vọng phân tích này giúp bạn ôn thi DOP-C02 hiệu quả! 🚀

Câu 170
A company is hosting a web application on Amazon EC2 instances behind an Application Load Balancer (ALB). The application has become the target of a DoS attack. Application logging shows that requests are coming from a small number of client IP addresses, but the addresses change regularly.
The company needs to block the malicious traffic with a solution that requires the least amount of ongoing effort.
Which solution meets these requirements?
  1. A Create an AWS WAF rate-based rule, and attach it to the ALB.
  2. B Update the security group that is attached to the ALB to block the attacking IP addresses.
  3. C Update the ALB subnet's network ACL to block the attacking client IP addresses.
  4. D Create an AWS WAF rate-based rule, and attach it to the security group of the EC2 instances.
Xem giải thích

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

Câu hỏi mô tả một tình huống thực tế trong AWS: Một công ty đang chạy web application trên các instance Amazon EC2 phía sau Application Load Balancer (ALB). Ứng dụng bị tấn công DoS (Denial of Service), với log cho thấy yêu cầu đến từ số lượng nhỏ IP client, nhưng IP này thay đổi thường xuyên.
📌 Yêu cầu chính: Chặn traffic độc hại (block malicious traffic) bằng giải pháp đòi hỏi ít nỗ lực liên tục nhất (least amount of ongoing effort).
🛠️ Thách thức: Vì IP tấn công thay đổi liên tục, không thể block thủ công từng IP (như dùng blacklist cố định). Cần giải pháp tự động, dựa trên hành vi (như rate limiting) và tích hợp dễ dàng với ALB để giảm thiểu quản lý thủ công.

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

Đáp án đúng: Create an AWS WAF rate-based rule, and attach it to the ALB.

Lý do chi tiết:

  • AWS WAF (Web Application Firewall) hỗ trợ rate-based rule – quy tắc giới hạn số lượng request từ một IP cụ thể trong khoảng thời gian (ví dụ: 2000 requests/5 phút). Điều này hoàn hảo cho DoS từ ít IP thay đổi, vì không cần biết IP cụ thể mà chỉ dựa trên tỷ lệ request (rate).
  • Attach trực tiếp vào ALB: WAF tích hợp native với ALB (từ phiên bản AWS mới nhất 2024-2026), chặn traffic từ tầng 7 trước khi đến EC2, giảm tải server.
  • Ít nỗ lực nhất: Tự động, không cần cập nhật thủ công IP (chỉ set threshold một lần), scale theo traffic ALB. Đây là best practice cho DDoS/DoS mitigation theo AWS Well-Architected Framework (Security Pillar).
    📘 Tài liệu tham khảo: AWS WAF Rate-based Rules, Integrate WAF with ALB (cập nhật 2025).

📋 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, với ✅ đúng hoặc ❌ sai, lý do dựa trên kiến thức AWS mới nhất (2026):

  • ✅ Create an AWS WAF rate-based rule, and attach it to the ALB.
    🛠️ Đúng vì: Như giải thích trên, rate-based rule tự động block dựa trên rate từ IP (5 phút window, hỗ trợ lên đến 100.000 rules/scope). Attach ALB qua Web ACL, inspect HTTP/HTTPS traffic hiệu quả. Zero-effort ongoing sau setup. Hoạt động với ALBv2 (mặc định hiện nay).

  • ❌ Update the security group that is attached to the ALB to block the attacking IP addresses.
    🚫 Sai vì: Security Group (SG) của ALB chỉ cho phép inbound rules dựa trên port/protocol, không hỗ trợ block IP cụ thể dễ dàng (phải add deny rule thủ công, nhưng SG là allow-only, không có explicit deny). IP thay đổi → phải update liên tục (high ongoing effort). SG ALB chỉ protect ALB, không inspect Layer 7.

  • ❌ Update the ALB subnet's network ACL to block the attacking client IP addresses.
    🚫 Sai vì: Network ACL (NACL) là stateless, hỗ trợ deny IP nhưng phải config cả inbound/outbound rules thủ công. IP thay đổi thường xuyên → cần monitor log và update NACL liên tục (rất tốn effort). NACL ở subnet level, block toàn subnet (không granular như ALB), và không handle Layer 7 attacks tốt.

  • ❌ Create an AWS WAF rate-based rule, and attach it to the security group of the EC2 instances.
    🚫 Sai vì: WAF không hỗ trợ attach trực tiếp vào Security Group của EC2. WAF chỉ integrate với ALB, NLB, CloudFront, API Gateway, AppSync (không phải SG). Nếu attach sai chỗ, traffic độc hại vẫn đến EC2 trước khi block, không hiệu quả và vi phạm thiết kế (ALB nên là first line defense).

🏆 Kết luận & Best Practice

Giải pháp WAF rate-based trên ALB là optimal cho scenario này: Tự động, scalable, low-effort. Kết hợp với AWS Shield nếu DoS lớn hơn. Theo AWS 2026, khuyến nghị dùng WAF v2 với managed rulesets cho zero-config protection.
📘 Tham khảo thêm: AWS DDoS Protection Whitepaper, ALB Security Best Practices.