Ngân hàng đề — AWS Certified Solutions Architect Professional

Tìm thấy 1221 câu.

Câu 1101
A company is deploying AWS Lambda functions that access an Amazon RDS for PostgreSQL database. The company needs to launch the Lambda functions in a QA environment and in a production environment.

The company must not expose credentials within application code and must rotate passwords automatically.

Which solution will meet these requirements?
  1. A Store the database credentials for both environments in AWS Systems Manager Parameter Store. Encrypt the credentials by using an AWS Key Management Service (AWS KMS) key. Within the application code of the Lambda functions, pull the credentials from the Parameter Store parameter by using the AWS SDK for Python (Boto3). Add a role to the Lambda functions to provide access to the Parameter Store parameter.
  2. B Store the database credentials for both environments in AWS Secrets Manager with distinct key entry for the QA environment and the production environment. Turn on rotation. Provide a reference to the Secrets Manager key as an environment variable for the Lambda functions.
  3. C Store the database credentials for both environments in AWS Key Management Service (AWS KMS). Turn on rotation. Provide a reference to the credentials that are stored in AWS KMS as an environment variable for the Lambda functions.
  4. D Create separate S3 buckets for the QA environment and the production environment. Turn on server-side encryption with AWS KMS keys (SSE-KMS) for the S3 buckets. Use an object naming pattern that gives each Lambda function’s application code the ability to pull the correct credentials for the function's corresponding environment. Grant each Lambda function's execution role access to Amazon S3.
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ý credentials (tài khoản truy cập) cho các hàm AWS Lambda kết nối với Amazon RDS for PostgreSQL ở hai môi trường QA và Production. Các yêu cầu chính là:

  • Không expose credentials trực tiếp trong mã nguồn ứng dụng (tránh hardcode để tăng bảo mật).
  • Tự động rotate (xoay vòng) passwords định kỳ, giúp giảm rủi ro bảo mật nếu credentials bị lộ.
    🛠️ Bối cảnh AWS cập nhật đến 2026: AWS khuyến nghị sử dụng các dịch vụ chuyên dụng như AWS Secrets Manager cho việc lưu trữ và quản lý secrets động (như DB credentials), hỗ trợ rotation tự động tích hợp với RDS PostgreSQL (qua Lambda rotation function). Lambda hỗ trợ tham chiếu secrets qua environment variables mà không cần pull thủ công, giảm độ phức tạp và tăng bảo mật.

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

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

Đáp án đúng là phương án thứ hai:
Store the database credentials for both environments in AWS Secrets Manager with distinct key entry for the QA environment and the production environment. Turn on rotation. Provide a reference to the Secrets Manager key as an environment variable for the Lambda functions.

Lý do:

  • AWS Secrets Manager là dịch vụ chuyên biệt để lưu trữ secrets (credentials DB), hỗ trợ tạo distinct secrets riêng cho QA và Prod (dùng tên prefix như qa/db-creds và prod/db-creds).
  • Turn on rotation kích hoạt xoay vòng tự động passwords cho RDS PostgreSQL (sử dụng Lambda rotation lambda mặc định của AWS).
  • Environment variable reference cho Lambda (ARN của secret) cho phép Lambda tự động retrieve secrets mà không cần code pull thủ công, tránh expose và tuân thủ nguyên tắc least privilege qua IAM role.
    ✅ Đây là best practice của AWS cho DevOps Professional (DOP-C02 exam), đảm bảo bảo mật cao, tự động hóa và phân tách môi trường.

🔍 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 văn bản gốc bằng tiếng Anh, kèm đánh giá đúng/sai và lý do bằng tiếng Việt:

  • Phương án 1:
    Store the database credentials for both environments in AWS Systems Manager Parameter Store. Encrypt the credentials by using an AWS Key Management Service (AWS KMS) key. Within the application code of the Lambda functions, pull the credentials from the Parameter Store parameter by using the AWS SDK for Python (Boto3). Add a role to the Lambda functions to provide access to the Parameter Store parameter.
    ❌ Sai: Parameter Store phù hợp lưu config tĩnh nhưng không hỗ trợ rotation tự động cho passwords DB. Phải pull thủ công qua Boto3 trong code, vi phạm yêu cầu "không expose trong code" (code phải chứa logic retrieve, tăng rủi ro). Không phân tách rõ QA/Prod một cách tự động.

  • Phương án 2 (Đúng - như đã giải thích ở trên):
    Store the database credentials for both environments in AWS Secrets Manager with distinct key entry for the QA environment and the production environment. Turn on rotation. Provide a reference to the Secrets Manager key as an environment variable for the Lambda functions.
    ✅ Đúng: Hoàn hảo đáp ứng không expose code, rotation tự động, phân tách môi trường qua distinct secrets và env var reference (Lambda runtime tự handle).

  • Phương án 3:
    Store the database credentials for both environments in AWS Key Management Service (AWS KMS). Turn on rotation. Provide a reference to the credentials that are stored in AWS KMS as an environment variable for the Lambda functions.
    ❌ Sai: KMS chỉ dùng để mã hóa/giải mã keys, không lưu trữ credentials như secrets. Không có tính năng rotation passwords hay lưu DB creds. Env var reference cũng không áp dụng vì KMS không phải secret store.

  • Phương án 4:
    Create separate S3 buckets for the QA environment and the production environment. Turn on server-side encryption with AWS KMS keys (SSE-KMS) for the S3 buckets. Use an object naming pattern that gives each Lambda function’s application code the ability to pull the correct credentials for the function's corresponding environment. Grant each Lambda function's execution role access to Amazon S3.
    ❌ Sai: S3 là object storage, không thiết kế cho secrets động (không rotation tự động, phải parse object naming trong code). SSE-KMS chỉ mã hóa object, không quản lý rotation DB passwords. Phải pull thủ công qua code, expose logic và kém bảo mật so với Secrets Manager.

🛠️ Kết luận: Phương án Secrets Manager là lựa chọn tối ưu, phù hợp AWS Well-Architected Framework (Security Pillar). Nếu triển khai thực tế, dùng CDK/Terraform để automate deployment! 🚀

Câu 1102
A company is using AWS Control Tower to manage AWS accounts in an organization in AWS Organizations. The company has an OU that contains accounts. The company must prevent any new or existing Amazon EC2 instances in the OU's accounts from gaining a public IP address.

Which solution will meet these requirements?
  1. A Configure all instances in each account in the OU to use AWS Systems Manager. Use a Systems Manager Automation runbook to prevent public IP addresses from being attached to the instances.
  2. B Implement the AWS Control Tower proactive control to check whether instances in the OU's accounts have a public IP address. Set the AssociatePublicIpAddress property to False. Attach the proactive control to the OU.
  3. C Create an SCP that prevents the launch of instances that have a public IP address. Additionally, configure the SCP to prevent the attachment of a public IP address to existing instances. Attach the SCP to the OU.
  4. D Create an AWS Config custom rule that detects instances that have a public IP address. Configure a remediation action that uses an AWS Lambda function to detach the public IP addresses from the instances.
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 Control Tower để quản lý các AWS accounts trong AWS Organizations. Công ty có một Organizational Unit (OU) chứa nhiều accounts, và yêu cầu là ngăn chặn hoàn toàn bất kỳ Amazon EC2 instances mới hoặc hiện có trong các accounts thuộc OU này không được gán public IP address.

📌 Yêu cầu cụ thể:

  • Prevent new instances: Không cho phép launch EC2 với public IP (thông qua tham số AssociatePublicIpAddress=true).
  • Prevent existing instances: Không cho phép attach hoặc gán public IP vào instances đang chạy.
  • Giải pháp phải áp dụng ở mức OU (ảnh hưởng toàn bộ accounts con), tận dụng tính năng của AWS Organizations và Control Tower.
  • Đây là vấn đề governance và compliance, cần giải pháp preventive (ngăn chặn trước) thay vì chỉ detective/remediation (phát hiện và sửa sau).

