Ngân hàng đề — AWS Certified Developer Associate
Tìm thấy 1356 câu.
How should the developer reference the parameter that contains the database hostname?
- A Use the ssm dynamic reference.
- B Use the Ref intrinsic function.
- C Use the Fn::ImportValue intrinsic function.
- D Use the ssm-secure dynamic reference.
Xem giải thích
🧩 Giải thích chi tiết nội dung câu hỏi
Câu hỏi xoay quanh việc triển khai ứng dụng trên AWS Cloud bằng AWS CloudFormation (một dịch vụ IaC - Infrastructure as Code). Ứng dụng cần kết nối với một Amazon RDS database hiện có, và hostname của RDS được lưu trữ dưới dạng plaintext (không mã hóa) trong AWS Systems Manager (SSM) Parameter Store. Nhà phát triển muốn tham chiếu (reference) giá trị hostname này trực tiếp vào CloudFormation template để ứng dụng có thể khởi tạo (initialize) ngay khi stack được tạo.
Vấn đề cốt lõi: Làm thế nào để lấy giá trị từ SSM Parameter Store một cách an toàn và hiệu quả trong template CloudFormation? Điều này yêu cầu sử dụng cơ chế dynamic reference của CloudFormation, vì giá trị được lưu động và không phải là parameter nội bộ của template. Kiến thức áp dụng phiên bản mới nhất AWS (2024-2026): CloudFormation hỗ trợ Dynamic References cho SSM từ năm 2019, với cải tiến bảo mật và hiệu suất đến 2024.
✅ Đáp án đúng: Use the ssm dynamic reference
Lý do lựa chọn:
Đây là cách chính xác nhất để tham chiếu giá trị plaintext từ SSM Parameter Store. Cú pháp sử dụng là {{resolve:ssm:/parameter/name:version}} (hoặc latest nếu không chỉ định version). CloudFormation sẽ tự động resolve giá trị tại thời điểm tạo stack mà không expose giá trị ra log hoặc console. Phương pháp này an toàn, hỗ trợ plaintext trực tiếp, và được khuyến nghị trong best practices AWS cho việc tích hợp SSM với CloudFormation. ✅
📋 Phân tích tất cả các phương án trả lời
-
Use the ssm dynamic reference.
✅ Đúng. Như đã giải thích, đây là dynamic reference dành cho giá trị plaintext trong SSM Parameter Store. Nó resolve giá trị động tại runtime của stack creation, không cần quyền IAM phức tạp thêm, và phù hợp hoàn hảo với yêu cầu "plaintext value". Ví dụ: Trong template YAML:DBHost: !Sub '{{resolve:ssm:${DBParamName}}}'. 🛠️ -
Use the Ref intrinsic function.
❌ Sai. Hàm Ref chỉ dùng để tham chiếu parameters hoặc resources được định nghĩa trực tiếp trong cùng template (như Parameter section). Nó không thể lấy giá trị từ SSM Parameter Store bên ngoài. Nếu dùng Ref ở đây, CloudFormation sẽ báo lỗi vì không tìm thấy reference nội bộ. Không phù hợp cho dữ liệu động từ dịch vụ khác. 🚫 -
Use the Fn::ImportValue intrinsic function.
❌ Sai. Fn::ImportValue dùng để import exported values từ stack CloudFormation khác (qua Outputs/Exports). Nó không liên quan đến SSM Parameter Store. SSM không export values theo cách này, nên sử dụng sẽ gây lỗi "Export not found". Phương pháp này dành cho cross-stack references, không phải external services như SSM. 🔄 -
Use the ssm-secure dynamic reference.
❌ Sai. ssm-secure chỉ dùng cho giá trị SecureString (đã mã hóa) trong SSM, yêu cầu KMS key để decrypt. Vì hostname là plaintext (không mã hóa), dùng ssm-secure sẽ lỗi decrypt hoặc không resolve đúng. AWS khuyến nghị dùngssmcho plaintext vàssm-securecho sensitive data. Sai ngữ cảnh! 🔒
📘 Tài liệu tham khảo
- AWS Documentation chính thức (Dynamic References trong CloudFormation): https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html#dynamic-references-ssm (Cập nhật 2024, hỗ trợ SSM Parameter Store với plaintext/ssm-secure).
- SSM Parameter Store Best Practices: https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html.
- AWS re:Post & Exam Prep (DevOps Pro DOP-C02): Khuyến nghị dynamic refs cho integration SSM-CF (2023-2026 blueprint).
Hy vọng phân tích này giúp bạn nắm vững! Nếu cần ví dụ code template đầy đủ, hãy hỏi thêm nhé! 🚀
A developer needs to configure the Lambda function to avoid receiving rate limiting errors from the third-party service.
Which solution will meet these requirements?
- A Set the reserved concurrency on the Lambda function to match the number of concurrent requests that the third-party service allows.
- B Decrease the memory that is allocated to the Lambda function.
- C Set the provisioned concurrency on the Lambda function to match the number of concurrent requests that the third-party service allows.
- D Increase the timeout value that is specified on the Lambda function.
Xem giải thích
🧩 Phân tích nội dung câu hỏi
Câu hỏi xoay quanh tình huống một công ty sử dụng AWS Lambda function để gọi third-party service có giới hạn số lượng requests mỗi phút (rate limit). Nếu vượt quá giới hạn này, service sẽ trả về rate-limiting errors. Nhiệm vụ của developer là cấu hình Lambda function để tránh nhận lỗi này, đảm bảo số lượng invocations (thực thi) của Lambda không tạo ra burst requests vượt quá khả năng chịu tải của third-party service.
Vấn đề cốt lõi: Lambda có thể scale tự động lên hàng nghìn concurrent executions, dẫn đến flood requests đến third-party. Giải pháp cần kiểm soát concurrency (số lượng thực thi đồng thời) của Lambda để khớp với giới hạn của service bên ngoài. Đây là kiến thức cốt lõi trong AWS Lambda scaling và concurrency management (cập nhật đến 2024-2026, theo AWS Well-Architected Framework cho Serverless).
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Set the reserved concurrency on the Lambda function to match the number of concurrent requests that the third-party service allows.
Lý do:
- Reserved concurrency là cơ chế giới hạn cứng số lượng concurrent executions dành riêng cho một Lambda function cụ thể (ví dụ: đặt 100 thì function chỉ chạy tối đa 100 instances đồng thời).
- Điều này throttle (hạn chế) invocations để tránh burst requests vượt quá rate limit của third-party service (requests/phút thường liên quan đến concurrency vì Lambda scale nhanh).
- Không ảnh hưởng đến các function khác trong account. Đây là giải pháp chuẩn theo best practices AWS để bảo vệ downstream services khỏi Lambda throttling. 🛡️
📋 Giải thích tất cả các phương án
Dưới đây là phân tích chi tiết từng lựa chọn, giữ nguyên văn bản gốc bằng tiếng Anh:
-
Set the reserved concurrency on the Lambda function to match the number of concurrent requests that the third-party service allows.
✅ Đúng (như đã giải thích ở trên). Reserved concurrency trực tiếp kiểm soát số invocations đồng thời, khớp giới hạn third-party, tránh rate-limiting errors. Hoàn hảo cho rate limit kiểu RPM/RPS. -
Decrease the memory that is allocated to the Lambda function.
❌ Sai. Giảm memory sẽ làm giảm CPU allocation (vì memory tỷ lệ với CPU theo mô hình Lambda), dẫn đến function chạy chậm hơn. Không liên quan gì đến concurrency hay số requests/phút; thậm chí có thể làm tích tụ queue invocations, tăng rủi ro burst. 🐌 -
Set the provisioned concurrency on the Lambda function to match the number of concurrent requests that the third-party service allows.
❌ Sai. Provisioned concurrency pre-provision (chuẩn bị sẵn) instances để giảm cold starts và đảm bảo latency thấp, nhưng KHÔNG giới hạn concurrency – nó chỉ cung cấp concurrency sẵn có lên đến con số đó, Lambda vẫn có thể scale vượt quá nếu traffic cao. Không throttle được requests đến third-party. ⚠️ -
Increase the timeout value that is specified on the Lambda function.
❌ Sai. Tăng timeout chỉ cho phép function chạy lâu hơn trước khi timeout (mặc định 3s, max 15 phút). Không kiểm soát số lượng invocations đồng thời hay rate của requests; có thể làm tình hình tệ hơn nếu function giữ kết nối lâu. ⏱️
📘 Tài liệu tham khảo
- AWS Lambda Documentation - Concurrency: Managing concurrency for Amazon Lambda functions (cập nhật 2024, nhấn mạnh reserved concurrency cho throttling downstream).
- AWS Well-Architected Framework - Serverless Lens: Phần "Operational Excellence" khuyến nghị reserved concurrency bảo vệ external APIs.
- AWS re:Post & Best Practices: Case studies về rate limiting với third-party (tìm "Lambda reserved concurrency rate limit").
- Kiến thức DOP-C02 exam (2024-2026): Topic "Lambda scaling controls".
Giải pháp này giúp hệ thống resilient và cost-effective! 🚀 Nếu cần ví dụ code Terraform/CLI để set reserved concurrency, hãy hỏi thêm nhé.
What should the developer do to meet these requirements in the MOST operationally efficient way?
- A Create a buildspec file that invokes the AWS Copilot CLI commands to build and deploy the application. Use the AWS Copilot CLI to create an AWS CodePipeline that uses the CodeCommit repository in the source stage and AWS CodeBuild in the build stage.
- B Use the AWS Serverless Application Model (AWS SAM) CLI to bootstrap and initialize an AWS CodePipeline configuration. Use the CodeCommit repository as the source. Invoke the AWS Copilot CLI to build and deploy the application.
- C Use the AWS Copilot CLI to define the AWS Copilot pipeline and to deploy the AWS CodePipeline. Select CodeCommit as the source for the AWS CodePipeline.
- D Define an AWS CloudFormation template for an AWS CodePipeline with CodeCommit as the source. Configure the template as an AWS Copilot CLI add-on. Use the AWS Copilot CLI to deploy the application.
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 tối ưu hóa hoạt động (MOST operationally efficient way) để tạo quy trình triển khai tự động cho ứng dụng containerized được xây dựng bằng AWS Copilot.
- Bối cảnh: Nhà phát triển đang sử dụng AWS Copilot CLI để triển khai ứng dụng trong giai đoạn phát triển (development). Mã nguồn đã được commit vào một repository AWS CodeCommit mới.
- Yêu cầu: Cần thiết lập quy trình triển khai tự động (automated deployment process) trước khi đưa ứng dụng vào môi trường production. Quy trình này phải tận dụng Copilot một cách hiệu quả nhất, giảm thiểu công sức vận hành thủ công, và tích hợp tự nhiên với các dịch vụ AWS như CodePipeline.
- Mục tiêu chính: Sử dụng tính năng built-in của AWS Copilot để tạo pipeline CI/CD (Continuous Integration/Continuous Deployment) một cách đơn giản, không cần cấu hình phức tạp từ đầu.
AWS Copilot (phiên bản mới nhất đến 2026) là công cụ CLI mã nguồn mở giúp đơn giản hóa việc triển khai ứng dụng container trên ECS, EKS hoặc Fargate, và hỗ trợ tích hợp trực tiếp với AWS CodePipeline qua lệnh pipeline.
📘 Tài liệu tham khảo:
- AWS Copilot Pipelines Documentation (cập nhật 2024-2026).
- AWS Copilot CLI Commands.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Use the AWS Copilot CLI to define the AWS Copilot pipeline and to deploy the AWS CodePipeline. Select CodeCommit as the source for the AWS CodePipeline.
Lý do:
- 🛠️ AWS Copilot có lệnh built-in
copilot pipeline init(vàcopilot pipeline deploy) để tự động tạo và triển khai AWS CodePipeline với CodeCommit làm source stage. Điều này là cách hiệu quả nhất về mặt vận hành vì:- Không cần viết buildspec thủ công hoặc template CloudFormation.
- Copilot tự động cấu hình các stage: source (CodeCommit), build (CodeBuild với ECR push), test, deploy (ECS/EKS).
- Hỗ trợ multi-environment (dev/staging/prod) và branch-based deployment.
- Giảm thiểu lỗi cấu hình, phù hợp với best practice DevOps trên AWS (tích hợp IaC - Infrastructure as Code).
- Đây là tính năng core của Copilot từ phiên bản 1.0+, được khuyến nghị chính thức cho automated CI/CD.
❌ Phân tích tất cả các phương án (đúng/sai)
-
Phương án A (SAI): Create a buildspec file that invokes the AWS Copilot CLI commands to build and deploy the application. Use the AWS Copilot CLI to create an AWS CodePipeline that uses the CodeCommit repository in the source stage and AWS CodeBuild in the build stage.
Giải thích sai: ❌ Phương án này phức tạp hóa không cần thiết bằng cách yêu cầu tạo buildspec thủ công để gọi Copilot CLI trong CodeBuild. Copilot CLI không được thiết kế để "tạo CodePipeline" thủ công như vậy (Copilot chỉ init pipeline qua lệnh riêng). Cách này vi phạm nguyên tắc "operationally efficient" vì tăng công sức maintain buildspec và dễ lỗi khi scale. -
Phương án B (SAI): Use the AWS Serverless Application Model (AWS SAM) CLI to bootstrap and initialize an AWS CodePipeline configuration. Use the CodeCommit repository as the source. Invoke the AWS Copilot CLI to build and deploy the application.
Giải thích sai: ❌ AWS SAM dành cho serverless (Lambda/API Gateway), không tương thích trực tiếp với containerized apps của Copilot (ECS/EKS). Việc dùng SAM CLI để bootstrap CodePipeline rồi invoke Copilot là không hiệu quả, tạo sự lệch lạc giữa công cụ (SAM không hỗ trợ Copilot native), dẫn đến maintain khó khăn và không tận dụng được pipeline built-in của Copilot. -
Phương án C (ĐÚNG): Use the AWS Copilot CLI to define the AWS Copilot pipeline and to deploy the AWS CodePipeline. Select CodeCommit as the source for the AWS CodePipeline.
Giải thích đúng: ✅ Đây là cách chính xác và hiệu quả nhất. Sử dụngcopilot pipeline init --source codecommit/repo-nameđể Copilot tự động tạo toàn bộ CodePipeline với CodeCommit source, tích hợp ECR, ECS deploy. Chỉ cần vài lệnh CLI, hỗ trợ Git branches cho multi-env, phù hợp production-ready. -
Phương án D (SAI): Define an AWS CloudFormation template for an AWS CodePipeline with CodeCommit as the source. Configure the template as an AWS Copilot CLI add-on. Use the AWS Copilot CLI to deploy the application.
Giải thích sai: ❌ Không có khái niệm "Copilot CLI add-on" cho CloudFormation template như vậy (Copilot addons chỉ cho app resources như DB/S3). Việc tự viết CFN template cho CodePipeline là thủ công và kém efficient, vì Copilot đã cung cấp pipeline native mà không cần template ngoài.
🛠️ Khuyến nghị thực hiện: Chạy copilot app init, commit code, rồi copilot pipeline init --source aws:codecommit/repo --produce để deploy pipeline. Kiểm tra bằng AWS Console > CodePipeline! 🚀
Which option should the developer use for a partition key to meet these requirements?
- A A randomly generated universally unique identifier (UUID)
- B The customer's full name
- C The date when the customer signed up for the rewards program
- D The name of the customer's pet
Xem giải thích
🧩 Phân tích chi tiết nội dung câu hỏi
Câu hỏi tập trung vào việc thiết kế partition key tối ưu cho bảng Amazon DynamoDB trong một ứng dụng quản lý điểm thưởng khách hàng của cửa hàng thú cưng. Nhà phát triển cần tối ưu hóa hiệu suất truy vấn (query performance) và hạn chế tình trạng quá tải partition (partition overload) ngay từ đầu, trước khi tiến hành phân tích hiệu suất thực tế.
📘 Bối cảnh kỹ thuật:
- DynamoDB là cơ sở dữ liệu NoSQL phân tán, dữ liệu được phân bổ vào các partition dựa trên giá trị partition key.
- Partition overload (hot partition) xảy ra khi một partition nhận quá nhiều truy vấn/ghi dữ liệu, dẫn đến throttling và giảm hiệu suất.
- Để tránh điều này, partition key phải có cardinality cao (nhiều giá trị duy nhất) và phân bố đều (evenly distributed) dữ liệu. AWS khuyến nghị sử dụng key ngẫu nhiên như UUID để đảm bảo điều này (theo DynamoDB Best Practices, cập nhật đến 2026).
- Mục tiêu: Chọn partition key giúp dữ liệu phân tán đều ngay từ giai đoạn thiết kế.
🛠️ Yêu cầu chính: Partition key phải ngăn chặn hot partition trước khi có dữ liệu thực tế để phân tích.
✅ Đáp án đúng: A randomly generated universally unique identifier (UUID)
Lý do lựa chọn ✅:
- UUID (Universally Unique Identifier) được tạo ngẫu nhiên (ví dụ: UUID v4) đảm bảo mỗi item có giá trị partition key duy nhất và phân bố đều hoàn hảo trên các partition vật lý của DynamoDB.
- Điều này tối ưu query performance vì tránh hot partition từ đầu, giảm throttling và tăng throughput.
- Phù hợp với best practice AWS: Sử dụng random UUID cho workload có lượng ghi cao, không phụ thuộc vào thuộc tính kinh doanh (theo AWS Well-Architected Framework - Reliability Pillar, 2026).
- Nguồn tham khảo: AWS DynamoDB Developer Guide - Choosing the Right Partition Key và DynamoDB Best Practices.
📋 Giải thích chi tiết tất cả các phương án
-
A randomly generated universally unique identifier (UUID) ✅
Đúng vì: UUID ngẫu nhiên có cardinality cực cao (khoảng 2^128 giá trị duy nhất) và phân bố đều tự nhiên, giúp DynamoDB tự động cân bằng tải trên hàng nghìn partition. Không lo hot partition ngay cả với traffic cao đột biến. Đây là lựa chọn lý tưởng cho ứng dụng mới chưa có dữ liệu thực tế để phân tích. 🏆 -
The customer's full name ❌
Sai vì: Tên đầy đủ khách hàng có cardinality thấp (nhiều người trùng tên, ví dụ: "Nguyễn Văn A"), dẫn đến hot partition khi nhiều item cùng key đổ vào một partition. Query performance kém, dễ throttling. Không khuyến nghị cho partition key chính (AWS docs cảnh báo về low-cardinality attributes). 🚫 -
The date when the customer signed up for the rewards program ❌
Sai vì: Ngày đăng ký có phân bố không đều (nhiều khách hàng signup cùng ngày cao điểm như Black Friday), gây partition overload nghiêm trọng trên các partition tương ứng với ngày đó. Cardinality thấp (chỉ vài trăm ngày/năm), vi phạm nguyên tắc even distribution. 🕒❌ -
The name of the customer's pet ❌
Sai vì: Tên thú cưng phổ biến (như "Mimi", "Buddy") dẫn đến cardinality thấp và phân bố lệch, tạo hot partition cho tên hay dùng. Không đảm bảo even distribution, query chậm và dễ overload. Tương tự low-cardinality issue như tên người. 🐶🚫
Kết luận tổng quát 🧠: Luôn ưu tiên random high-cardinality key như UUID cho DynamoDB để scale tự động. Nếu cần query theo thuộc tính kinh doanh, dùng GSI (Global Secondary Index) với key phù hợp. Tham khảo thêm: AWS re:Post - DynamoDB Partition Key Design.
What is the MOST likely cause of the developer's access issue?
- A The access permissions to the developer's AWS CLI binary file have changed.
- B The permission set that is assumed by IAM Identity Center does not have the necessary permissions to complete the API call.
- C The credentials from the IAM Identity Center federated role have expired.
- D The developer is attempting to make API calls to the incorrect AWS account.
Xem giải thích
🧠 Phân tích câu hỏi trắc nghiệm AWS bởi AWS Certified DevOps Engineer Professional
(Kiến thức dựa trên phiên bản AWS mới nhất đến năm 2026, bao gồm IAM Identity Center với hỗ trợ SSO enhanced và CLI v2.x)
🧩 Giải thích nội dung câu hỏi một cách chi tiết và rõ ràng:
Câu hỏi mô tả tình huống một lập trình viên (developer) sử dụng AWS IAM Identity Center (trước đây gọi là AWS SSO - Single Sign-On) để xác thực và tương tác với AWS CLI (Command Line Interface) cũng như AWS SDKs trên máy tính cá nhân (local workstation). Ban đầu, khi mới cấu hình SSO, các lệnh gọi API đến các dịch vụ AWS hoạt động bình thường (API calls were working). Tuy nhiên, hiện tại developer gặp lỗi Access Denied (từ chối truy cập). Quan trọng là developer không thay đổi bất kỳ file cấu hình nào (như ~/.aws/config, ~/.aws/sso/cache) hoặc script trước đó đang chạy tốt.
Vấn đề cốt lõi là xác định nguyên nhân MOST likely (có khả năng cao nhất) gây ra lỗi Access Denied, trong bối cảnh sử dụng federated authentication qua IAM Identity Center. Đây là kịch bản phổ biến với temporary credentials từ SSO session, nơi credentials có thời hạn và cần refresh định kỳ.
✅ Đáp án đúng và lý do lựa chọn:
The credentials from the IAM Identity Center federated role have expired.
🛠️ Lý do chi tiết:
Trong IAM Identity Center, khi developer chạy lệnh aws sso login, hệ thống tạo ra temporary credentials (chứng chỉ tạm thời) từ federated role (vai trò liên kết) được assume qua SSO. Những credentials này có thời hạn mặc định (thường 1 giờ cho CLI session, hoặc lên đến 12 giờ tùy permission set config). Sau khi hết hạn, mọi API call sẽ bị Access Denied vì credentials không còn hợp lệ. Tình huống khớp hoàn hảo: trước đó work (chưa hết hạn), giờ lỗi, và không thay đổi config → hết hạn là nguyên nhân trực tiếp và likely nhất. Developer chỉ cần chạy lại aws sso login để refresh. Đây là hành vi chuẩn của IAM Identity Center theo docs AWS 2026.
📋 Phân tích tất cả các phương án (đúng/sai):
-
❌ The access permissions to the developer's AWS CLI binary file have changed.
Phương án này sai vì quyền truy cập vào file binary AWS CLI (như /usr/local/bin/aws) là quyền hệ thống local (file permissions trên OS), không liên quan đến xác thực AWS services. Lỗi Access Denied là từ AWS API (HTTP 403), không phải lỗi chạy CLI binary. Nếu binary bị thay đổi quyền, CLI sẽ báo lỗi "permission denied" ngay từ local, không phải Access Denied từ AWS. -
❌ The permission set that is assumed by IAM Identity Center does not have the necessary permissions to complete the API call.
Phương án này sai vì nếu permission set thiếu quyền, lỗi sẽ xảy ra ngay từ đầu khi mới config SSO. Câu hỏi nhấn mạnh "API calls were working" ban đầu và "no changes to configuration", nên permission set không thay đổi → không phải nguyên nhân. Permission set chỉ define IAM policies, nhưng credentials phải valid trước. -
✅ The credentials from the IAM Identity Center federated role have expired.
(Như đã giải thích ở phần đáp án đúng: temporary session hết hạn là nguyên nhân phổ biến nhất, khớp timeline "working before, now denied, no config change".) -
❌ The developer is attempting to make API calls to the incorrect AWS account.
Phương án này sai vì profile SSO trong ~/.aws/config chỉ định account cụ thể (qua sso_start_url và region), và developer không thay đổi config → không switch account. Nếu wrong account, lỗi sẽ là từ đầu hoặc báo explicit "account mismatch", không phải Access Denied (thường là credentials invalid).
📘 Tài liệu tham khảo chính thức AWS (cập nhật 2026):
- AWS CLI SSO Configuration 🛠️ (Giải thích session expiration và
aws sso login). - IAM Identity Center Troubleshooting ✅ (Phần "Access Denied after initial success" do expired tokens).
- Federated Credentials Best Practices 🧩 (Temporary creds từ SSO role, max 12h).
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ụ lệnh CLI, hãy hỏi nhé.
Which solution will meet these requirements?
- A Store the API key in AWS Systems Manager Parameter Store as a string parameter. Use the default AWS KMS key that AWS provides to encrypt the API key.
- B Store the API key in AWS Lambda environment variables. Create an AWS KMS customer managed key to encrypt the API key.
- C Store the API key in the code repository. Use an AWS managed key to encrypt the code repository.
- D Store the API key as an Amazon DynamoDB table record. Use an AWS managed key to encrypt the API key.
Xem giải thích
🧩 Phân tích chi tiết nội dung câu hỏi
Câu hỏi xoay quanh việc xây dựng một ứng dụng serverless trên AWS, cụ thể sử dụng AWS Lambda làm nền tảng chính. Ứng dụng cần lưu trữ API key bên ngoài (external API key) để xác thực (authenticate) với một ứng dụng third-party. Yêu cầu quan trọng nhất là:
- Lưu trữ API key như một phần của cấu hình AWS Lambda (AWS Lambda configuration).
- Có toàn quyền kiểm soát (full control) các khóa AWS KMS (Key Management Service) dùng để mã hóa (encrypt) API key.
- API key chỉ hiển thị (visible) cho các thực thể được ủy quyền (authorized entities), nghĩa là kiểm soát truy cập chặt chẽ qua chính sách KMS.
📌 Mục tiêu cốt lõi: Đảm bảo bảo mật cao, tích hợp trực tiếp với Lambda, sử dụng customer managed KMS key (CMK) thay vì AWS managed key hoặc default key (vì CMK cho phép tùy chỉnh policy, rotation, và full control). Đây là best practice cho serverless theo AWS Well-Architected Framework (Security Pillar), cập nhật đến 2026 với hỗ trợ KMS multi-Region keys và integration sâu hơn với Lambda.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Store the API key in AWS Lambda environment variables. Create an AWS KMS customer managed key to encrypt the API key.
Lý do chi tiết 🛠️:
- Lambda environment variables là phần cấu hình trực tiếp của Lambda function (qua Console, CLI, CDK/Terraform), phù hợp hoàn hảo với yêu cầu "store as a part of an AWS Lambda configuration".
- Tạo AWS KMS customer managed key (CMK) cho phép full control: Bạn có thể tùy chỉnh key policy, grant permissions chỉ cho Lambda execution role (qua IAM policy), tự động rotate key, và audit qua CloudTrail. Env vars được encrypt at-rest và chỉ decrypt khi Lambda runtime cần (least privilege).
- Visibility kiểm soát: Chỉ Lambda function (qua execution role) mới decrypt được, không expose plaintext. AWS hỗ trợ điều này từ Lambda 2018, cập nhật 2025-2026 với Lambda SnapStart và KMS key aliases cho serverless.
- Ưu điểm serverless: Không cần quản lý infra, scale tự động, chi phí thấp.
❌ Phân tích tất cả các phương án (đúng/sai)
Dưới đây là phân tích từng phương án một cách chi tiết. Tôi giữ nguyên văn bản gốc bằng tiếng Anh như yêu cầu, chỉ giải thích bằng tiếng Việt với lý do đúng/sai dựa trên tài liệu AWS mới nhất.
-
Phương án A (SAI): Store the API key in AWS Systems Manager Parameter Store as a string parameter. Use the default AWS KMS key that AWS provides to encrypt the API key.
❌ Sai vì: Parameter Store "string parameter" không mã hóa (plaintext), chỉ SecureString mới encrypt. Dùng "default AWS KMS key" là AWS owned key (không full control, AWS quản lý). Không phải "Lambda configuration" trực tiếp (phải fetch runtime qua SSM API, tăng latency và complexity). Không đáp ứng visibility chỉ authorized entities vì default key policy rộng. -
Phương án B (ĐÚNG): Store the API key in AWS Lambda environment variables. Create an AWS KMS customer managed key to encrypt the API key.
✅ Đúng vì: Như giải thích trên – tích hợp native với Lambda config, CMK cho full control (key policy tùy chỉnh), encrypt at-rest/decrypt on-demand chỉ cho Lambda role. Best practice cho secrets trong serverless (AWS docs 2026 xác nhận hỗ trợ KMS hybrid keys). -
Phương án C (SAI): Store the API key in the code repository. Use an AWS managed key to encrypt the code repository.
❌ Sai vì: Lưu trong code repository (như CodeCommit/GitHub) không phải Lambda configuration, dễ leak khi deploy (CI/CD pipeline). "AWS managed key" chỉ encrypt repo metadata, không bảo vệ secrets bên trong code. Vi phạm security best practice (never commit secrets), không kiểm soát visibility tốt. -
Phương án D (SAI): Store the API key as an Amazon DynamoDB table record. Use an AWS managed key to encrypt the API key.
❌ Sai vì: DynamoDB không phải Lambda configuration (phải query runtime, tăng cold start và cost). "AWS managed key" (default DynamoDB encryption) không full control (không tùy chỉnh policy chi tiết). Visibility kém vì table access qua IAM/DynamoDB policies rộng hơn Lambda role.
📘 Tài liệu tham khảo (AWS cập nhật đến 2026)
- AWS Lambda Developer Guide: Encrypting environment variables – Chi tiết CMK cho env vars.
- AWS KMS Developer Guide: Customer managed keys – Full control vs AWS managed.
- AWS Well-Architected Framework (Security Pillar, 2026 edition): Khuyến nghị secrets trong Lambda env vars + KMS CMK cho serverless.
- Systems Manager Parameter Store docs: SecureString limitations – Default key issues.
- CloudTrail/Audit: Theo dõi KMS calls cho compliance.
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ụ code Terraform/CDK, hãy hỏi thêm.
The developer wants to capture the client public IP addresses. The developer analyzes the log files and notices only the IP address of the ALB.
What must the developer do to capture the client public IP addresses in the log file?
- A Add a Host header to the HTTP server log configuration file.
- B Install the Amazon CloudWatch Logs agent on each EC2 instance. Configure the agent to write to the log file.
- C Install the AWS X-Ray daemon on each EC2 instance. Configure the daemon to write to the log file.
- D Add an X-Forwarded-For header to the HTTP server log configuration file.
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 tình huống thực tế trong AWS: Một lập trình viên đang phát triển ứng dụng để phân tích lưu lượng truy cập (traffic) đến một nhóm (fleet) các instance Amazon EC2. Các EC2 này nằm phía sau một Application Load Balancer (ALB) công khai (public). Trên mỗi EC2 chạy một HTTP server ghi log tất cả các request vào file log.
Vấn đề chính: Developer muốn ghi lại địa chỉ IP công khai của client (khách hàng thực sự), nhưng khi kiểm tra file log, chỉ thấy địa chỉ IP của ALB (không phải IP client gốc). Lý do là ALB hoạt động như một proxy (ngược), nên HTTP server trên EC2 chỉ nhận request từ IP của ALB, không phải từ client trực tiếp.
Mục tiêu: Cần cấu hình HTTP server để capture (bắt lấy) IP client thực sự vào file log. Đây là vấn đề phổ biến khi dùng load balancer, và giải pháp liên quan đến header HTTP mà ALB tự động thêm vào request.
(Kiến thức cập nhật AWS 2026: ALB vẫn hỗ trợ X-Forwarded-For header theo chuẩn RFC 7239 để forward client IP, không thay đổi cơ bản từ các phiên bản trước. Không cần Proxy Protocol v2 trừ khi dùng Network Load Balancer - NLB).
📘 Tài liệu tham khảo chính:
- AWS Documentation: Application Load Balancers - Preserve client IP addresses (X-Forwarded-For)
- AWS Best Practices: Logging client IP behind ALB
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Add an X-Forwarded-For header to the HTTP server log configuration file.
Lý do:
ALB tự động thêm X-Forwarded-For header vào mọi request forward đến backend (EC2), chứa địa chỉ IP công khai gốc của client (và các proxy trung gian nếu có). HTTP server mặc định log remote IP (là IP của ALB), nên cần cấu hình log format của server (ví dụ: Apache LogFormat hoặc Nginx log_format) để parse và ghi giá trị từ X-Forwarded-For header thay vì remote IP.
Ví dụ cấu hình Nginx:
log_format main '$http_x_forwarded_for - $remote_user [$time_local] "$request" $status ...';
Sau khi áp dụng, log file sẽ hiển thị IP client thực sự. 🛠️ Đây là giải pháp đơn giản, không tốn kém, không cần agent thêm.
🔍 Phân tích chi tiết tất cả các phương án (đúng/sai)
-
❌ [SAI] Add a Host header to the HTTP server log configuration file.
Giải thích sai: Host header chỉ chứa domain name của request (ví dụ: example.com), không liên quan đến IP client. Việc thêm nó vào log config chỉ ghi thông tin hostname, không giải quyết vấn đề capture IP. Header này do client gửi, không phải ALB forward đặc biệt. 🧨 Hoàn toàn không đúng! -
❌ [SAI] Install the Amazon CloudWatch Logs agent on each EC2 instance. Configure the agent to write to the log file.
Giải thích sai: CloudWatch Logs agent dùng để stream log file lên CloudWatch Logs service, giúp tập trung và phân tích log. Tuy nhiên, nó chỉ đọc và forward log hiện có, không thay đổi nội dung log (vẫn chỉ thấy IP ALB). Không capture được IP client thực. 🛤️ Phù hợp cho monitoring, nhưng không giải quyết gốc rễ. -
❌ [SAI] Install the AWS X-Ray daemon on each EC2 instance. Configure the daemon to write to the log file.
Giải thích sai: AWS X-Ray daemon dùng cho distributed tracing (theo dõi request end-to-end), ghi trace data vào file hoặc UDP. Nó không log IP client vào HTTP server log, mà tập trung vào performance metrics (latency, traces). ❌ Không liên quan đến việc modify log format để lấy IP từ header. -
✅ [ĐÚNG] Add an X-Forwarded-For header to the HTTP server log configuration file.
Giải thích đúng: Như đã nêu ở phần đáp án chính. ALB inject X-Forwarded-For (XFF) header với IP client gốc (ví dụ: "203.0.113.1, 10.0.0.1"). Cấu hình server log sử dụng$http_x_forwarded_for(Nginx/Apache) để extract giá trị đầu tiên (client IP thực). Hiệu quả ngay lập tức, không downtime. 🚀 Giải pháp chuẩn AWS!
Kết luận: 🏆 Phương án đúng tận dụng tính năng built-in của ALB mà không cần tool ngoài. Nếu dùng NLB, có thể cần Proxy Protocol, nhưng ở đây là ALB nên XFF là optimal. Áp dụng ngay cho production!
The company creates a role that includes the necessary permissions to access the DB instance. The company then assigns the role to the Lambda function. A developer must take additional action to give the Lambda function access to the DB instance.
What should the developer do to meet these requirements?
- A Assign a public IP address to the DB instance. Modify the security group of the DB instance to allow inbound traffic from the IP address of the Lambda function.
- B Set up an AWS Direct Connect connection between the Lambda function and the DB instance.
- C Configure an Amazon CloudFront distribution to create a secure connection between the Lambda function and the DB instance.
- D Configure the Lambda function to connect to the private subnets in the VPC. Add security group rules to allow traffic to the DB instance from the Lambda function.
Xem giải thích
🧩 Phân tích chi tiết câu hỏi
Câu hỏi xoay quanh việc phát triển ứng dụng serverless sử dụng AWS Lambda để truy cập Amazon RDS (cơ sở dữ liệu quan hệ) nằm trong private subnet của một VPC (Virtual Private Cloud).
✅ Tình huống cụ thể:
- Lambda function cần kết nối với RDS DB instance ở private subnet (không có kết nối internet công khai).
- Công ty đã tạo IAM role với các quyền cần thiết (như permissions để truy cập DB).
- Tuy nhiên, chỉ IAM role thôi chưa đủ vì RDS ở private subnet, Lambda mặc định chạy ngoài VPC (không có mạng nội bộ). Developer phải thực hiện hành động bổ sung để Lambda có thể giao tiếp với RDS qua mạng VPC an toàn.
🛠️ Vấn đề cốt lõi: Lambda cần được tích hợp vào VPC (VPC configuration) để truy cập tài nguyên private, kết hợp với security groups để kiểm soát traffic inbound/outbound. Đây là best practice cho serverless architecture với RDS private (theo AWS Well-Architected Framework - Serverless Lens, cập nhật 2024-2026).
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Configure the Lambda function to connect to the private subnets in the VPC. Add security group rules to allow traffic to the DB instance from the Lambda function.
Lý do chi tiết:
- 🧩 Lambda phải được configure VPC để chạy trong private subnets của VPC (chọn subnets cùng AZ với RDS để tránh cold start cao).
- 📈 Sau đó, thêm security group rules: Security group của Lambda (source) cho phép outbound traffic đến port DB (ví dụ: 3306 cho MySQL), và security group của RDS cho phép inbound từ security group của Lambda (self-referencing rules an toàn hơn IP).
- 🚀 Điều này đảm bảo kết nối private, không public exposure, phù hợp serverless scale. Kiến thức cập nhật 2026: Lambda VPC hỗ trợ ENI (Elastic Network Interface) tự động, không cần NAT Gateway cho outbound (nhưng RDS private chỉ cần SG rules).
🔍 Phân tích tất cả các phương án (đúng/sai)
-
Phương án 1: Assign a public IP address to the DB instance. Modify the security group of the DB instance to allow inbound traffic from the IP address of the Lambda function.
❌ Sai vì:- Gán public IP cho RDS private subnet vi phạm nguyên tắc least privilege và security best practices (RDS public dễ bị tấn công từ internet).
- Lambda không có fixed IP (chạy scale động với nhiều ENI), không thể dùng IP cụ thể trong SG rules. Public IP cũng yêu cầu internet gateway, tăng chi phí và rủi ro.
-
Phương án 2: Set up an AWS Direct Connect connection between the Lambda function and the DB instance.
❌ Sai vì:- AWS Direct Connect dành cho kết nối private cao tốc từ on-premises/datacenter đến AWS (dedicated fiber), không áp dụng cho Lambda-RDS trong cùng region/VPC (quá phức tạp, chi phí cao ~$0.02/GB).
- Lambda đã hỗ trợ VPC native, không cần Direct Connect (overkill cho internal traffic).
-
Phương án 3: Configure an Amazon CloudFront distribution to create a secure connection between the Lambda function and the DB instance.
❌ Sai vì:- CloudFront là CDN (Content Delivery Network) cho static/dynamic web content qua HTTPS edge locations, không hỗ trợ database protocols (như SQL). Không thể dùng để proxy RDS traffic.
- RDS private không expose public endpoint cho CloudFront.
-
Phương án 4 (Đúng - như đã giải thích ở trên): Configure the Lambda function to connect to the private subnets in the VPC. Add security group rules to allow traffic to the DB instance from the Lambda function.
✅ Đúng vì: Đây là cách chuẩn AWS cho Lambda truy cập VPC resources private, đảm bảo scalability, security (zero-trust model qua SG).
📘 Tài liệu tham khảo (cập nhật mới nhất 2026)
- AWS Lambda VPC Configuration: docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html 🛤️ (Chi tiết ENI, subnets).
- Amazon RDS VPC & Security Groups: docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.SecurityGroups.html 🔒.
- AWS Well-Architected Framework - Serverless: aws.amazon.com/architecture/well-architected/frameworks/serverless/ (Reliability & Security pillars).
- Sample code: AWS re:Post & GitHub samples cho Lambda-RDS VPC (2024+).
Hy vọng phân tích này giúp bạn ôn thi DOP-C02 hiệu quả! 💪 Nếu cần demo CloudFormation, hỏi thêm nhé!
What is the MOST secure way to achieve this?
- A Use the Amazon Cognito user pools to get short-lived credentials for the second account.
- B Create a dedicated IAM access key for the second account, and send it by mail.
- C Create a cross-account access role, and use sts:AssumeRole API to get short-lived credentials.
- D Establish trust, and add an SSH key for the second account to the IAM user.
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 cung cấp quyền truy cập tạm thời cho một lập trình viên (developer) vào các tài nguyên trong tài khoản AWS thứ hai (second account), một cách an toàn nhất (MOST secure).
🔍 Chi tiết câu hỏi:
- Đây là tình huống phổ biến trong môi trường multi-account AWS, nơi developer từ Account A cần truy cập tài nguyên ở Account B mà không chia sẻ thông tin xác thực dài hạn (như access key vĩnh viễn).
- Yêu cầu nhấn mạnh bảo mật cao nhất: Tránh rủi ro lộ thông tin xác thực, ưu tiên temporary credentials (chứng chỉ ngắn hạn) để giảm thiểu bề mặt tấn công.
- Theo best practices AWS (cập nhật đến 2026), AWS khuyến nghị sử dụng IAM Roles cho cross-account access thay vì chia sẻ key, vì roles hỗ trợ least privilege và tự động hết hạn.
📘 Tài liệu tham khảo:
- AWS IAM User Guide: Cross-account access - docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_aws-accounts.html
- AWS STS AssumeRole API - docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Create a cross-account access role, and use sts:AssumeRole API to get short-lived credentials.
Lý do 🛠️:
- Đây là phương pháp an toàn nhất theo AWS Well-Architected Framework (Security Pillar, cập nhật 2026), sử dụng IAM Role ở Account B với trust policy cho phép Account A assume role.
- Developer từ Account A gọi STS AssumeRole API để lấy temporary credentials (session token, access key, secret key) chỉ tồn tại 15 phút - 12 giờ, tự động hết hạn, hỗ trợ zero long-lived credentials.
- Hỗ trợ least privilege qua IAM policies gắn vào role, audit dễ dàng qua CloudTrail.
- Không cần chia sẻ key, giảm rủi ro phishing/man-in-the-middle.
📋 Phân tích tất cả các phương án
Dưới đây là phân tích chi tiết từng lựa chọn, với 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 cụ thể dựa trên best practices AWS.
-
❌ Use the Amazon Cognito user pools to get short-lived credentials for the second account.
Giải thích sai: Cognito User Pools dành cho xác thực người dùng cuối (end-user authentication) qua identity providers (như Google, Facebook), không phải cho cross-account IAM access giữa các AWS accounts. Nó không cấp IAM temporary credentials cho developer truy cập tài nguyên AWS như S3/EC2 ở account khác. Sử dụng sai mục đích, không secure cho developer workflows. -
❌ Create a dedicated IAM access key for the second account, and send it by mail.
Giải thích sai: IAM access keys là long-lived credentials (không hết hạn trừ khi rotate thủ công), vi phạm nguyên tắc least privilege và temporary access. Gửi qua mail cực kỳ rủi ro (email có thể bị hack/phishing), AWS cấm chia sẻ keys theo Security Best Practices. Thay vào đó, luôn dùng roles cho temporary access. -
✅ Create a cross-account access role, and use sts:AssumeRole API to get short-lived credentials.
Giải thích đúng (như phần trên): Phương pháp chuẩn AWS, secure nhất với temporary credentials qua STS, hỗ trợ MFA/conditions trong trust policy. Được khuyến nghị trong AWS Organizations và Control Tower (2026 updates). -
❌ Establish trust, and add an SSH key for the second account to the IAM user.
Giải thích sai: SSH keys dùng cho EC2 Instance Connect hoặc SSM Session Manager, không phải cross-account resource access tổng quát (như S3/DynamoDB). "Establish trust" mơ hồ, nhưng thêm SSH key vào IAM user không cấp IAM permissions cross-account, chỉ dùng cho SSH vào EC2. Không secure cho developer cần access rộng, dễ bị lạm dụng.
🛡️ Kết luận: Luôn ưu tiên IAM Roles + AssumeRole cho cross-account để đạt zero trust credentials! Nếu triển khai, test qua AWS CLI: aws sts assume-role --role-arn arn:aws:iam::ACCOUNT-B-ID:role/CrossAccountRole --role-session-name temp-session.
Which approach should the company take to allow the application to interact with Amazon S3?
- A Create an IAM role that has administrative access to AWS. Attach the role to the EC2 instance.
- B Create an IAM user. Attach the AdministratorAccess policy. Copy the generated access key and secret key. Within the application code, use the access key and secret key along with the AWS SDK to communicate with Amazon S3.
- C Create an IAM role that has the necessary access to Amazon S3. Attach the role to the EC2 instance.
- D Create an IAM user. Attach a policy that provides the necessary access to Amazon S3. Copy the generated access key and secret key. Within the application code, use the access key and secret key along with the AWS SDK to communicate with Amazon S3.
Xem giải thích
🧩 Phân tích chi tiết nội dung câu hỏi
Câu hỏi tập trung vào quy trình migrate ứng dụng từ on-premises sang AWS, cụ thể là bước đầu tiên với một ứng dụng non-critical chạy trên một instance Amazon EC2 duy nhất. Ứng dụng này cần lưu trữ thông tin vào Amazon S3 bucket, và công ty phải tuân thủ security best practices của AWS khi triển khai.
🔑 Mục tiêu chính: Cho phép ứng dụng trên EC2 tương tác an toàn với S3 mà không vi phạm nguyên tắc bảo mật. AWS khuyến nghị sử dụng IAM roles thay vì hardcode credentials để tránh rủi ro lộ thông tin xác thực (access keys), tuân thủ nguyên tắc least privilege (quyền hạn tối thiểu) và temporary credentials (xác thực tạm thời). Đây là best practice cập nhật đến năm 2026, theo AWS Well-Architected Framework (Security Pillar).
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Create an IAM role that has the necessary access to Amazon S3. Attach the role to the EC2 instance.
Lý do 🛡️:
- Phương án này tuân thủ security best practices bằng cách sử dụng IAM role gắn trực tiếp vào EC2 instance. Instance metadata service (IMDS) sẽ cung cấp temporary credentials tự động cho ứng dụng qua AWS SDK, không cần hardcode access key/secret key trong code.
- Áp dụng least privilege: Chỉ cấp quyền cần thiết cho S3 (ví dụ:
s3:PutObject,s3:GetObject), giảm rủi ro nếu instance bị compromise. - Dễ quản lý, tự động rotate credentials, phù hợp với ứng dụng non-critical migrate đầu tiên. Đây là khuyến nghị chính thức từ AWS đến 2026.
📋 Phân tích tất cả các phương án (đúng/sai)
-
Phương án 1: Create an IAM role that has administrative access to AWS. Attach the role to the EC2 instance.
❌ Sai vì vi phạm least privilege principle. IAM role với quyền administrative access (full quyền AWS) quá rộng, có thể dẫn đến privilege escalation nếu instance bị tấn công. Best practice yêu cầu chỉ cấp quyền tối thiểu cho S3, không phải admin toàn cục. -
Phương án 2: Create an IAM user. Attach the AdministratorAccess policy. Copy the generated access key and secret key. Within the application code, use the access key and secret key along with the AWS SDK to communicate with Amazon S3.
❌ Sai kép: (1) Sử dụng IAM user với access key/secret key hardcode vào code là anti-pattern, dễ lộ thông tin (code leak qua repo, logs). (2) Quyền AdministratorAccess quá mức cần thiết. AWS cấm hardcode credentials từ lâu (cập nhật 2026 nhấn mạnh IMDSv2 cho EC2). -
Phương án 3: Create an IAM role that has the necessary access to Amazon S3. Attach the role to the EC2 instance.
✅ Đúng như đã giải thích ở trên. Đây là best practice tiêu chuẩn cho EC2 apps truy cập AWS services, sử dụng instance profile để inject credentials an toàn. -
Phương án 4: Create an IAM user. Attach a policy that provides the necessary access to Amazon S3. Copy the generated access key and secret key. Within the application code, use the access key and secret key along with the AWS SDK to communicate with Amazon S3.
❌ Sai vì vẫn hardcode access key/secret key từ IAM user vào code, dẫn đến rủi ro bảo mật cao (không rotate tự động, dễ bị steal). Dù policy chỉ cần thiết cho S3 (least privilege OK), nhưng phương thức IAM user không phù hợp cho EC2 – ưu tiên IAM role.
📘 Tài liệu tham khảo (cập nhật mới nhất AWS 2026)
- AWS IAM Best Practices: docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html – Nhấn mạnh roles > users, least privilege.
- IAM Roles for Amazon EC2: docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html – Hướng dẫn attach role cho EC2.
- AWS Well-Architected Framework (Security Pillar): aws.amazon.com/architecture/well-architected – Best practices migrate với security.
- S3 Access from EC2: AWS re:Post và SDK docs khuyến nghị instance roles.
🛠️ Lời khuyên DevOps: Trong thực tế, sử dụng AWS SDK v3+ với IMDSv2 (hop limit=2) để tăng bảo mật EC2. Test với aws sts get-caller-identity trên instance!