
AWS Certified Developer - Associate
Get started today
Ultimate access to all questions.
How should a Lambda function be granted secure access to an S3 bucket for reading and a DynamoDB table for reading and writing, given an existing IAM policy?
How should a Lambda function be granted secure access to an S3 bucket for reading and a DynamoDB table for reading and writing, given an existing IAM policy?
Explanation:
The correct answer is B. The most secure method for granting the Lambda function the necessary permissions is to create an IAM role and attach the existing IAM policy to this role, then assign the role to the Lambda function. This method allows for fine-grained access control and adheres to best practices by using roles instead of storing sensitive credentials. Attaching the IAM policy directly to the Lambda function (option A) is less flexible and not the best practice. Creating an IAM user and embedding credentials (option C) is insecure and not recommended. Using the root account keys (option D) is a severe security risk and is strongly discouraged.