🛠️ Bối cảnh AWS mới nhất (2026): AWS Organizations hỗ trợ Service Control Policies (SCPs) để deny actions ở mức OU/account. Control Tower tích hợp SCPs và controls (detective/proactive), nhưng chỉ SCP mới enforce strict prevention cho EC2 public IP.

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

Đáp án đúng:
Create an SCP that prevents the launch of instances that have a public IP address. Additionally, configure the SCP to prevent the attachment of a public IP address to existing instances. Attach the SCP to the OU.

Lý do chi tiết:

  • SCP (Service Control Policies) là công cụ mạnh mẽ nhất trong AWS Organizations để deny các API actions cụ thể ở mức OU, áp dụng cho tất cả accounts con mà không cần config từng account riêng lẻ.
  • Prevent launch new instances: SCP deny ec2:RunInstances khi AssociatePublicIpAddress=true (hoặc qua conditions trên NetworkInterface).
  • Prevent existing instances: SCP deny ec2:ModifyNetworkInterfaceAttribute với AssociatePublicIpAddress=true, và ec2:AssociateAddress cho Elastic IP (EIP).
  • Attach to OU: Áp dụng toàn bộ, kế thừa xuống accounts, phù hợp với Control Tower (Control Tower tự động quản lý SCPs cho OUs).
  • Đây là giải pháp preventive, scalable, zero-trust theo best practices AWS 2026, không ảnh hưởng performance.

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

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

  • ❌ Phương án SAI:
    Configure all instances in each account in the OU to use AWS Systems Manager. Use a Systems Manager Automation runbook to prevent public IP addresses from being attached to the instances.
    Giải thích: AWS Systems Manager (SSM) dùng để manage và automate instances sau khi launch (như patch, inventory), không phải prevent launch hoặc enforce policy ở mức OU. Runbook chỉ reactive (chạy sau), phải config từng account thủ công, không scalable cho OU lớn. Không deny API calls gốc như RunInstances.

  • ❌ Phương án SAI:
    Implement the AWS Control Tower proactive control to check whether instances in the OU's accounts have a public IP address. Set the AssociatePublicIpAddress property to False. Attach the proactive control to the OU.
    Giải thích: Control Tower proactive controls (như Detect Instances with Public IP) chỉ check và alert (detective), không prevent launch hoặc modify. Không có control nào set AssociatePublicIpAddress=False tự động; chúng chỉ monitor. Phải dùng SCP để deny thực sự.

  • ✅ Phương án ĐÚNG (như đã giải thích ở trên):
    Create an SCP that prevents the launch of instances that have a public IP address. Additionally, configure the SCP to prevent the attachment of a public IP address to existing instances. Attach the SCP to the OU.
    Giải thích bổ sung: SCP là duy nhất meet cả new/existing instances ở OU level, theo AWS Well-Architected Framework (Security Pillar).

  • ❌ Phương án SAI:
    Create an AWS Config custom rule that detects instances that have a public IP address. Configure a remediation action that uses an AWS Lambda function to detach the public IP addresses from the instances.
    Giải thích: AWS Config custom rule chỉ detect (non-compliant nếu có public IP), remediation Lambda chỉ detach sau (reactive, có thể loop nếu user retry). Không prevent launch new instances, tốn chi phí chạy liên tục, không enforce ở OU (phải deploy rule per account/region).

🧠 Kết luận: SCP là giải pháp tối ưu, native cho governance trong Organizations/Control Tower. Nếu implement, ví dụ SCP JSON:

{
  "DenyPublicIP": {
    "Version": "2012-10-17",
    "Statement": [
      {
        "Effect": "Deny",
        "Action": ["ec2:RunInstances"],
        "Resource": "*",
        "Condition": {
          "Bool": {"ec2:AssociatePublicIpAddress": "true"}
        }
      }
    ]
  }
}

(Tham khảo docs để full policy cho existing instances).

Câu 1103
A company is deploying a third-party web application on AWS. The application is packaged as a Docker image. The company has deployed the Docker image as an AWS Fargate service in Amazon Elastic Container Service (Amazon ECS). An Application Load Balancer (ALB) directs traffic to the application.

The company needs to give only a specific list of users the ability to access the application from the internet. The company cannot change the application and cannot integrate the application with an identity provider. All users must be authenticated through multi-factor authentication (MFA).

Which solution will meet these requirements?
  1. A Create a user pool in Amazon Cognito. Configure the pool for the application. Populate the pool with the required users. Configure the pool to require MFConfigure a listener rule on the ALB to require authentication through the Amazon Cognito hosted UI.
  2. B Configure the users in AWS Identity and Access Management (IAM). Attach a resource policy to the Fargate service to require users to use MFA. Configure a listener rule on the ALB to require authentication through IAM.
  3. C Configure the users in AWS Identity and Access Management (IAM). Enable AWS IAM Identity Center (AWS Single Sign-On). Configure resource protection for the ALB. Create a resource protection rule to require users to use MFA.
  4. D Create a user pool in AWS Amplify. Configure the pool for the application. Populate the pool with the required users. Configure the pool to require MFA. Configure a listener rule on the ALB to require authentication through the Amplify hosted UI.
Xem giải thích

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

Câu hỏi xoay quanh việc triển khai một ứng dụng web bên thứ ba (third-party) trên AWS, được đóng gói dưới dạng Docker image và chạy trên dịch vụ Amazon ECS Fargate với Application Load Balancer (ALB) làm trung gian phân phối lưu lượng. 🛤️

Yêu cầu chính của công ty:

  • Chỉ cho phép một danh sách users cụ thể truy cập ứng dụng từ internet (không phải public access).
  • Không thể thay đổi ứng dụng (cannot change the application).
  • Không thể tích hợp ứng dụng với identity provider (không integrate với IdP bên trong app).
  • Tất cả users phải xác thực qua MFA (multi-factor authentication).

🛡️ Giải pháp cần tìm phải sử dụng cơ chế xác thực ở lớp mạng/load balancer (không động vào code app), hỗ trợ MFA, quản lý users độc lập, và phù hợp với kiến trúc ECS Fargate + ALB. Đây là kịch bản bảo mật phổ biến trong AWS DevOps, tận dụng authentication tại ALB listener rules để bảo vệ ứng dụng containerized mà không cần sửa code.

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

Đáp án đúng là phương án đầu tiên: Sử dụng Amazon Cognito User Pool kết hợp với ALB listener rule yêu cầu authentication qua Cognito hosted UI.

Lý do chọn 🏆:

  • Cognito User Pool cho phép tạo và quản lý danh sách users cụ thể (populate users), cấu hình MFA bắt buộc (require MFA).
  • ALB hỗ trợ authenticate action trên listener rule với Cognito hosted UI, tự động redirect users đến trang login MFA mà không cần thay đổi app hay integrate IdP vào code.
  • Đây là giải pháp chuẩn AWS cho web app public-facing cần auth/MFA, cập nhật đến 2026 (Cognito vẫn là dịch vụ chính cho user auth, tích hợp seamless với ALB/ECS). Hoàn hảo cho third-party app!

