Ngân hàng đề — AWS Certified Developer Associate
Tìm thấy 1356 câu.
How can the developer keep the dependencies of the Lambda functions up to date with the LEAST additional complexity?
- A Define a maintenance window for the Lambda functions to ensure that the functions get updated copies of the dependencies.
- B Upgrade the Lambda functions to the most recent runtime version.
- C Define a Lambda layer that contains all of the shared dependencies.
- D Use an AWS CodeCommit repository to host the dependencies in a centralized location.
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 được xây dựng từ nhiều AWS Lambda functions chia sẻ cùng một số dependencies (các thư viện hoặc gói mã nguồn cần thiết). Nhà phát triển gặp vấn đề bảo mật khi phải liên tục cập nhật dependencies cho từng function riêng lẻ, dẫn đến nỗ lực trùng lặp (duplicated effort) cao. Mục tiêu là tìm cách giữ dependencies luôn cập nhật với độ phức tạp thêm vào thấp nhất (LEAST additional complexity).
🛠️ Vấn đề cốt lõi: Lambda functions cần chia sẻ dependencies chung để tránh phải update thủ công từng cái, giảm công sức và rủi ro bảo mật (như vulnerabilities trong thư viện cũ). Giải pháp phải tối ưu hóa việc chia sẻ và cập nhật tập trung, phù hợp với best practices AWS Lambda mới nhất (tính đến 2026, Lambda Layers vẫn là tính năng cốt lõi và được khuyến nghị).
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Define a Lambda layer that contains all of the shared dependencies.
Lý do chi tiết:
- Lambda Layers cho phép tách riêng dependencies chung thành một layer độc lập, có thể attach vào nhiều Lambda functions cùng lúc. Khi update layer (upload phiên bản mới), tất cả functions gắn layer sẽ tự động dùng phiên bản mới mà không cần redeploy từng function.
- Least additional complexity: Chỉ cần tạo layer một lần (qua AWS Console, CLI, hoặc CDK/Serverless Framework), quản lý version dễ dàng (ARN versioning), và không thay đổi code function gốc. Điều này giảm duplicated effort tối đa, tăng tốc độ update bảo mật.
- Ưu điểm theo AWS 2026: Hỗ trợ lên đến 5 layers/function, kích thước lên 250MB unzipped/layer, tích hợp với runtime mới nhất (Node.js 20, Python 3.12, etc.), và Provisioned Concurrency để cache layers hiệu suất cao. Không có giải pháp thay thế nào đơn giản hơn cho shared dependencies.
📋 Giải thích tất cả các phương án (đúng/sai)
-
Define a maintenance window for the Lambda functions to ensure that the functions get updated copies of the dependencies.
❌ Sai vì: Maintenance window (qua Lambda console hoặc EventBridge) chỉ dùng để lên lịch bảo trì tự động như patch runtime OS, không hỗ trợ update dependencies tùy chỉnh trong code package. Vẫn phải thủ công bundle dependencies mới vào từng function ZIP trước khi deploy, dẫn đến duplicated effort cao, không giải quyết gốc rễ vấn đề chia sẻ. -
Upgrade the Lambda functions to the most recent runtime version.
❌ Sai vì: Upgrade runtime (ví dụ từ Node.js 18 lên 20) chỉ cập nhật môi trường chạy AWS-managed (như AWS SDK built-in), không ảnh hưởng dependencies bên thứ ba (npm packages, pip libs) do dev tự bundle. Vẫn cần update từng function riêng lẻ, không giảm complexity và có thể gây breaking changes trong code. -
Define a Lambda layer that contains all of the shared dependencies.
✅ Đúng như đã giải thích ở trên: Giải pháp tối ưu nhất, chia sẻ tập trung, update một chỗ ảnh hưởng nhiều functions, phù hợp AWS best practices DOP-C02 (DevOps Professional 2024-2026). -
Use an AWS CodeCommit repository to host the dependencies in a centralized location.
❌ Sai vì: CodeCommit chỉ là Git repo để version control source code, không phải runtime sharing mechanism cho Lambda. Dev vẫn phải pull dependencies từ repo vào từng function package thủ công lúc build/deploy (qua CI/CD như CodePipeline), dẫn đến duplicated effort và complexity cao hơn (cần pipeline tự động hóa thêm). Không "least complexity" so với Layers.
📘 Tài liệu tham khảo (AWS cập nhật mới nhất 2026)
- AWS Lambda Layers Documentation: docs.aws.amazon.com/lambda/latest/dg/chapter-layers.html – Hướng dẫn tạo/share layers cho dependencies.
- AWS Well-Architected Framework - Serverless Lens: docs.aws.amazon.com/wellarchitected/latest/serverless-lens/wat.lens.html – Khuyến nghị Layers cho shared code/dependencies (Operational Excellence pillar).
- DOP-C02 Exam Guide (2024+): Phần Lambda management, nhấn mạnh Layers giảm deployment overhead.
- AWS re:Post & Blog: Tìm "Lambda Layers shared dependencies" cho case studies thực tế (ví dụ: update npm packages centrally).
🛠️ Lời khuyên DevOps: Sử dụng SAM/ CDK để automate layer creation trong CI/CD pipeline (CodeBuild + CodePipeline) cho production scale! 🚀
What is the MOST cost-effective way to delete posts that are older than 48 hours?
- A For each item, add a new attribute of type String that has a timestamp that is set to the blog post creation time. Create a script to find old posts with a table scan and remove posts that are older than 48 hours by using the BatchWriteItem API operation. Schedule a cron job on an Amazon EC2 instance once an hour to start the script.
- B For each item, add a new attribute of type String that has a timestamp that is set to the blog post creation time. Create a script to find old posts with a table scan and remove posts that are older than 48 hours by using the BatchWriteItem API operation. Place the script in a container image. Schedule an Amazon Elastic Container Service (Amazon ECS) task on AWS Fargate that invokes the container every 5 minutes.
- C For each item, add a new attribute of type Date that has a timestamp that is set to 48 hours after the blog post creation time. Create a global secondary index (GSI) that uses the new attribute as a sort key. Create an AWS Lambda function that references the GSI and removes expired items by using the BatchWriteItem API operation. Schedule the function with an Amazon CloudWatch event every minute.
- D For each item, add a new attribute of type Number that has a timestamp that is set to 48 hours after the blog post creation time. Configure the DynamoDB table with a TTL that references the new attribute.
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 Amazon DynamoDB 📘, một dịch vụ cơ sở dữ liệu NoSQL serverless của AWS. Ứng dụng di động lưu trữ hàng triệu bài blog posts mỗi ngày dưới dạng các item riêng lẻ trong một bảng DynamoDB. Yêu cầu chỉ giữ lại các bài post gần đây, và xóa bất kỳ bài nào cũ hơn 48 giờ một cách tiết kiệm chi phí nhất 💰.
Vấn đề chính:
- Với khối lượng dữ liệu lớn (millions items/ngày), cần phương pháp tự động, hiệu quả, chi phí thấp để quản lý lifecycle dữ liệu.
- Tránh các hoạt động thủ công như scan/query toàn bộ bảng (rất tốn RCU/WCU và dung lượng).
- Ưu tiên giải pháp native của DynamoDB để giảm thiểu tài nguyên compute bên ngoài (như EC2, ECS, Lambda).
Mục tiêu: Tìm cách xóa cũ kỹ (older than 48 hours) cost-effective nhất, nghĩa là tận dụng tính năng tự động hóa của AWS mà không tốn thêm chi phí vận hành.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng:
For each item, add a new attribute of type Number that has a timestamp that is set to 48 hours after the blog post creation time. Configure the DynamoDB table with a TTL that references the new attribute.
Lý do chọn đáp án này 🛠️:
- DynamoDB TTL (Time to Live) là tính năng native, serverless cho phép tự động xóa items khi giá trị attribute TTL (phải là type Number, Unix timestamp giây) đạt hoặc vượt quá thời gian hiện tại.
- Attribute được set là creation time + 48 giờ (ví dụ: 1720000000 + 172800 giây), DynamoDB sẽ xóa tự động trong vòng 48 giờ sau mà KHÔNG tốn chi phí thêm (chỉ tính phí lưu trữ bình thường trước khi xóa).
- Tiết kiệm nhất: Không cần scan/query, không Lambda/EC2/ECS, không GSI. Giảm dung lượng lưu trữ ~50% hàng ngày, tối ưu chi phí dài hạn.
- Cập nhật 2026: TTL vẫn là best practice, hỗ trợ lên đến billions items, xóa asynchonous (thường trong 48h sau expire).
📘 Tài liệu tham khảo:
- DynamoDB TTL Documentation (AWS re:Invent 2024 xác nhận không thay đổi).
- AWS Well-Architected Framework: Data Lifecycle Management.
❌ 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 chi phí, hiệu suất, độ tin cậy với dữ liệu millions items/ngày.
-
[SAI] For each item, add a new attribute of type String that has a timestamp that is set to the blog post creation time. Create a script to find old posts with a table scan and remove posts that are older than 48 hours by using the BatchWriteItem API operation. Schedule a cron job on an Amazon EC2 instance once an hour to start the script.
Giải thích sai ❌:- Scan toàn bộ bảng tốn kém RCU khổng lồ (O(n) với millions items), dễ throttle.
- Attribute String không dùng được TTL (phải Number).
- EC2 + cron tốn chi phí compute liên tục (instance luôn chạy), không serverless. Hourly schedule chậm, backlog tích tụ.
-
[SAI] For each item, add a new attribute of type String that has a timestamp that is set to the blog post creation time. Create a script to find old posts with a table scan and remove posts that are older than 48 hours by using the BatchWriteItem API operation. Place the script in a container image. Schedule an Amazon Elastic Container Service (Amazon ECS) task on AWS Fargate that invokes the container every 5 minutes.
Giải thích sai ❌:- Vẫn scan toàn bộ → tốn RCU/WCU cao, không scale với millions items.
- String timestamp vô dụng cho TTL.
- Fargate ECS tốn hơn EC2 (pay-per-use nhưng frequent every 5 min → chi phí vCPU cao), phức tạp quản lý container. Không hiệu quả so với native TTL.
-
[SAI] For each item, add a new attribute of type Date that has a timestamp that is set to 48 hours after the blog post creation time. Create a global secondary index (GSI) that uses the new attribute as a sort key. Create an AWS Lambda function that references the GSI and removes expired items by using the BatchWriteItem API operation. Schedule the function with an Amazon CloudWatch event every minute.
Giải thích sai ❌:- Type Date không tồn tại trong DynamoDB (chỉ Number/String/Binary cho TTL).
- GSI tốn chi phí lưu trữ/provision riêng (double storage), query GSI vẫn tốn RCU.
- Lambda + CloudWatch every minute → invocation cao (millions items → timeout/throttle), chi phí Lambda ~$0.20/1M requests + WCU delete. Không phải "most cost-effective".
-
[ĐÚNG] For each item, add a new attribute of type Number that has a timestamp that is set to 48 hours after the blog post creation time. Configure the DynamoDB table with a TTL that references the new attribute.
Giải thích đúng ✅:- TTL hoàn hảo: Tự động, zero-effort, chỉ cần config attribute
ttl: { AttributeName: "expireTime" }qua Console/CLI/API. - Number Unix timestamp chuẩn (e.g.,
Math.floor(Date.now() / 1000) + 172800). - Cost: 0$ cho xóa (tự động background), chỉ tiết kiệm storage. Scale vô hạn, cập nhật 2026 vẫn recommended cho cold data.
- TTL hoàn hảo: Tự động, zero-effort, chỉ cần config attribute
Kết luận 🚀: TTL là giải pháp native, zero-maintenance lý tưởng cho data expiration trong DynamoDB. Tránh custom script để giảm operational overhead!
The developer wants to securely store the parameter values outside the code in an encrypted format and wants to turn on rotation for the credentials. The developer also wants to be able to reuse the parameter values from other applications and to update the parameter values without modifying code.
Which solution will meet these requirements with the LEAST operational overhead?
- A Create an RDS database secret in AWS Secrets Manager. Set the user name, password, database, host, and port. Turn on secret rotation. Create encrypted Lambda environment variables for the DynamoDB table, S3 bucket, and SNS topic.
- B Create an RDS database secret in AWS Secrets Manager. Set the user name, password, database, host, and port. Turn on secret rotation. Create SecureString parameters in AWS Systems Manager Parameter Store for the DynamoDB table, S3 bucket, and SNS topic.
- C Create RDS database parameters in AWS Systems Manager Parameter Store for the user name, password, database, host, and port. Create encrypted Lambda environment variables for the DynamoDB table, S3 bucket, and SNS topic. Create a Lambda function and set the logic for the credentials rotation task. Schedule the credentials rotation task in Amazon EventBridge.
- D Create RDS database parameters in AWS Systems Manager Parameter Store for the user name, password, database, host, and port. Store the DynamoDB table, S3 bucket, and SNS topic in Amazon S3. Create a Lambda function and set the logic for the credentials rotation. Invoke the Lambda function on a schedule.
Xem giải thích
🧩 Phân tích nội dung câu hỏi
Câu hỏi xoay quanh việc một lập trình viên đang chỉnh sửa một hàm AWS Lambda hiện có, phát hiện các giá trị tham số được hardcode trực tiếp trong code, bao gồm:
- Thông tin kết nối Amazon RDS for SQL Server: username, password, database, host, và port (đây là credentials nhạy cảm, cần rotation định kỳ).
- Các giá trị khác: tên bảng Amazon DynamoDB, tên bucket Amazon S3, và ARN của Amazon SNS topic (không phải credentials, nhưng cần lưu trữ an toàn).
Yêu cầu chính của developer:
- Lưu trữ các giá trị này bên ngoài code, dưới dạng mã hóa (encrypted).
- Bật rotation tự động cho credentials (chủ yếu là RDS creds).
- Tái sử dụng từ các ứng dụng khác.
- Cập nhật giá trị mà không cần sửa code.
- Giải pháp phải có operational overhead thấp nhất (tức là ít công sức quản lý, vận hành nhất, ưu tiên dịch vụ AWS managed với tính năng built-in).
🛠️ Vấn đề cốt lõi: Hardcode gây rủi ro bảo mật (leak code), khó quản lý, không scale. Cần dịch vụ centralized như AWS Secrets Manager (cho secrets + rotation) hoặc AWS Systems Manager Parameter Store (cho parameters encrypted, nhưng rotation hạn chế). Lambda có thể retrieve qua SDK mà không sửa code nhiều.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng là lựa chọn thứ 2:
Create an RDS database secret in AWS Secrets Manager. Set the user name, password, database, host, and port. Turn on secret rotation. Create SecureString parameters in AWS Systems Manager Parameter Store for the DynamoDB table, S3 bucket, and SNS topic.
Lý do chọn (chi tiết):
- ✅ Secrets Manager lý tưởng cho RDS credentials (database secrets): Hỗ trợ tạo secret chuyên biệt cho RDS SQL Server, lưu username/password/host/port/database, rotation tự động (built-in Lambda rotator cho RDS, không cần code custom). Encrypted at rest/transit (KMS), reusable cross-apps/services, update không ảnh hưởng code (Lambda retrieve qua
getSecretValue()). - ✅ SSM Parameter Store SecureString cho DynamoDB table/S3 bucket/SNS topic (non-credentials): Encrypted (KMS), hierarchical, reusable (cross-account/region với Resource Policies), rẻ hơn Secrets Manager, không cần rotation vì không phải secrets động.
- 🏆 Least operational overhead: Toàn bộ managed service, no custom code/ Lambda cho rotation, chỉ config 1 lần. Cập nhật qua console/CLI/API, Lambda đọc động. Phù hợp best practice AWS Well-Architected Framework (Security pillar).
(Kiến thức cập nhật 2026: Secrets Manager rotation hỗ trợ RDS SQL Server Multi-AZ, SSM Parameter Store tích hợp IAM fine-grained access + caching tự động trong Lambda extensions).
📋 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 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 chi tiết bằng tiếng Việt:
-
❌ [SAI] Create an RDS database secret in AWS Secrets Manager. Set the user name, password, database, host, and port. Turn on secret rotation. Create encrypted Lambda environment variables for the DynamoDB table, S3 bucket, and SNS topic.
Lý do sai: Phần RDS secret ✅ tốt (rotation tự động). Nhưng Lambda environment variables chỉ scoped cho function cụ thể, không reusable cho other apps/services, khó update centralized (phải redeploy Lambda), không phải giải pháp "outside code" thực sự cho reuse. Overhead cao hơn vì env vars kém linh hoạt so với Parameter Store. Không meet "reuse from other applications". -
✅ [ĐÚNG] Create an RDS database secret in AWS Secrets Manager. Set the user name, password, database, host, and port. Turn on secret rotation. Create SecureString parameters in AWS Systems Manager Parameter Store for the DynamoDB table, S3 bucket, and SNS topic.
Lý do đúng: Như đã giải thích ở trên – kết hợp hoàn hảo Secrets Manager (rotation + secrets) và SSM SecureString (encrypted params reusable). Zero custom code, least overhead, full compliance yêu cầu. -
❌ [SAI] Create RDS database parameters in AWS Systems Manager Parameter Store for the user name, password, database, host, and port. Create encrypted Lambda environment variables for the DynamoDB table, S3 bucket, and SNS topic. Create a Lambda function and set the logic for the credentials rotation task. Schedule the credentials rotation task in Amazon EventBridge.
Lý do sai: SSM Parameter Store không hỗ trợ native rotation cho RDS creds (chỉ manual hoặc custom). Phải tự build Lambda rotator + EventBridge → operational overhead cao (code, test, maintain, error-prone). Env vars vẫn không reusable. Không least overhead. -
❌ [SAI] Create RDS database parameters in AWS Systems Manager Parameter Store for the user name, password, database, host, and port. Store the DynamoDB table, S3 bucket, and SNS topic in Amazon S3. Create a Lambda function and set the logic for the credentials rotation. Invoke the Lambda function on a schedule.
Lý do sai: SSM thiếu rotation native → custom Lambda + schedule (EventBridge hoặc tương tự) → overhead rất cao. Lưu non-secrets vào S3 không encrypted mặc định (phải config SSE-KMS thủ công), không centralized/reusable như Parameter Store, rủi ro access control. Không an toàn/tiện lợi.
📘 Tài liệu tham khảo (AWS docs cập nhật 2026)
- AWS Secrets Manager: Rotation for Amazon RDS (hỗ trợ SQL Server, auto Lambda rotator).
- SSM Parameter Store: SecureString & best practices (Advanced parameters, KMS integration).
- Lambda integration: Retrieve secrets/parameters + Extensions for caching.
- Exam guide DOP-C02: AWS Certified DevOps Engineer Professional – Security & Parameter Management sections.
(Nguồn: AWS Documentation, Well-Architected Labs – verified latest re:Invent 2025 updates).
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"codecommit:BatchGetRepositories",
"codecommit:Get*",
"codecommit:List*",
"codecommit:GitPull"
],
"Resource": "*"
}
]
}
The developer needs to create/delete branches.
Which specific IAM permissions need to be added, based on the principle of least privilege?
-
A
"codecommit:CreateBranch"
"codecommit:DeleteBranch" - B "codecommit:Put*"
- C "codecommit:Update*"
- D "codecommit:*"
Xem giải thích
Phân tích câu hỏi 🧩
Câu hỏi yêu cầu xác định các quyền IAM (Identity and Access Management) cụ thể cần được thêm vào để nhà phát triển có thể tạo và xóa nhánh (branch) trong AWS CodeCommit. Nhà phát triển hiện đang truy cập CodeCommit qua SSH với các quyền được cấu hình như sau:
- Quyền hiện tại cho phép thực hiện các hành động như:
codecommit:BatchGetRepositoriescodecommit:Get*codecommit:List*codecommit:GitPull
Yêu cầu:
- Nhà phát triển cần có quyền để tạo và xóa nhánh.
Phân tích các phương án 🛠️
Phương án đúng:
- "codecommit:CreateBranch" ✅
- "codecommit:DeleteBranch" ✅
Giải thích:
- Để tạo nhánh mới trong CodeCommit, cần có quyền
codecommit:CreateBranch. - Để xóa nhánh trong CodeCommit, cần có quyền
codecommit:DeleteBranch.
Việc thêm hai quyền này vào policy hiện tại sẽ cho phép nhà phát triển thực hiện các hành động tạo và xóa nhánh mà không cần cấp quyền quá mức (theo nguyên tắc least privilege).
Phương án sai:
-
"codecommit:Put*" ❌
- Quyền này không cụ thể liên quan đến việc tạo hoặc xóa nhánh. Nó thường liên quan đến việc đặt (put) các giá trị hoặc đối tượng trong CodeCommit, nhưng không rõ ràng cho hành động tạo hoặc xóa nhánh.
-
"codecommit:Update*" ❌
- Quyền này thường liên quan đến việc cập nhật các đối tượng trong CodeCommit. Mặc dù có thể liên quan, nhưng nó không cụ thể cho việc tạo hoặc xóa nhánh.
-
"codecommit:*" ❌
- Quyền này là quyền wildcard, cho phép tất cả các hành động trên CodeCommit. Điều này không tuân thủ nguyên tắc least privilege vì nó cấp quá nhiều quyền không cần thiết.
Tài liệu tham khảo:
- AWS Documentation: IAM Policy Document
- AWS Documentation: CodeCommit Actions
Kết luận:
- Để đáp ứng yêu cầu, chỉ cần thêm quyền
codecommit:CreateBranchvàcodecommit:DeleteBranchvào policy hiện tại của nhà phát triển. Điều này đảm bảo nhà phát triển có thể tạo và xóa nhánh trong CodeCommit mà không cần cấp quá nhiều quyền không cần thiết. ✅
Which solutions will mitigate this error MOST cost-effectively? (Choose two.)
- A Modify the application code to perform exponential backoff when the error is received.
- B Modify the application to use the AWS SDKs for DynamoDB.
- C Increase the read and write throughput of the DynamoDB table.
- D Create a DynamoDB Accelerator (DAX) cluster for the DynamoDB table.
- E Create a second DynamoDB table. Distribute the reads and writes between the two tables.
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 vấn đề ProvisionedThroughputExceededException xảy ra khi ứng dụng triển khai trên Amazon EC2 thực hiện ghi dữ liệu (write) vào bảng Amazon DynamoDB qua REST API trực tiếp. Lỗi này xuất hiện thỉnh thoảng (periodically), nghĩa là không phải lúc nào cũng xảy ra mà chỉ khi lượng write vượt quá throughput đã provision (công suất đọc/ghi được cấu hình) của bảng DynamoDB ở chế độ provisioned capacity.
Mục tiêu là chọn hai giải pháp (choose TWO) giúp giảm thiểu lỗi này một cách TIẾT KIỆM CHI PHÍ NHẤT (MOST cost-effectively).
- 🔍 Ngữ cảnh chính: Ứng dụng gọi REST API thủ công, không dùng SDK, nên thiếu cơ chế xử lý lỗi tự động. Giải pháp cần ưu tiên không tốn thêm chi phí provision capacity hoặc tài nguyên thừa (như cache/cluster mới), mà tận dụng code optimization hoặc client-side handling.
- 🛠️ Kiến thức cập nhật 2026: DynamoDB vẫn giữ chế độ provisioned/on-demand, với khuyến nghị dùng exponential backoff và AWS SDK để handle throttling (theo AWS Well-Architected Framework - Reliability Pillar, cập nhật 2024-2026). Không có thay đổi lớn về error handling cơ bản.
✅ Đáp án đúng (Chọn TWO)
Hai lựa chọn tiết kiệm chi phí nhất là:
-
Modify the application code to perform exponential backoff when the error is received.
🧠 Lý do: Exponential backoff là kỹ thuật retry dần dần tăng thời gian chờ (ví dụ: 50ms → 100ms → 200ms...) khi gặp lỗi throttling. Điều này giúp ứng dụng tự động giảm tải tạm thời, tránh flood request mà không tốn thêm chi phí provision. Rẻ nhất vì chỉ chỉnh code! -
Modify the application to use the AWS SDKs for DynamoDB.
🧠 Lý do: AWS SDK (như Java/Python SDK) tự động implement exponential backoff, jitter, và retry logic cho lỗi ProvisionedThroughputExceededException (theo DynamoDB RetryConfiguration). Ứng dụng hiện dùng REST API thủ công nên thiếu tính năng này. Chuyển sang SDK zero-cost thêm (chỉ code change), hiệu quả cao hơn REST raw.
Hai giải pháp này cost-effective vì không tăng RCU/WCU (read/write capacity units), không tạo resource mới, chỉ optimize client-side.
📋 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, giữ nguyên văn bản gốc tiếng Anh. Mỗi phương án được đánh giá dựa trên hiệu quả mitigate lỗi write throttling và cost-effectiveness:
-
✅ Modify the application code to perform exponential backoff when the error is received.
Đúng và cost-effective nhất 🏆: Kỹ thuật chuẩn AWS cho throttling errors. Giúp ứng dụng retry thông minh, phân tán tải mà không cần scale table. Áp dụng ngay cho REST API thủ công. -
✅ Modify the application to use the AWS SDKs for DynamoDB.
Đúng và cost-effective cao 🏆: SDK built-in retry handler (exponential backoff + jitter) cho tất cả DynamoDB APIs. Chuyển từ REST sang SDK giảm lỗi 90%+ mà không tốn kém, hỗ trợ multi-thread tốt hơn. -
❌ Increase the read and write throughput of the DynamoDB table.
Sai vì không cost-effective: Tăng RCU/WCU giải quyết gốc rễ bằng cách provision thêm capacity, nhưng tốn phí theo giờ (khoảng 0.25$/milion WCUs/tháng). Lỗi chỉ "periodically" nên lãng phí, không phải giải pháp tối ưu (chỉ dùng khi peak load cao). -
❌ Create a DynamoDB Accelerator (DAX) cluster for the DynamoDB table.
Sai hoàn toàn: DAX là in-memory cache cho reads (giảm latency read 10x), không hỗ trợ writes và không mitigate write throttling. Thêm chi phí cluster (0.04$/giờ/node + data transfer), không liên quan đến lỗi write. -
❌ Create a second DynamoDB table. Distribute the reads and writes between the two tables.
Sai và kém hiệu quả: Tạo table mới tăng complexity (code phải sharding, query Global Secondary Indexes khó), chi phí gấp đôi provision. Không giải quyết throttling gốc mà chỉ "chia tải", dễ gây hot partition.
📘 Tài liệu tham khảo (Cập nhật mới nhất 2026)
- AWS DynamoDB Developer Guide: Error Handling and Retry & Best Practices for Handling Throttling ✅ (Exponential backoff là khuyến nghị #1).
- AWS SDK Docs: DynamoDB Retry Configuration (SDK auto-retry từ v3+).
- AWS Well-Architected Framework (2024-2026): Reliability Pillar - Handle Transient Errors.
- DOP-C02 Exam Guide: Chủ đề DynamoDB Provisioned Mode & Client Optimization (AWS re:Post & A Cloud Guru).
Hy vọng phân tích này giúp bạn ôn thi DOP-C02 hiệu quả! 🚀 Nếu cần thêm ví dụ code, hỏi nhé!
What is the recommended solution?
- A Add the export LC_ALL="en_US.utf8" command to the pre_build section to ensure POSIX localization.
- B Use Amazon Cognito to store key-value pairs for large numbers of environment variables.
- C Update the settings for the build project to use an Amazon S3 bucket for large numbers of environment variables.
- D Use AWS Systems Manager Parameter Store to store large numbers of environment variables.
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 vấn đề phổ biến trong AWS CodeBuild: Khi developer chạy một dự án build, hệ thống báo lỗi vì tổng độ dài của tất cả environment variables (biến môi trường) vượt quá giới hạn ký tự cho phép.
📘 Kiến thức nền tảng (cập nhật đến năm 2026 theo tài liệu AWS mới nhất):
- AWS CodeBuild giới hạn tổng kích thước environment variables là 4.096 bytes (4 KB) cho toàn bộ dự án build (bao gồm tên biến và giá trị).
- Nếu vượt quá, build sẽ fail với lỗi tương tự "environment variables exceed the limit".
- Giải pháp khuyến nghị là sử dụng dịch vụ bên ngoài để lưu trữ và inject động các biến lớn, tránh hardcode trực tiếp vào project settings.
🛠️ Mục tiêu: Tìm giải pháp khuyến nghị (recommended) từ AWS để xử lý số lượng lớn environment variables mà không vi phạm limit.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Use AWS Systems Manager Parameter Store to store large numbers of environment variables.
Lý do (🧩 Phân tích sâu):
- AWS Systems Manager Parameter Store (SSM Parameter Store) là dịch vụ chuẩn AWS để lưu trữ an toàn các tham số (parameters) như secrets, config, env vars dưới dạng key-value.
- CodeBuild tích hợp trực tiếp với SSM: Bạn có thể reference parameters từ SSM trong buildspec.yaml (sử dụng
Fn::Subhoặc IAM permissions), và CodeBuild sẽ tự động inject chúng làm env vars mà không tính vào 4KB limit của project. - Lợi ích: Hỗ trợ mã hóa (KMS), versioning, hierarchical paths (ví dụ:
/prod/db/password), và scale tốt cho hàng nghìn vars. Đây là best practice theo AWS Well-Architected Framework (DevOps pillar). - Cập nhật 2026: SSM vẫn là giải pháp primary, với hỗ trợ mới cho Parameter Store SecureString và integration mượt mà hơn với CodeBuild privileged mode.
📋 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, 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 chi tiết bằng tiếng Việt:
-
❌ Add the export LC_ALL="en_US.utf8" command to the pre_build section to ensure POSIX localization.
Lý do sai: Lệnh này chỉ dùng để thiết lập localization POSIX (xử lý encoding UTF-8 cho locale), không liên quan đến việc giảm kích thước env vars. Nó có thể gây thêm env vars mới, làm tình hình tệ hơn. Không phải giải pháp cho limit characters. -
❌ Use Amazon Cognito to store key-value pairs for large numbers of environment variables.
Lý do sai: Amazon Cognito dành cho user authentication/authorization (identity pools, user pools), không phải lưu trữ env vars. Không có integration trực tiếp với CodeBuild để inject key-value pairs. Sử dụng Cognito ở đây là misuse service, không giải quyết limit. -
❌ Update the settings for the build project to use an Amazon S3 bucket for large numbers of environment variables.
Lý do sai: Amazon S3 là object storage, không hỗ trợ trực tiếp lưu key-value như env vars cho CodeBuild. Bạn có thể lưu file JSON trên S3 và parse trong buildspec, nhưng điều này phức tạp, không recommended, và vẫn có thể vượt limit nếu inject thủ công. AWS không coi đây là giải pháp chuẩn (thiếu integration native). -
✅ Use AWS Systems Manager Parameter Store to store large numbers of environment variables.
Lý do đúng (như đã giải thích ở trên): Đây là giải pháp chính thức từ AWS, với IAM role cho CodeBuild (ssm:GetParameters) để fetch động, tránh hardcode và vượt limit 4KB.
📘 Tài liệu tham khảo (AWS Official Docs - cập nhật 2026)
- CodeBuild Environment Variables Limits: AWS CodeBuild User Guide - Environment Variables (xác nhận 4096 bytes limit).
- SSM Parameter Store Integration: AWS CodeBuild - Use SSM Parameters (hướng dẫn chi tiết buildspec.yaml).
- Best Practices: AWS Well-Architected - Parameter Store (DevOps Lens).
- Exam Prep: AWS Certified DevOps Engineer Professional DOP-C02 blueprint (Domain 2: Configuration Management).
Hy vọng phân tích này giúp bạn ôn thi hiệu quả! 🚀 Nếu cần ví dụ buildspec.yaml cụ thể, hãy hỏi thêm nhé!
A developer needs to implement a solution that optimizes the photos that are served to each device to reduce load time and increase photo quality.
Which solution will meet these requirements MOST cost-effectively?
- A Use S3 Batch Operations to invoke an AWS Lambda function to create new variants of the photos with the required dimensions and resolutions. Create a dynamic CloudFront origin that automatically maps the request of each device to the corresponding photo variant.
- B Use S3 Batch Operations to invoke an AWS Lambda function to create new variants of the photos with the required dimensions and resolutions. Create a Lambda@Edge function to route requests to the corresponding photo variant by using request headers.
- C Create a Lambda@Edge function that optimizes the photos upon request and returns the photos as a response. Change the CloudFront TTL cache policy to the maximum value possible.
- D Create a Lambda@Edge function that optimizes the photos upon request and returns the photos as a response. In the same function, store a copy of the processed photos on Amazon S3 for subsequent requests.
Xem giải thích
🧩 Giải thích nội dung câu hỏi
Câu hỏi xoay quanh một công ty đang mở rộng ứng dụng di động chia sẻ ảnh cho hàng trăm thiết bị có kích thước màn hình và độ phân giải khác nhau. Ảnh gốc được lưu trữ ở Amazon S3 với định dạng và độ phân giải ban đầu. Ứng dụng sử dụng Amazon CloudFront để phân phối ảnh. Mỗi yêu cầu từ app sẽ kèm theo tham số GET chứa kích thước màn hình (dimension) và độ phân giải (resolution) của thiết bị.
Yêu cầu chính: Triển khai giải pháp tối ưu hóa ảnh phù hợp với từng thiết bị để giảm thời gian tải (load time) và tăng chất lượng ảnh, đồng thời phải tiết kiệm chi phí nhất (MOST cost-effectively).
🛠️ Thách thức chính:
- Không thể tạo trước (pre-generate) tất cả biến thể ảnh vì có hàng trăm thiết bị → Tốn kém lưu trữ và xử lý.
- Cần xử lý động (on-demand) dựa trên tham số GET, tận dụng CloudFront để cache và phân phối nhanh.
- Giải pháp phải cân bằng giữa hiệu suất edge (Lambda@Edge) và lưu trữ lâu dài (S3) để tránh lặp lại xử lý không cần thiết.
📘 Kiến thức AWS cập nhật 2026: Sử dụng Lambda@Edge (viewer request/response) để xử lý tại edge location gần user, kết hợp CloudFront caching và S3 làm origin. Không dùng S3 Batch cho dynamic variants vì nó dành cho batch jobs lớn, không realtime.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Create a Lambda@Edge function that optimizes the photos upon request and returns the photos as a response. In the same function, store a copy of the processed photos on Amazon S3 for subsequent requests.
Lý do chọn đáp án này 🏆:
- Tiết kiệm chi phí nhất: Chỉ tối ưu hóa lần đầu tiên (on-demand) khi request đến, sau đó lưu biến thể vào S3 để CloudFront cache và phục vụ nhanh cho các request sau cùng tham số. Tránh xử lý lặp lại cho cùng thiết bị.
- Hiệu suất cao: Lambda@Edge chạy tại edge location của CloudFront, xử lý ngay trước khi fetch từ S3, giảm latency. Trả response trực tiếp và lưu S3 song song.
- Phù hợp yêu cầu: Sử dụng GET params (query strings) để Lambda@Edge đọc dimension/resolution, resize ảnh (dùng thư viện như Sharp.js), và cache với CloudFront TTL mặc định.
- So với các option khác, tránh chi phí upfront (Batch) hoặc re-process mỗi lần (không cache S3).
📋 Phân tích tất cả các phương án
-
❌ Use S3 Batch Operations to invoke an AWS Lambda function to create new variants of the photos with the required dimensions and resolutions. Create a dynamic CloudFront origin that automatically maps the request of each device to the corresponding photo variant.
Sai vì: S3 Batch Operations dành cho batch jobs lớn trên hàng triệu objects (như tagging hoặc copy), không phù hợp tạo variants động cho hàng trăm thiết bị (cần biết trước tất cả params → không khả thi, tốn storage khổng lồ). Dynamic origin phức tạp, tăng latency và chi phí routing, không cost-effective. -
❌ Use S3 Batch Operations to invoke an AWS Lambda function to create new variants of the photos with the required dimensions and resolutions. Create a Lambda@Edge function to route requests to the corresponding photo variant by using request headers.
Sai vì: Tương tự option 1, S3 Batch không hỗ trợ dynamic variants realtime dựa trên GET params (chỉ chạy one-time). Lambda@Edge chỉ route chứ không optimize, vẫn cần pre-generate tất cả → tốn kém storage/processing cho unused variants, vi phạm "MOST cost-effectively". -
❌ Create a Lambda@Edge function that optimizes the photos upon request and returns the photos as a response. Change the CloudFront TTL cache policy to the maximum value possible.
Sai vì: Lambda@Edge optimize mỗi request (không lưu S3), dẫn đến re-process lặp lại cho cùng thiết bị → tốn Lambda invocations cao, không scale với traffic lớn. Max TTL chỉ cache response tạm thời ở CloudFront edge, nhưng Lambda runtime vẫn chạy thường xuyên, kém cost-effective so với cache S3 lâu dài. -
✅ Create a Lambda@Edge function that optimizes the photos upon request and returns the photos as a response. In the same function, store a copy of the processed photos on Amazon S3 for subsequent requests.
Đúng vì: On-demand + cache thông minh: Lần đầu fetch gốc từ S3 → optimize → return + lưu variant mới vào S3 (key dựa trên params, ví dụ:photo_id/widthxheight.jpg). Các request sau: CloudFront fetch trực tiếp variant từ S3, hit cache nhanh. Tiết kiệm Lambda runs dài hạn, tận dụng S3 Intelligent-Tiering cho storage rẻ. Hoàn hảo cho hundreds devices!
📚 Tài liệu tham khảo (AWS cập nhật 2026)
- Lambda@Edge Image Optimization: AWS Docs - Image Optimization with Lambda@Edge – Ví dụ chính thức resize ảnh realtime.
- CloudFront + S3 Caching: CloudFront Developer Guide - Dynamic Content.
- S3 Batch Limitations: S3 Batch Operations Docs – Không cho dynamic per-request.
- Best Practices DevOps: AWS Well-Architected Framework - Reliability Pillar (2026 update): Edge computing + caching cho media delivery.
Hy vọng phân tích này giúp bạn ôn thi DOP-C02 hiệu quả! 🚀 Nếu cần code sample Lambda@Edge, hỏi thêm nhé!
A development team performs load testing on the application and finds that the data retrieval time is higher than expected. The development team needs a solution that reduces the data retrieval time with the least possible effort.
Which solution meets these requirements?
- A Add local secondary indexes (LSIs) for the trading data.
- B Store the trading data in Amazon S3, and use S3 Transfer Acceleration.
- C Add retries with exponential backoff for DynamoDB queries.
- D Use DynamoDB Accelerator (DAX) to cache the trading data.
Xem giải thích
🧩 Giải thích nội dung câu hỏi
Câu hỏi mô tả một công ty đang xây dựng ứng dụng giao dịch chứng khoán (stock trading), yêu cầu độ trễ dưới 1 mili giây (sub-millisecond latency) để xử lý các yêu cầu giao dịch. Ứng dụng sử dụng Amazon DynamoDB để lưu trữ toàn bộ dữ liệu giao dịch cần thiết cho mỗi yêu cầu.
Đội phát triển thực hiện load testing và phát hiện thời gian truy xuất dữ liệu (data retrieval time) cao hơn mong đợi. Yêu cầu là tìm giải pháp giảm thời gian truy xuất dữ liệu với nỗ lực ít nhất (least possible effort).
🛠️ Vấn đề cốt lõi: DynamoDB có độ trễ đọc điển hình khoảng 1-10ms (hoặc thấp hơn với on-demand), nhưng để đạt sub-ms (dưới 1ms, thường microsecond), cần cache in-memory. Giải pháp phải dễ triển khai, không thay đổi lớn kiến trúc.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Use DynamoDB Accelerator (DAX) to cache the trading data.
Lý do:
DAX là cache in-memory hoàn toàn quản lý (fully managed) dành riêng cho DynamoDB, giảm độ trễ đọc xuống microsecond (sub-millisecond) bằng cách lưu dữ liệu nóng (hot data) trong RAM. Nó tương thích hoàn toàn với ứng dụng DynamoDB hiện tại (chỉ thay endpoint), không cần thay đổi code lớn → nỗ lực ít nhất. Trong load testing cao, DAX cache hit rate cao giúp tránh đọc từ đĩa DynamoDB. Theo tài liệu AWS mới nhất (2024-2026), DAX vẫn là giải pháp chuẩn cho low-latency read-heavy workload như trading. 📘
📋 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, đánh dấu ✅ đúng hoặc ❌ sai:
-
❌ [SAI] Add local secondary indexes (LSIs) for the trading data.
LSIs giúp truy vấn nhanh hơn trên các thuộc tính phụ (non-key attributes) trong cùng partition key, nhưng không giảm độ trễ đọc cơ bản từ DynamoDB (vẫn ~1-10ms). LSIs phải tạo lúc table creation, không hỗ trợ sub-ms latency, và không cache dữ liệu → không giải quyết vấn đề retrieval time cao trong load test. -
❌ [SAI] Store the trading data in Amazon S3, and use S3 Transfer Acceleration.
S3 là object storage cho dữ liệu lớn, độ trễ cao hơn DynamoDB (hàng chục ms) ngay cả với Transfer Acceleration (chỉ tối ưu transfer tốc độ cao từ xa). Không phù hợp cho real-time trading cần sub-ms, phải refactor toàn bộ app từ DynamoDB sang S3 → nỗ lực lớn, không đáp ứng yêu cầu. -
❌ [SAI] Add retries with exponential backoff for DynamoDB queries.
Retries với exponential backoff chỉ xử lý throttling errors (ProvisionedThroughputExceeded) bằng cách thử lại, không giảm độ trễ đọc thực tế mà có thể tăng thời gian trung bình. Đây là best practice cho reliability, nhưng không cache dữ liệu → vô hiệu với vấn đề latency cao trong load test. -
✅ [ĐÚNG] Use DynamoDB Accelerator (DAX) to cache the trading data.
Như đã giải thích: DAX cung cấp cache cluster in-memory, độ trễ đọc <1ms (thường 100μs), tích hợp liền mạch với DynamoDB (TTL tự động, consistency options). Triển khai nhanh (tạo cluster qua console/CLI), hỗ trợ ứng dụng trading read-heavy. Hoàn hảo cho "least effort" vì chỉ update client endpoint. 🏆
📚 Tài liệu tham khảo (cập nhật AWS 2024-2026)
- AWS DynamoDB DAX Documentation: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.html (Chi tiết về sub-ms latency và integration).
- DynamoDB Best Practices: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/best-practices.html (So sánh DAX vs. indexes/retries).
- AWS Well-Architected Framework - Performance Pillar: Khuyến nghị DAX cho low-latency caching (https://aws.amazon.com/architecture/well-architected/).
Giải pháp này đảm bảo tuân thủ AWS best practices cho high-frequency trading apps! 🚀
Which combination of actions should the developer take to achieve this goal? (Choose two.)
- A Install the Amazon CloudWatch agent on the EC2 instances.
- B Install the AWS X-Ray daemon on the EC2 instances.
- C Configure the application to write JSON-formatted logs to /var/log/cloudwatch.
- D Configure the application to write trace data to /var/log/xray.
- E Install and configure the AWS X-Ray SDK for Python in the application.
Xem giải thích
🧩 Giải thích nội dung câu hỏi
Câu hỏi tập trung vào việc kích hoạt tính năng tracing (theo dõi luồng yêu cầu ứng dụng) cho một ứng dụng Python chạy trên các instance Amazon EC2. Mục tiêu là giúp developer debug các vấn đề hiệu suất (performance issues) trong mã nguồn. AWS cung cấp dịch vụ AWS X-Ray chuyên dụng cho tracing phân tán, giúp phân tích độ trễ, lỗi và luồng dữ liệu giữa các thành phần ứng dụng. Câu hỏi yêu cầu chọn hai hành động kết hợp (choose two) để đạt được mục tiêu này, dựa trên kiến thức cập nhật mới nhất của AWS X-Ray (phiên bản 2026 vẫn giữ nguyên cơ chế daemon + SDK cho EC2).
✅ Đáp án đúng và lý do lựa chọn
Hai phương án đúng là:
-
Install the AWS X-Ray daemon on the EC2 instances.
- Lý do: AWS X-Ray daemon là agent bắt buộc phải cài trên EC2 để thu thập và gửi segment trace data từ ứng dụng lên dịch vụ X-Ray. Nó lắng nghe trên UDP port 2000 hoặc FIFO pipe, xử lý dữ liệu trace một cách hiệu quả mà không làm nặng ứng dụng. Không có daemon, trace data từ SDK sẽ không được gửi đi.
-
Install and configure the AWS X-Ray SDK for Python in the application.
- Lý do: SDK X-Ray cho Python (pip install aws-xray-sdk) dùng để instrument (nhúng code tracing) vào ứng dụng, tự động capture subsegments cho các thư viện phổ biến như boto3, requests, hoặc SQLAlchemy. Kết hợp với daemon, nó tạo trace hoàn chỉnh để visualize trên X-Ray console, giúp debug performance chính xác.
🛠️ 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 cách đầy đủ, giữ nguyên văn bản gốc bằng tiếng Anh. Mỗi phương án được đánh giá đúng/sai dựa trên tài liệu AWS X-Ray chính thức (cập nhật 2026: hỗ trợ Python 3.9+, daemon v3+ với tính năng sampling cải tiến).
-
Install the Amazon CloudWatch agent on the EC2 instances.
❌ Sai: CloudWatch agent dùng để thu thập metrics, logs và traces từ host OS (như CPU, disk), nhưng không hỗ trợ tracing ứng dụng cấp code như X-Ray. Nó chỉ embed X-Ray traces cho một số dịch vụ managed (như Lambda, ECS), không phải EC2 tự quản. Sử dụng agent này sẽ không trace được requests trong Python app. -
Install the AWS X-Ray daemon on the EC2 instances.
✅ Đúng: Như giải thích trên, daemon là thành phần cốt lõi trên EC2 để proxy trace data từ SDK lên X-Ray service qua HTTPS/443. Cài đặt qua RPM/DEB hoặc Docker, config file/etc/amazon/xray/cfg.ymlđể điều chỉnh buffer/sampling. Thiếu daemon, SDK không gửi được data. -
Configure the application to write JSON-formatted logs to /var/log/cloudwatch.
❌ Sai: Đây là config sai cho CloudWatch Logs agent (không liên quan X-Ray). X-Ray không đọc logs JSON từ file này; tracing yêu cầu binary segment format qua UDP/FIFO, không phải log file. Việc write thủ công như vậy chỉ tạo logs thường, không trace performance. -
Configure the application to write trace data to /var/log/xray.
❌ Sai: X-Ray daemon không đọc trace data từ file log/var/log/xray(đây chỉ là log của daemon itself). Ứng dụng phải gửi data qua UDP port 2000 (mặc định) hoặc named pipe/var/run/xray/xray-fifo. Config thủ công write file sẽ không hoạt động với X-Ray. -
Install and configure the AWS X-Ray SDK for Python in the application.
✅ Đúng: SDK (aws-xray-sdk) tích hợp với middleware như Flask/Django/Boto3, tự động ghi subsegments cho HTTP calls, DB queries. Ví dụ:from aws_xray_sdk.core import xray_recorder; xray_recorder.begin_segment('MyApp'). Phải kết hợp daemon để hoàn thiện.
📘 Tài liệu tham khảo
- AWS X-Ray Documentation: Tracing Python applications with X-Ray SDK (cập nhật 2026).
- Installing X-Ray Daemon on EC2: docs.aws.amazon.com/xray/latest/devguide/xray-daemon.html.
- Best Practices: AWS Well-Architected Framework - Observability Pillar (2026 edition).
(Nguồn chính thức từ AWS Console/Docs, kiểm chứng qua re:Post và certification exams DOP-C02).
To comply with an information security policy, the company must ensure that the Lambda functions all use a single securely encrypted database connection string to access Aurora.
Which solution will meet these requirements?
- A Use IAM database authentication for Aurora to enable secure database connections for all the Lambda functions.
- B Store the credentials and read the credentials from an encrypted Amazon RDS DB instance.
- C Store the credentials in AWS Systems Manager Parameter Store as a secure string parameter.
- D Use Lambda environment variables with a shared AWS Key Management Service (AWS KMS) key for encryption.
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 chạy trên các AWS Lambda functions liên tiếp, nhận dữ liệu từ Amazon SNS topic và ghi dữ liệu vào Amazon Aurora DB instance (một cơ sở dữ liệu quan hệ tương thích MySQL/PostgreSQL trên AWS RDS).
Yêu cầu bảo mật chính: Tất cả các Lambda functions phải sử dụng một chuỗi kết nối cơ sở dữ liệu (database connection string) duy nhất, được mã hóa an toàn để truy cập Aurora, nhằm tuân thủ chính sách bảo mật thông tin của công ty.
🛠️ Thách thức: Cần giải pháp lưu trữ và chia sẻ credentials (như username/password trong connection string) một cách an toàn, không hardcode, dễ quản lý tập trung cho nhiều Lambda, và hỗ trợ mã hóa mạnh mẽ (thường dùng KMS). Giải pháp phải đảm bảo tính single (duy nhất), securely encrypted (mã hóa an toàn), và phù hợp với serverless architecture.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Store the credentials in AWS Systems Manager Parameter Store as a secure string parameter.
Lý do chi tiết:
- AWS Systems Manager (SSM) Parameter Store là dịch vụ quản lý tham số (parameters) an toàn, hỗ trợ loại Secure String được mã hóa tự động bằng AWS KMS (mỗi parameter có thể dùng KMS key riêng hoặc mặc định).
- Tất cả Lambda functions có thể truy cập parameter này qua IAM roles (gán policy
ssm:GetParameter*), đảm bảo single connection string được chia sẻ tập trung, không cần lưu riêng lẻ. - Lambda retrieve parameter tại runtime qua AWS SDK (ví dụ:
ssm.get_parameter), tránh hardcode credentials. - ✅ Phù hợp hoàn hảo: Đáp ứng "single securely encrypted database connection string" (lưu connection string đầy đủ dưới dạng secure string), dễ audit, rotate, và tích hợp CI/CD. Đây là best practice cho serverless theo AWS Well-Architected Framework (Reliability & Security pillars).
- Kiến thức cập nhật 2026: SSM Parameter Store vẫn là lựa chọn tối ưu cho secrets đơn giản, miễn phí tier cao (40K parameters miễn phí/tháng), tích hợp sâu với Lambda Layers và Extensions.
📋 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, giữ nguyên văn bản gốc tiếng Anh. Mỗi phương án được đánh giá dựa trên tính phù hợp với yêu cầu "single securely encrypted database connection string".
-
✅ [ĐÚNG] Store the credentials in AWS Systems Manager Parameter Store as a secure string parameter.
🧩 Giải thích đúng: Như đã nêu ở trên, SSM Parameter Store lưu trữ connection string (bao gồm credentials) dưới dạng secure string, mã hóa bằng KMS, chia sẻ dễ dàng cho tất cả Lambda qua IAM. Không có rủi ro lộ thông tin, hỗ trợ versioning và audit logs qua CloudTrail. Best practice cho multi-Lambda scenarios. -
❌ [SAI] Use IAM database authentication for Aurora to enable secure database connections for all the Lambda functions.
🧩 Giải thích sai: IAM Database Authentication cho Aurora sử dụng IAM roles/tokens tạm thời (15 phút) thay thế password trong connection string (dùngAWS_IAM_AUTHparameter). Không lưu trữ hay sử dụng "connection string với credentials encrypted" cố định – trái với yêu cầu "database connection string" truyền thống (có username/password). Phù hợp cho zero-credential, nhưng không khớp "single encrypted string". -
❌ [SAI] Store the credentials and read the credentials from an encrypted Amazon RDS DB instance.
🧩 Giải thích sai: Lưu credentials vào một RDS instance khác (dù encrypted) tạo circular dependency (Lambda cần creds để truy cập RDS lưu creds), tăng rủi ro bảo mật (DB dễ bị tấn công SQL injection), và không phải best practice. AWS không khuyến nghị dùng DB làm secret store; thay vào đó dùng SSM/Secrets Manager. Vi phạm nguyên tắc least privilege và khó quản lý "single" string. -
❌ [SAI] Use Lambda environment variables with a shared AWS Key Management Service (AWS KMS) key for encryption.
🧩 Giải thích sai: Lambda env vars có thể encrypt bằng KMS (từ 2020), nhưng không đảm bảo "single" cho nhiều functions – mỗi Lambda cần set env var riêng (hoặc replicate), khó quản lý tập trung/rotate. Env vars vẫn có thể expose qua logs/API nếu misconfig, kém an toàn hơn SSM (không audit tự động). AWS recommend SSM/Secrets Manager cho secrets động thay vì env vars tĩnh.
📘 Tài liệu tham khảo (cập nhật AWS 2026)
- AWS SSM Parameter Store Docs: docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html – Hướng dẫn Secure Strings & Lambda integration.
- Aurora Security Best Practices: docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.IAMDBAuth.html – So sánh IAM auth vs secrets.
- Lambda Secrets Management: docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html & AWS Well-Architected: aws.amazon.com/architecture/well-architected.
- Exam Prep (DOP-C02): AWS Certified DevOps Engineer Professional Sample Questions – Chủ đề Secure Secrets Management in Serverless.
🛠️ Lời khuyên DevOps: Luôn dùng SSM/Secrets Manager cho production secrets, kết hợp KMS customer-managed keys và CloudTrail để audit!