AWS Certified Solutions Architect – Associate (SAA-C03) — Question 305

A company has an AWS Lambda function that needs read access to an Amazon S3 bucket that is located in the same AWS account.

Which solution will meet these requirements in the MOST secure manner?

Answer options

Correct answer: B

Explanation

Assigning an IAM execution role directly to the AWS Lambda function with a policy restricted to the specific Amazon S3 bucket follows the security principle of least privilege. Hardcoding AWS credentials in the code (Option C) is highly insecure, while granting access to all buckets (Option D) is overly permissive. Using a bucket policy alone (Option A) without an execution role does not properly grant the Lambda function identity-based permissions to perform the action.