📋 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 văn bản gốc tiếng Anh. Mỗi phương án được đánh giá ✅ (đúng) hoặc ❌ (sai) kèm lý do bằng tiếng Việt:

  • Create a user pool in Amazon Cognito. Configure the pool for the application. Populate the pool with the required users. Configure the pool to require MFConfigure a listener rule on the ALB to require authentication through the Amazon Cognito hosted UI.
    ✅ Đúng hoàn toàn! Như đã giải thích ở trên. Cognito User Pool hỗ trợ MFA (TOTP hoặc SMS), ALB listener rule dùng action authenticate-cognito với hosted UI để xử lý login/MFA. Users chỉ cần trong pool mới access được, không ảnh hưởng code app. Hoạt động mượt mà với ECS Fargate.

  • Configure the users in AWS Identity and Access Management (IAM). Attach a resource policy to the Fargate service to require users to use MFA. Configure a listener rule on the ALB to require authentication through IAM.
    ❌ Sai! IAM dành cho AWS resources/services (machine-to-machine hoặc admin users), không phải cho end-users truy cập web app từ internet. ALB hỗ trợ IAM auth nhưng chỉ cho AWS services (không public users). Resource policy trên Fargate chỉ kiểm soát access AWS API, không authenticate HTTP traffic. MFA IAM không áp dụng cho app web như vậy.

  • Configure the users in AWS Identity and Access Management (IAM). Enable AWS IAM Identity Center (AWS Single Sign-On). Configure resource protection for the ALB. Create a resource protection rule to require users to use MFA.
    ❌ Sai! IAM Identity Center (SSO) dùng cho workforce access AWS console/apps nội bộ, không hỗ trợ ALB listener auth cho public web app. "Resource protection" không tồn tại cho ALB (có lẽ nhầm với AWS Verified Access hoặc GuardDuty, nhưng không liên quan). Không có cách require MFA cho ALB traffic qua SSO như mô tả, và không phù hợp third-party app.

  • Create a user pool in AWS Amplify. Configure the pool for the application. Populate the pool with the required users. Configure the pool to require MFA. Configure a listener rule on the ALB to require authentication through the Amplify hosted UI.
    ❌ Sai! AWS Amplify là framework cho frontend dev (dùng Cognito backend), không có "Amplify user pool" độc lập hay "Amplify hosted UI" tích hợp trực tiếp với ALB listener. Amplify tập trung build/deploy static sites/SPA, không thay thế Cognito cho ALB auth. Sử dụng Amplify ở đây là sai kiến trúc.

