AWS Certified Developer – Associate — Question 74

A developer has code that is stored in an Amazon S3 bucket. The code must be deployed as an AWS Lambda function across multiple accounts in the same AWS Region as the S3 bucket. An AWS CloudFormation template that runs for each account will deploy the Lambda function.
What is the MOST secure way to allow CloudFormation to access the Lambda code in the S3 bucket?

Answer options

Correct answer: A

Explanation

The correct answer is A because it provides the necessary permissions for the CloudFormation service role while also specifying a restricted bucket policy that limits access to designated accounts. Option B is less secure as it allows access to anyone with the '*' principal, which could lead to unauthorized access. Options C and D do not grant the CloudFormation service role the required permissions directly, making them unsuitable.