AWS Certified Security – Specialty — Question 444

A security team is developing an automated solution that uses an AWS Lambda function to provision an Amazon EC2 instance. The solution will provision the EC2 instance with an IAM role that has the permissions necessary to make API calls to other AWS services in the same AWS account. The security team can create the AMI for this EC2 instance. The team encrypts the AMI by using an AWS Key Management Service (AWS KMS) customer managed key.

When the team invokes the Lambda function to launch the EC2 instance, the team receives an access denied error message from the Lambda function’s execution role. The team analyzes the Lambda function execution role for missing permissions.

What is the MOST likely cause of this error message?

Answer options

Correct answer: B

Explanation

To launch an Amazon EC2 instance with an associated IAM role, the calling entity (the Lambda function's execution role) must have the iam:PassRole permission. This allows the Lambda function to safely pass the IAM role to the EC2 instance during provisioning. Without iam:PassRole, AWS will return an access denied error during the launch API call.