A developer is attempting to deploy an AWS Lambda function that reads data from an Amazon DynamoDB table. The developer has created an IAM role named `DynamoDbReaderRole` with a permissions policy that grants `dynamodb:GetItem` and `dynamodb:Query` access. However, when the developer tries to deploy the Lambda function and associate it with `DynamoDbReaderRole` using the AWS CLI, the deployment fails with an error indicating that Lambda is not authorized to assume the role, and that the developer is not authorized to perform `iam:PassRole` on the resource.
Which TWO actions must the developer take to successfully deploy the Lambda function? (Select TWO.)
- Modify the trust policy of `DynamoDbReaderRole` to allow the `lambda.amazonaws.com` service principal to perform the `sts:AssumeRole` action.Cevap
- Attach an IAM policy to the developer's IAM user or role that allows the `iam:PassRole` action on `DynamoDbReaderRole`.Cevap
- CAttach an IAM policy to the developer's IAM user or role that allows the `sts:AssumeRole` action on `DynamoDbReaderRole`.
- DModify the trust policy of `DynamoDbReaderRole` to allow the developer's IAM user ARN to perform the `sts:AssumeRole` action.
- EEmbed the AWS access keys of an IAM user with full DynamoDB permissions directly into the Lambda function's environment variables and remove the role association.
Cevap
To successfully deploy the Lambda function, the developer must modify the trust policy of the role to allow the Lambda service principal to assume it, and attach an IAM policy to their own user or role that grants permission to pass the role.
The correct configuration requires two actions. First, the trust policy of the execution role must trust the `lambda.amazonaws.com` service principal so that AWS Lambda can assume the role when running the function. Second, the developer's IAM identity must have permission to perform `iam:PassRole` on the execution role, which authorizes the developer to associate this specific role with the Lambda service during deployment.
Adım Adım Çözüm
Anahtar Kavram
The combination of the service trust policy (which defines who can assume the role) and the `iam:PassRole` permission (which authorizes a user to pass the role to a service) is required for successful service role association.
Tahmini Süre:1m 30s