Question

Difficulty: EasyIAM Policies and Roles

A developer is configuring the following trust policy for an IAM role to be used by an AWS Lambda function:

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}

Which of the following describes the purpose of this trust policy?

  1. A
    It defines the permissions the Lambda function has to perform actions on other AWS resources.
  2. B
    It configures the Lambda function to authenticate using hardcoded access keys in the SDK code.
  3. It allows the AWS Lambda service to assume the IAM role and obtain temporary security credentials.Answer
  4. D
    It grants the Lambda function permission to access S3 buckets and DynamoDB tables directly.

Answer

The correct answer states that the policy allows the AWS Lambda service to assume the IAM role and obtain temporary security credentials.
The trust policy (or trust relationship) of an IAM role defines the trusted entities (principals) that can assume the role. Specifying the service principal 'lambda.amazonaws.com' and the action 'sts:AssumeRole' allows the Lambda service to assume the role and request temporary security credentials on behalf of the function execution context.

Step-by-Step Solution

1
Analyze the JSON structure of the policy.
The document contains a 'Principal' element specifying 'lambda.amazonaws.com' and an 'Action' of 'sts:AssumeRole'.
This shows the policy is a trust policy designed to establish a trust relationship with a specific AWS service.
2
Determine the effect of the 'sts:AssumeRole' action on the service principal.
The trust policy grants the AWS Lambda service authorization to assume the IAM role.
When assumed, the role provides temporary, short-lived security credentials for the Lambda execution context.

Key Concept

IAM Role Trust Policies vs. Permissions Policies
Estimated Time:45s
Rate this question