📘 Tài liệu tham khảo (AWS Docs cập 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ụ Terraform/CloudFormation, cứ hỏi nhé!

Câu 1104
A solutions architect is preparing to deploy a new security tool into several previously unused AWS Regions. The solutions architect will deploy the tool by using an AWS CloudFormation stack set. The stack set's template contains an IAM role that has a custom name. Upon creation of the stack set, no stack instances are created successfully.

What should the solutions architect do to deploy the stacks successfully?
  1. A Enable the new Regions in all relevant accounts. Specify the CAPABILITY_NAMED_IAM capability during the creation of the stack set.
  2. B Use the Service Quotas console to request a quota increase for the number of CloudFormation stacks in each new Region in all relevant accounts. Specify the CAPABILITY_IAM capability during the creation of the stack set.
  3. C Specify the CAPABILITY_NAMED_IAM capability and the SELF_MANAGED permissions model during the creation of the stack set.
  4. D Specify an administration role ARN and the CAPABILITY_IAM capability during the creation of the stack set.
Xem giải thích

🧩 Giải thích nội dung câu hỏi

Câu hỏi mô tả tình huống một solutions architect đang triển khai một công cụ bảo mật mới vào nhiều AWS Regions chưa từng sử dụng trước đây bằng cách sử dụng AWS CloudFormation StackSets. StackSets cho phép triển khai stack CloudFormation đồng bộ trên nhiều tài khoản và regions một cách tự động (cross-account và cross-region).

Template của StackSet chứa một IAM role có tên tùy chỉnh (custom name). Tuy nhiên, khi tạo StackSet, không có stack instances nào được tạo thành công.

Nguyên nhân chính tiềm ẩn:

  • 🛑 Các Regions mới có thể chưa được kích hoạt (enable) trong các tài khoản liên quan. Theo chính sách AWS, không phải tất cả regions đều được enable mặc định trong mỗi account; bạn phải enable thủ công qua AWS Organizations hoặc Account settings.
  • 🛑 Template tạo IAM resources với tên tùy chỉnh, đòi hỏi capability đặc biệt (CAPABILITY_NAMED_IAM) để CloudFormation có quyền thay đổi tên IAM resource (mặc định chỉ hỗ trợ tên tự động generate).

Mục tiêu: Xác định bước cần thiết để deploy stacks thành công, tập trung vào cấu hình StackSet và prerequisites cho regions mới (dựa trên docs AWS cập nhật 2024-2026, StackSets hỗ trợ delegated admin và regions opt-in).

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

Đáp án đúng: Enable the new Regions in all relevant accounts. Specify the CAPABILITY_NAMED_IAM capability during the creation of the stack set.

Lý do chi tiết:

  • ✅ Enable new Regions: Đây là bước bắt buộc cho regions "previously unused". AWS yêu cầu enable regions qua Management Console (Account > AWS Regions) hoặc Organizations để tránh lỗi "RegionDisabled". Không enable sẽ khiến stack instances fail ngay lập tức.
  • ✅ CAPABILITY_NAMED_IAM: Template có IAM role custom name, nên cần capability này để CloudFormation override tên mặc định IAM (khác với CAPABILITY_IAM chỉ cho tên tự động). Thiếu nó gây lỗi "Requires capability NAMED_IAM".
  • 🛠️ Kết hợp hai bước này giải quyết hoàn toàn vấn đề mà không cần thay đổi khác (như quota hay permissions model).

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

Dưới đây là phân tích từng lựa chọn một cách chi tiết:

  • Enable the new Regions in all relevant accounts. Specify the CAPABILITY_NAMED_IAM capability during the creation of the stack set.
    ✅ Đúng. Như giải thích ở trên, enable regions khắc phục vấn đề "unused Regions" và CAPABILITY_NAMED_IAM xử lý IAM custom name. Đây là giải pháp trực tiếp, hiệu quả nhất theo best practices StackSets (AWS re:Post và docs 2025).

  • Use the Service Quotas console to request a quota increase for the number of CloudFormation stacks in each new Region in all relevant accounts. Specify the CAPABILITY_IAM capability during the creation of the stack set.
    ❌ Sai.

    • Quota stacks mặc định cao (1000/account/region), không phải nguyên nhân chính (vấn đề là regions disable và named IAM).
    • CAPABILITY_IAM chỉ cho IAM generic (không custom name), gây lỗi với role custom → stack fail. Không liên quan quota!
  • Specify the CAPABILITY_NAMED_IAM capability and the SELF_MANAGED permissions model during the creation of the stack set.
    ❌ Sai.

    • CAPABILITY_NAMED_IAM đúng một phần, nhưng bỏ qua enable regions → stack instances vẫn fail do regions disabled.
    • SELF_MANAGED permissions model yêu cầu setup role thủ công phức tạp (không khuyến khích cho newbie), trong khi SERVICE_MANAGED (mặc định) đủ dùng. Không giải quyết gốc rễ!
  • Specify an administration role ARN and the CAPABILITY_IAM capability during the creation of the stack set.
    ❌ Sai.

    • Admin role ARN chỉ cần cho delegated administration (qua Organizations), không bắt buộc cho StackSets cơ bản và không fix regions disable.
    • CAPABILITY_IAM thiếu "NAMED" → fail với custom IAM role name. Sai cả hai điểm chính!

📘 Tài liệu tham khảo (cập nhật AWS 2024-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 ví dụ CloudFormation template, hỏi thêm nhé!

Câu 1105
A company has an application that uses an Amazon Aurora PostgreSQL DB cluster for the application's database. The DB cluster contains one small primary instance and three larger replica instances. The application runs on an AWS Lambda function. The application makes many short-lived connections to the database's replica instances to perform read-only operations.

During periods of high traffic, the application becomes unreliable and the database reports that too many connections are being established. The frequency of high-traffic periods is unpredictable.

Which solution will improve the reliability of the application?
  1. A Use Amazon RDS Proxy to create a proxy for the DB cluster. Configure a read-only endpoint for the proxy. Update the Lambda function to connect to the proxy endpoint.
  2. B Increase the max_connections setting on the DB cluster's parameter group. Reboot all the instances in the DB cluster. Update the Lambda function to connect to the DB cluster endpoint.
  3. C Configure instance scaling for the DB cluster to occur when the DatabaseConnections metric is close to the max connections setting. Update the Lambda function to connect to the Aurora reader endpoint.
  4. D Use Amazon RDS Proxy to create a proxy for the DB cluster. Configure a read-only endpoint for the Aurora Data API on the proxy. Update the Lambda function to connect to the proxy endpoint.
Xem giải thích

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

Câu hỏi mô tả một ứng dụng chạy trên AWS Lambda sử dụng Amazon Aurora PostgreSQL DB cluster làm cơ sở dữ liệu. Cụ thể:

  • DB cluster có 1 primary instance nhỏ (chịu trách nhiệm ghi) và 3 replica instances lớn hơn (dùng cho đọc).
  • Ứng dụng thực hiện nhiều kết nối ngắn hạn (short-lived connections) đến các replica instances để thực hiện read-only operations (hoạt động chỉ đọc).
  • Vấn đề: Trong giờ cao điểm traffic không dự đoán được, ứng dụng trở nên không đáng tin cậy, và database báo quá nhiều kết nối được thiết lập (too many connections).
  • Mục tiêu: Tìm giải pháp cải thiện độ tin cậy của ứng dụng, tập trung vào việc xử lý connections hiệu quả từ Lambda (vốn tạo ra hàng nghìn connections ngắn hạn do serverless nature).

Vấn đề cốt lõi là connection pooling overhead: Lambda functions scale nhanh, tạo/destroy connections thường xuyên, dẫn đến vượt giới hạn max_connections của Aurora PostgreSQL (mặc định thấp, và tăng không scale tốt). Giải pháp cần giảm số connections thực tế đến DB mà vẫn hỗ trợ read-only scaling. 📈

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

Đáp án đúng: Use Amazon RDS Proxy to create a proxy for the DB cluster. Configure a read-only endpoint for the proxy. Update the Lambda function to connect to the proxy endpoint.

Lý do:

  • RDS Proxy là dịch vụ connection pooling chuyên dụng cho RDS/Aurora, giúp multiplex connections (chia sẻ một pool connections đến nhiều client), giảm đáng kể số connections thực tế đến DB (có thể giảm 90%+).
  • Read-only endpoint của Proxy dành riêng cho traffic đọc từ replicas, tận dụng 3 replica lớn để scale read traffic.
  • Lambda kết nối đến proxy endpoint thay vì trực tiếp DB → Proxy quản lý pooling, idle connections, failover, phù hợp hoàn hảo với short-lived connections từ Lambda.
  • Cập nhật 2026: RDS Proxy hỗ trợ đầy đủ Aurora PostgreSQL (với IAM auth, TLS), tích hợp seamless với Lambda VPC. Giải pháp này cost-effective, high availability, và giải quyết chính xác vấn đề unpredictable traffic. 🛠️

📋 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 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.

  • Use Amazon RDS Proxy to create a proxy for the DB cluster. Configure a read-only endpoint for the proxy. Update the Lambda function to connect to the proxy endpoint.
    ✅ Đúng. Như giải thích trên, RDS Proxy là giải pháp tối ưu nhất cho Lambda + Aurora read replicas. Nó xử lý pooling, giảm connections đến DB, hỗ trợ read-only endpoint riêng (reader endpoint của Proxy route đến replicas). Không cần thay đổi DB config lớn, deploy nhanh. Hoàn hảo cho traffic unpredictable. 🚀

  • Increase the max_connections setting on the DB cluster's parameter group. Reboot all the instances in the DB cluster. Update the Lambda function to connect to the DB cluster endpoint.
    ❌ Sai. Tăng max_connections chỉ là workaround tạm thời, không scale tốt vì Lambda tạo connections "explosive" (hàng nghìn/nửa giây). Reboot gây downtime, và connect đến DB cluster endpoint (writer endpoint mặc định) bỏ qua replicas → Không tận dụng read scaling. Vấn đề gốc vẫn tồn tại ở high traffic. 😵

  • Configure instance scaling for the DB cluster to occur when the DatabaseConnections metric is close to the max connections setting. Update the Lambda function to connect to the Aurora reader endpoint.
    ❌ Sai. Aurora hỗ trợ auto-scaling replicas dựa trên CPU/Connections metric (qua CloudWatch alarms → scaling policy), nhưng scaling instances không giải quyết connection exhaustion ngay lập tức (cần thời gian provision). Connect trực tiếp đến Aurora reader endpoint vẫn chịu pooling overhead từ Lambda, dễ vượt max_connections trên từng replica. Không hiệu quả cho short-lived connections. ⚠️

  • Use Amazon RDS Proxy to create a proxy for the DB cluster. Configure a read-only endpoint for the Aurora Data API on the proxy. Update the Lambda function to connect to the proxy endpoint.
    ❌ Sai. RDS Proxy không tích hợp trực tiếp với Aurora Data API theo cách này (Data API là HTTP-based serverless interface cho RDS/Aurora, không cần Proxy cho pooling). "Read-only endpoint for Aurora Data API on the proxy" là sai cấu hình – Data API dùng riêng endpoint/API calls, không qua Proxy read-only. Làm phức tạp hóa không cần thiết, không giải quyết vấn đề connections TCP trực tiếp từ Lambda. 🤔

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

Giải pháp này đảm bảo high reliability mà không downtime! Nếu cần demo code Terraform/ CDK, hãy hỏi thêm nhé. 💡

Câu 1106
A retail company is mounting IoT sensors in all of its stores worldwide. During the manufacturing of each sensor, the company’s private certificate authority (CA) issues an X.509 certificate that contains a unique serial number. The company then deploys each certificate to its respective sensor.

A solutions architect needs to give the sensors the ability to send data to AWS after they are installed. Sensors must not be able to send data to AWS until they are installed.

Which solution will meet these requirements?
  1. A Create an AWS Lambda function that can validate the serial number. Create an AWS IoT Core provisioning template. Include the SerialNumber parameter in the Parameters section. Add the Lambda function as a pre-provisioning hook. During manufacturing, call the RegisterThing API operation and specify the template and parameters.
  2. B Create an AWS Step Functions state machine that can validate the serial number. Create an AWS IoT Core provisioning template. Include the SerialNumber parameter in the Parameters section. Specify the Step Functions state machine to validate parameters. Call the StartThingRegistrationTask API operation during installation.
  3. C Create an AWS Lambda function that can validate the serial number. Create an AWS IoT Core provisioning template. Include the SerialNumber parameter in the Parameters section. Add the Lambda function as a pre-provisioning hook. Register the CA with AWS IoT Core, specify the provisioning template, and set the allow-auto-registration parameter.
  4. D Create an AWS IoT Core provisioning template. Include the SerialNumber parameter in the Parameters section. Include parameter validation in the template. Provision a claim certificate and a private key for each device that uses the CA. Grant AWS IoT Core service permissions to update AWS IoT things during provisioning.
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 bán lẻ lắp đặt cảm biến IoT tại các cửa hàng toàn cầu. 🔧 Mỗi cảm biến được sản xuất với chứng chỉ X.509 từ Private Certificate Authority (CA) riêng của công ty, chứa serial number duy nhất. Sau khi lắp đặt (installed), cảm biến cần gửi dữ liệu đến AWS, nhưng KHÔNG được phép gửi dữ liệu trước khi lắp đặt.

📌 Yêu cầu chính:

  • Sử dụng AWS IoT Core để provision (cung cấp tài nguyên) cho cảm biến một cách tự động (Just-In-Time Provisioning - JITP).
  • Đảm bảo an toàn: Chỉ sau khi installed, cảm biến mới connect và gửi data (thông qua cơ chế validate serial number từ cert).
  • Giải pháp phải hỗ trợ fleet provisioning quy mô lớn, với pre-provisioning hook để kiểm tra trước khi tạo Thing.

🛠️ Công nghệ liên quan (cập nhật AWS 2024-2026): AWS IoT Core Fleet Provisioning với RegisterCA, Provisioning Template, Parameters (extract SerialNumber từ cert), Pre-provisioning Hook (Lambda để validate động), và allow-auto-registration để thiết bị tự động provision khi connect lần đầu với cert từ CA đã đăng ký.

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

✅ Đáp án đúng: Lựa chọn thứ 3 (C)

Create an AWS Lambda function that can validate the serial number. Create an AWS IoT Core provisioning template. Include the SerialNumber parameter in the Parameters section. Add the Lambda function as a pre-provisioning hook. Register the CA with AWS IoT Core, specify the provisioning template, and set the allow-auto-registration parameter.

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

  • ✅ Đúng quy trình JITP chuẩn: Đăng ký CA với IoT Core, chỉ định template, và allow-auto-registration=true → Cảm biến chỉ connect/gửi data SAU khi installed (lần connect đầu tiên tự động trigger provisioning).
  • ✅ Lambda pre-provisioning hook validate SerialNumber (extract từ cert qua Parameters section) → Đảm bảo chỉ serial hợp lệ (công ty control) mới được provision, ngăn chặn truy cập sớm hoặc giả mạo.
  • ✅ Không cần manual register trước manufacturing: Tránh rủi ro leak Thing credential sớm. Hoàn hảo cho quy mô worldwide, hỗ trợ cập nhật AWS IoT Core 2026 (vẫn giữ hooks Lambda-based).
  • ❌ Các option khác fail ở bước enforce "until installed" hoặc sai API/mechanism.

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

Dưới đây là phân tích TẤT CẢ lựa chọn (giữ nguyên văn bản gốc tiếng Anh). Mỗi cái có đánh giá ✅/❌ và lý do bằng tiếng Việt rõ ràng:

  • Phương án A (SAI):
    Create an AWS Lambda function that can validate the serial number. Create an AWS IoT Core provisioning template. Include the SerialNumber parameter in the Parameters section. Add the Lambda function as a pre-provisioning hook. During manufacturing, call the RegisterThing API operation and specify the template and parameters.
    ❌ Sai vì: Gọi RegisterThing API trong manufacturing → Pre-register Thing credential TRƯỚC installed, vi phạm yêu cầu "must not send data until installed" (cảm biến có thể connect AWS ngay lập tức). Hook chỉ dùng cho JITP auto, không phù hợp manual register. 🧨

  • Phương án B (SAI):
    Create an AWS Step Functions state machine that can validate the serial number. Create an AWS IoT Core provisioning template. Include the SerialNumber parameter in the Parameters section. Specify the Step Functions state machine to validate parameters. Call the StartThingRegistrationTask API operation during installation.
    ❌ Sai vì: Step Functions KHÔNG hỗ trợ làm pre-provisioning hook (chỉ Lambda được AWS hỗ trợ, theo docs 2026). StartThingRegistrationTask dùng cho fleet bulk provisioning (CSV input), không phải JITP tự động per-device. Phải manual call "during installation" → Không scale, không enforce auto sau connect. 🚫

  • Phương án C (ĐÚNG):
    Create an AWS Lambda function that can validate the serial number. Create an AWS IoT Core provisioning template. Include the SerialNumber parameter in the Parameters section. Add the Lambda function as a pre-provisioning hook. Register the CA with AWS IoT Core, specify the provisioning template, and set the allow-auto-registration parameter.
    ✅ Đúng hoàn hảo (như giải thích trên). RegisterCA + allow-auto-registration kích hoạt JITP: Cảm biến connect lần đầu → Extract SerialNumber → Lambda hook validate → Provision nếu OK. Ngăn gửi data sớm vì chưa connect/validate. 🌟

  • Phương án D (SAI):
    Create an AWS IoT Core provisioning template. Include the SerialNumber parameter in the Parameters section. Include parameter validation in the template. Provision a claim certificate and a private key for each device that uses the CA. Grant AWS IoT Core service permissions to update AWS IoT things during provisioning.
    ❌ Sai vì: Parameter validation trong template chỉ static (JSON schema cơ bản, không validate động serial number phức tạp như Lambda). Claim certificate dùng cho 2-phase provisioning (activate code), phức tạp thừa và yêu cầu pre-provision key/cert per device (vi phạm "until installed"). Không có auto-registration → Không tự động sau connect. 🔒

Câu 1107
A startup company recently migrated a large ecommerce website to AWS. The website has experienced a 70% increase in sales. Software engineers are using a private GitHub repository to manage code. The DevOps team is using Jenkins for builds and unit testing. The engineers need to receive notifications for bad builds and zero downtime during deployments. The engineers also need to ensure any changes to production are seamless for users and can be rolled back in the event of a major issue.

The software engineers have decided to use AWS CodePipeline to manage their build and deployment process.

Which solution will meet these requirements?
  1. A Use GitHub websockets to trigger the CodePipeline pipeline. Use the Jenkins plugin for AWS CodeBuild to conduct unit testing. Send alerts to an Amazon SNS topic for any bad builds. Deploy in an in-place, all-at-once deployment configuration using AWS CodeDeploy.
  2. B Use GitHub webhooks to trigger the CodePipeline pipeline. Use the Jenkins plugin for AWS CodeBuild to conduct unit testing. Send alerts to an Amazon SNS topic for any bad builds. Deploy in a blue/green deployment using AWS CodeDeploy.
  3. C Use GitHub websockets to trigger the CodePipeline pipeline. Use AWS X-Ray for unit testing and static code analysis. Send alerts to an Amazon SNS topic for any bad builds. Deploy in a blue/green deployment using AWS CodeDeploy.
  4. D Use GitHub webhooks to trigger the CodePipeline pipeline. Use AWS X-Ray for unit testing and static code analysis. Send alerts to an Amazon SNS topic for any bad builds. Deploy in an in-place, all-at-once deployment configuration using AWS CodeDeploy.
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 startup đã migrate website ecommerce lớn lên AWS, với doanh số tăng 70% (tức là traffic và yêu cầu cao hơn). Họ đang quản lý code qua private GitHub repository, sử dụng Jenkins cho build và unit testing. Các yêu cầu chính bao gồm:

  • 📱 Notifications cho bad builds: Gửi thông báo khi build thất bại.
  • ⏰ Zero downtime trong deployments: Không gián đoạn dịch vụ người dùng.
  • 🔄 Seamless changes to production: Thay đổi production mượt mà.
  • 🔙 Rollback dễ dàng nếu có vấn đề lớn.

Họ quyết định dùng AWS CodePipeline để quản lý toàn bộ quy trình build và deploy. Giải pháp cần tích hợp tốt với GitHub, Jenkins, hỗ trợ alerts qua SNS, và deployment strategy phù hợp (như blue/green để đảm bảo zero downtime và rollback nhanh).

Mục tiêu chính: Tìm giải pháp tích hợp chuẩn với CodePipeline (source: GitHub → build/test → deploy), cập nhật theo AWS 2026 (CodePipeline hỗ trợ GitHub app/integrations mới nhất, CodeDeploy blue/green với ALB/EC2).

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

Đáp án đúng:
Use GitHub webhooks to trigger the CodePipeline pipeline. Use the Jenkins plugin for AWS CodeBuild to conduct unit testing. Send alerts to an Amazon SNS topic for any bad builds. Deploy in a blue/green deployment using AWS CodeDeploy.

Lý do chọn 🏆:

  • ✅ GitHub webhooks: Đây là cách chuẩn và được AWS khuyến nghị để trigger CodePipeline từ GitHub (không phải websockets). Webhooks gửi HTTP POST khi có commit/push, tích hợp trực tiếp qua GitHub App hoặc webhook URL trong CodePipeline source stage (cập nhật 2024-2026).
  • ✅ Jenkins plugin for AWS CodeBuild: Phù hợp vì team đang dùng Jenkins; plugin này cho phép Jenkins invoke CodeBuild để chạy unit tests/builds trong CodePipeline build stage.
  • ✅ SNS alerts: SNS topic dễ tích hợp vào CodePipeline (qua CloudWatch Events hoặc CodeBuild reports) để notify bad builds (email/SMS/Slack).
  • ✅ Blue/green deployment với CodeDeploy: Đảm bảo zero downtime (traffic switch từ blue → green environment), seamless production changes, và rollback tự động nếu issue (qua ALB target groups). Hoàn hảo cho ecommerce high-traffic.

Giải pháp này đáp ứng toàn bộ yêu cầu mà không thay đổi stack hiện tại (GitHub + Jenkins).

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

  • ❌ Phương án SAI 1:
    Use GitHub websockets to trigger the CodePipeline pipeline. Use the Jenkins plugin for AWS CodeBuild to conduct unit testing. Send alerts to an Amazon SNS topic for any bad builds. Deploy in an in-place, all-at-once deployment configuration using AWS CodeDeploy.
    Lý do sai 🚫:

    • "GitHub websockets" không tồn tại hoặc không được hỗ trợ để trigger CodePipeline (AWS chỉ dùng webhooks hoặc GitHub App).
    • "In-place, all-at-once" deployment gây downtime (thay thế toàn bộ instances cùng lúc), không seamless/rollback dễ, vi phạm zero downtime.
  • ✅ Phương án ĐÚNG:
    Use GitHub webhooks to trigger the CodePipeline pipeline. Use the Jenkins plugin for AWS CodeBuild to conduct unit testing. Send alerts to an Amazon SNS topic for any bad builds. Deploy in a blue/green deployment using AWS CodeDeploy.
    Lý do đúng 🟢: Như đã giải thích ở trên – toàn diện, chuẩn AWS best practices cho CI/CD với zero downtime.

  • ❌ Phương án SAI 3:
    Use GitHub websockets to trigger the CodePipeline pipeline. Use AWS X-Ray for unit testing and static code analysis. Send alerts to an Amazon SNS topic for any bad builds. Deploy in a blue/green deployment using AWS CodeDeploy.
    Lý do sai 🚫:

    • "GitHub websockets" sai như trên.
    • AWS X-Ray là dịch vụ tracing/debugging (distributed tracing cho apps), KHÔNG dùng cho unit testing hay static code analysis (dùng CodeBuild/Jenkins/CodeGuru cho test/analysis). Thay đổi không cần thiết và sai chức năng.
  • ❌ Phương án SAI 4:
    Use GitHub webhooks to trigger the CodePipeline pipeline. Use AWS X-Ray for unit testing and static code analysis. Send alerts to an Amazon SNS topic for any bad builds. Deploy in an in-place, all-at-once deployment configuration using AWS CodeDeploy.
    Lý do sai 🚫:

    • "AWS X-Ray" sai mục đích như trên (không thay thế Jenkins unit testing).
    • "In-place, all-at-once" gây downtime, không đáp ứng zero downtime/rollback.

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

Giải pháp này là best practice cho high-traffic ecommerce! 🚀

Câu 1108
A software as a service (SaaS) company has developed a multi-tenant environment. The company uses Amazon DynamoDB tables that the tenants share for the storage layer. The company uses AWS Lambda functions for the application services.

The company wants to offer a tiered subscription model that is based on resource consumption by each tenant. Each tenant is identified by a unique tenant ID that is sent as part of each request to the Lambda functions. The company has created an AWS Cost and Usage Report (AWS CUR) in an AWS account. The company wants to allocate the DynamoDB costs to each tenant to match that tenant's resource consumption.

Which solution will provide a granular view of the DynamoDB cost for each tenant with the LEAST operational effort?
  1. A Associate a new tag that is named tenant ID with each table in DynamoDB. Activate the tag as a cost allocation tag in the AWS Billing and Cost Management console. Deploy new Lambda function code to log the tenant ID in Amazon CloudWatch Logs. Use the AWS CUR to separate DynamoDB consumption cost for each tenant ID.
  2. B Configure the Lambda functions to log the tenant ID and the number of RCUs and WCUs consumed from DynamoDB for each transaction to Amazon CloudWatch Logs. Deploy another Lambda function to calculate the tenant costs by using the logged capacity units and the overall DynamoDB cost from the AWS Cost Explorer API. Create an Amazon EventBridge rule to invoke the calculation Lambda function on a schedule.
  3. C Create a new partition key that associates DynamoDB items with individual tenants. Deploy a Lambda function to populate the new column as part of each transaction. Deploy another Lambda function to calculate the tenant costs by using Amazon Athena to calculate the number of tenant items from DynamoDB and the overall DynamoDB cost from the AWS CUR. Create an Amazon EventBridge rule to invoke the calculation Lambda function on a schedule.
  4. D Deploy a Lambda function to log the tenant ID, the size of each response, and the duration of the transaction call as custom metrics to Amazon CloudWatch Logs. Use CloudWatch Logs Insights to query the custom metrics for each tenant. Use AWS Pricing Calculator to obtain the overall DynamoDB costs and to calculate the tenant costs.
Xem giải thích

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

Câu hỏi xoay quanh một công ty SaaS multi-tenant (đa người thuê), sử dụng Amazon DynamoDB làm lớp lưu trữ chia sẻ giữa các tenant (mỗi tenant được xác định bởi tenant ID duy nhất gửi kèm trong mỗi request đến AWS Lambda). Công ty muốn triển khai mô hình subscription tiered dựa trên mức tiêu thụ tài nguyên của từng tenant, cụ thể là phân bổ chi phí DynamoDB (dựa trên RCU - Read Capacity Units và WCU - Write Capacity Units) một cách granular (chi tiết theo từng tenant). Họ đã có AWS Cost and Usage Report (CUR) trong tài khoản AWS.

Mục tiêu chính: Cung cấp cái nhìn chi tiết về chi phí DynamoDB cho từng tenant với LEAST operational effort (ít nỗ lực vận hành nhất).

  • Thách thức: DynamoDB là bảng shared (chia sẻ), nên không thể dễ dàng tag hoặc phân vùng theo tenant mà không thay đổi lớn schema/data model.
  • Giải pháp cần: Theo dõi tiêu thụ RCU/WCU per tenant từ Lambda (vì Lambda gọi DynamoDB), kết hợp total cost từ AWS Billing để tính toán tỷ lệ.

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

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

Đáp án đúng là lựa chọn thứ 2 (Configure the Lambda functions to log the tenant ID and the number of RCUs and WCUs consumed from DynamoDB for each transaction to Amazon CloudWatch Logs. Deploy another Lambda function to calculate the tenant costs by using the logged capacity units and the overall DynamoDB cost from the AWS Cost Explorer API. Create an Amazon EventBridge rule to invoke the calculation Lambda function on a schedule.).

Lý do chọn 🏆:

  • Granular và accurate nhất: Lambda (app layer) có thể dễ dàng log tenant ID + RCUs/WCUs thực tế per transaction (sử dụng ConsumedCapacity từ DynamoDB response), không cần thay đổi DynamoDB table schema hay tagging.
  • Least operational effort 🚀: Chỉ thêm logging vào Lambda hiện tại (ít code change), deploy 1 Lambda tính toán (dùng Cost Explorer API lấy total DynamoDB cost realtime, tỷ lệ với logged units), trigger tự động bằng EventBridge (schedule hàng giờ/ngày). Không cần ETL phức tạp hay Athena.
  • Cập nhật AWS 2025-2026: Cost Explorer API hỗ trợ query chi phí DynamoDB granular hơn (bao gồm on-demand/provisioned), tích hợp seamless với Lambda/EventBridge.
  • So với các option khác: Không invasive (không alter table), tự động hóa cao, chi phí thấp (CloudWatch Logs + Lambda cheap).

🛠️ 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 một, giữ nguyên văn bản gốc tiếng Anh. Mỗi cái được đánh giá ✅ (đúng) hoặc ❌ (sai), với lý do cụ thể bằng tiếng Việt.

  • Phương án 1: Associate a new tag that is named tenant ID with each table in DynamoDB. Activate the tag as a cost allocation tag in the AWS Billing and Cost Management console. Deploy new Lambda function code to log the tenant ID in Amazon CloudWatch Logs. Use the AWS CUR to separate DynamoDB consumption cost for each tenant ID.
    ❌ Sai vì: DynamoDB shared table (một table cho tất cả tenant), tag chỉ áp dụng per table/resource (không per item/tenant). Không thể tag động theo tenant ID per request. CUR hỗ trợ tag-based allocation nhưng chỉ coarse-grained (toàn table), không granular. Log tenant ID vào CloudWatch không liên kết trực tiếp với cost splitting. Effort cao: Phải tạo nhiều table riêng? Vi phạm multi-tenant design. (Ref: AWS Docs - DynamoDB Tagging limitations).

  • Phương án 2 (Đúng - như đã giải thích ở trên): ✅ Configure the Lambda functions to log the tenant ID and the number of RCUs and WCUs consumed from DynamoDB for each transaction to Amazon CloudWatch Logs. Deploy another Lambda function to calculate the tenant costs by using the logged capacity units and the overall DynamoDB cost from the AWS Cost Explorer API. Create an Amazon EventBridge rule to invoke the calculation Lambda function on a schedule.
    ✅ Đúng hoàn hảo (xem lý do ở phần trên). Least effort: Logging đơn giản, tính toán serverless, scalable.

  • Phương án 3: Create a new partition key that associates DynamoDB items with individual tenants. Deploy a Lambda function to populate the new column as part of each transaction. Deploy another Lambda function to calculate the tenant costs by using Amazon Athena to calculate the number of tenant items from DynamoDB and the overall DynamoDB cost from the AWS CUR. Create an Amazon EventBridge rule to invoke the calculation Lambda function on a schedule.
    ❌ Sai vì: Thay đổi partition key + thêm column là major schema migration (backfill data cũ, risk hotspot partitioning nếu tenant lớn), effort cao và downtime-prone. Athena query item count không = RCU/WCU thực tế (cost dựa trên capacity units, không phải số items/response size). CUR là historical (daily), chậm cho realtime view. Không least effort. (Ref: DynamoDB Best Practices - Avoid schema changes for multi-tenant).

  • Phương án 4: Deploy a Lambda function to log the tenant ID, the size of each response, and the duration of the transaction call as custom metrics to Amazon CloudWatch Logs. Use CloudWatch Logs Insights to query the custom metrics for each tenant. Use AWS Pricing Calculator to obtain the overall DynamoDB costs and to calculate the tenant costs.
    ❌ Sai vì: Log response size + duration không trực tiếp map với DynamoDB cost (RCU/WCU dựa trên read/write ops + item size, không phải Lambda duration/response). CloudWatch Logs Insights chỉ query logs (không chính xác cost), Pricing Calculator là manual tool (không automate, error-prone). Effort cao cho manual calc, không scalable/granular. (Ref: AWS Pricing Calculator docs - Not for automated allocation).

Kết luận 🎯: Phương án 2 là optimal cho multi-tenant cost allocation với serverless-native AWS services, phù hợp DevOps best practices (immutable infra, least change). Nếu implement, test với small scale trước!

Câu 1109
A company has an application that stores data in a single Amazon S3 bucket. The company must keep all data for 1 year. The company’s security team is concerned that an attacker could gain access to the AWS account through leaked long-term credentials.

Which solution will ensure that existing and future objects in the S3 bucket are protected?
  1. A Create a new AWS account that is accessible only to the security team through an assumed role. Create an S3 bucket in the new account. Enable S3 Versioning and S3 Object Lock. Configure a default retention period of 1 year. Set up replication from the existing S3 bucket to the new S3 bucket. Create an S3 Batch Replication job to copy all existing data.
  2. B Use the s3-bucket-versioning-enabled AWS Config managed rule. Configure an automatic remediation action that uses an AWS Lambda function to enable S3 Versioning and MFA Delete on noncompliant resources. Add an S3 Lifecycle rule to delete objects after 1 year.
  3. C Explicitly deny bucket creation from all users and roles except for an AWS Service Catalog launch constraint role. Define a Service Catalog product for the creation of the S3 bucket to force S3 Versioning and MFA Delete to be enabled. Authorize users to launch the product when they need to create an S3 bucket.
  4. D Enable Amazon GuardDuty with the S3 protection feature for the account and the AWS Region. Add an S3 Lifecycle rule to delete objects after 1 year.
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 bảo mật dữ liệu S3 bucket trong bối cảnh rủi ro từ leaked long-term credentials (như Access Key lâu dài bị lộ). Công ty có một ứng dụng lưu trữ dữ liệu trong một S3 bucket duy nhất, và họ phải giữ tất cả dữ liệu ít nhất 1 năm. Security team lo ngại attacker có thể truy cập tài khoản AWS chính, dẫn đến xóa hoặc sửa đổi dữ liệu.

Yêu cầu giải pháp chính: Bảo vệ tất cả objects hiện tại (existing) và tương lai (future) trong bucket khỏi bị xóa hoặc thay đổi, ngay cả khi attacker có credentials của tài khoản chính. Giải pháp phải đảm bảo tính toàn vẹn dữ liệu (immutability) và tuân thủ retention 1 năm, sử dụng các tính năng S3 hiện đại như Versioning, Object Lock, Replication (theo docs AWS cập nhật 2024-2026).

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

Lý do chọn đáp án này: Giải pháp này tách biệt hoàn toàn dữ liệu ra khỏi tài khoản chính bằng cách tạo AWS account mới chỉ security team truy cập qua assumed role (giảm rủi ro leaked credentials). Sử dụng S3 Object Lock với default retention 1 year (tính năng WORM - Write Once Read Many) để ngăn xóa/sửa objects vĩnh viễn trong 1 năm, kết hợp Versioning để giữ versions cũ. Replication (cho future objects) và S3 Batch Replication (cho existing objects) đảm bảo dữ liệu được copy an toàn sang bucket mới. Đây là cách tốt nhất theo best practices AWS để bảo vệ chống insider/attacker threats (AWS Well-Architected Security Pillar).

📋 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 nội dung gốc bằng tiếng Anh. Mỗi phương án được đánh giá ✅ (đúng) hoặc ❌ (sai), kèm giải thích bằng tiếng Việt dựa trên tính hiệu quả bảo vệ existing/future objects chống leaked credentials.

  • Create a new AWS account that is accessible only to the security team through an assumed role. Create an S3 bucket in the new account. Enable S3 Versioning and S3 Object Lock. Configure a default retention period of 1 year. Set up replication from the existing S3 bucket to the new S3 bucket. Create an S3 Batch Replication job to copy all existing data.
    ✅ Đúng hoàn toàn: Tạo account riêng biệt loại bỏ rủi ro từ leaked credentials tài khoản cũ. Object Lock + retention 1 year bảo vệ immutability cho cả existing (qua Batch Replication) và future objects (qua Replication). Đây là giải pháp zero-trust chuẩn AWS.

  • Use the s3-bucket-versioning-enabled AWS Config managed rule. Configure an automatic remediation action that uses an AWS Lambda function to enable S3 Versioning and MFA Delete on noncompliant resources. Add an S3 Lifecycle rule to delete objects after 1 year.
    ❌ Sai: Chỉ enable Versioning + MFA Delete không ngăn attacker xóa tất cả versions nếu có credentials (MFA Delete chỉ yêu cầu MFA khi xóa). Lifecycle rule xóa sau 1 năm vi phạm yêu cầu "keep all data for 1 year" (nó xóa đúng 1 năm, nhưng không bảo vệ chống xóa sớm). Không xử lý existing objects an toàn.

  • Explicitly deny bucket creation from all users and roles except for an AWS Service Catalog launch constraint role. Define a Service Catalog product for the creation of the S3 bucket to force S3 Versioning and MFA Delete to be enabled. Authorize users to launch the product when they need to create an S3 bucket.
    ❌ Sai: Chỉ ngăn tạo bucket mới, không bảo vệ bucket hiện tại (existing objects). Không đề cập Object Lock hay retention, và attacker với credentials vẫn xóa objects trong bucket cũ. Service Catalog hữu ích cho governance tương lai nhưng không giải quyết vấn đề leaked credentials ngay lập tức.

  • Enable Amazon GuardDuty with the S3 protection feature for the account and the AWS Region. Add an S3 Lifecycle rule to delete objects after 1 year.
    ❌ Sai: GuardDuty phát hiện threats (như unusual access) nhưng không ngăn chặn xóa objects (chỉ alert sau sự kiện). Lifecycle rule xóa sau 1 năm không đảm bảo giữ data 1 năm đầy đủ, và không có immutability như Object Lock. Không bảo vệ existing/future objects khỏi attacker đã có credentials.

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

🛠️ Kết luận: Giải pháp đúng nhấn mạnh isolation + immutability là chìa khóa cho DevOps security trên AWS! Nếu cần lab thực hành, dùng AWS Free Tier. 😊

Câu 1110
A company needs to improve the security of its web-based application on AWS. The application uses Amazon CloudFront with two custom origins. The first custom origin routes requests to an Amazon API Gateway HTTP API. The second custom origin routes traffic to an Application Load Balancer (ALB). The application integrates with an OpenID Connect (OIDC) identity provider (IdP) for user management.

A security audit shows that a JSON Web Token (JWT) authorizer provides access to the API. The security audit also shows that the ALB accepts requests from unauthenticated users.

A solutions architect must design a solution to ensure that all backend services respond to only authenticated users.

Which solution will meet this requirement?
  1. A Configure the ALB to enforce authentication and authorization by integrating the ALB with the IdP. Allow only authenticated users to access the backend services.
  2. B Modify the CloudFront configuration to use signed URLs. Implement a permissive signing policy that allows any request to access the backend services.
  3. C Create an AWS WAF web ACL that filters out unauthenticated requests at the ALB level. Allow only authenticated traffic to reach the backend services.
  4. D Enable AWS CloudTrail to log all requests that come to the ALB. Create an AWS Lambda function to analyze the logs and block any requests that come from unauthenticated users.
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 cải thiện bảo mật cho ứng dụng web trên AWS, sử dụng Amazon CloudFront làm CDN với hai custom origins:

  • Origin 1: Amazon API Gateway HTTP API (đã được bảo vệ bởi JWT authorizer kết nối với OIDC IdP – nghĩa là đã authenticate người dùng).
  • Origin 2: Application Load Balancer (ALB) (vẫn chấp nhận unauthenticated users, theo kết quả security audit).

Ứng dụng sử dụng OIDC Identity Provider (IdP) cho quản lý người dùng. Yêu cầu chính: Thiết kế giải pháp đảm bảo tất cả backend services (API Gateway và ALB) chỉ phản hồi với authenticated users mà thôi.

Vấn đề cốt lõi là ALB chưa có cơ chế authentication, trong khi API Gateway đã có JWT authorizer. Giải pháp phải enforce authentication tại ALB một cách native, hiệu quả, và tích hợp trực tiếp với OIDC IdP (như theo cập nhật AWS đến 2026: ALB hỗ trợ OIDC qua listener rules từ năm 2021 và được tối ưu hóa liên tục).

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

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

Đáp án đúng: Configure the ALB to enforce authentication and authorization by integrating the ALB with the IdP. Allow only authenticated users to access the backend services.

Lý do 🛠️:

  • ALB hỗ trợ native OIDC integration qua Authenticate action trên listener rules (từ AWS re:Invent 2021, ổn định đến 2026). Điều này cho phép ALB challenge user authentication trực tiếp với OIDC IdP, validate JWT token, và chỉ forward request nếu authenticated.
  • Giải pháp này đơn giản, zero-trust, không cần code custom, scale tự động, và khớp hoàn hảo với setup hiện tại (CloudFront → ALB). Sau auth, ALB inject user claims vào header để backend sử dụng.
  • Đảm bảo tất cả traffic đến ALB chỉ từ authenticated users, bổ sung hoàn hảo cho JWT authorizer của API Gateway.

📋 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 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 (cập nhật 2026).

  • Configure the ALB to enforce authentication and authorization by integrating the ALB with the IdP. Allow only authenticated users to access the backend services.
    ✅ Đúng 🏆: Như đã giải thích ở trên, đây là giải pháp native, hiệu suất cao của ALB với OIDC. Không cần Lambda hay WAF phụ trợ, giảm latency và chi phí. ALB sẽ redirect unauth users đến IdP login flow, sau đó forward với verified token. Hoàn thành yêu cầu "all backend services respond to only authenticated users".

  • Modify the CloudFront configuration to use signed URLs. Implement a permissive signing policy that allows any request to access the backend services.
    ❌ Sai 🚫: Signed URLs chỉ kiểm soát access to CloudFront content (như thời hạn, IP), không validate user identity từ OIDC. "Permissive signing policy" còn làm yếu bảo mật (cho phép any request), không enforce auth tại backend (ALB vẫn nhận unauth traffic). Không giải quyết gốc rễ vấn đề ALB.

  • Create an AWS WAF web ACL that filters out unauthenticated requests at the ALB level. Allow only authenticated traffic to reach the backend services.
    ❌ Sai 🔒: AWS WAF (tích hợp ALB/CloudFront) giỏi signature-based rules (SQLi, XSS), nhưng không decode/validate JWT/OIDC token native (cần custom Lambda@Edge hoặc regex header kém hiệu quả). Không scalable cho auth phức tạp, dễ bypass, và tăng latency. Không phải giải pháp auth chuẩn (AWS recommend ALB native auth thay vì WAF cho use case này).

  • Enable AWS CloudTrail to log all requests that come to the ALB. Create an AWS Lambda function to analyze the logs and block any requests that come from unauthenticated users.
    ❌ Sai ⏳: Đây là cách reactive, post-facto (log → analyze → block sau), không real-time block (CloudTrail delay 5-15 phút). Lambda analyze logs không prevent unauth access ngay lập tức, phức tạp, tốn kém (storage + compute), và không integrate OIDC trực tiếp. Vi phạm nguyên tắc preventive security trong AWS Well-Architected Framework.

Kết luận 🌟: Giải pháp đúng tận dụng tính năng built-in của ALB, đảm bảo bảo mật zero-trust, dễ maintain cho DevOps. Implement nhanh qua Console/CLI/Terraform!