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?
- AIt defines the permissions the Lambda function has to perform actions on other AWS resources.
- BIt configures the Lambda function to authenticate using hardcoded access keys in the SDK code.
- It allows the AWS Lambda service to assume the IAM role and obtain temporary security credentials.Answer
- DIt 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
Key Concept
IAM Role Trust Policies vs. Permissions Policies
Estimated Time:45s