A developer is configuring a Lambda function named `DataProcessor` in AWS Account A () to write records to an Amazon DynamoDB table in AWS Account B (). The Lambda function's execution role is named `LambdaExecutionRole`.
To facilitate cross-account access, the developer creates an IAM role named `CrossAccountDynamoDbRole` in Account B with a permission policy that allows writing to the DynamoDB table. The trust policy for `CrossAccountDynamoDbRole` in Account B is configured as follows:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111122223333:role/LambdaExecutionRole"
},
"Action": "sts:AssumeRole"
}
]
}
Which TWO additional actions must the developer take to enable the Lambda function to write to the DynamoDB table? (Select TWO.)
- Attach a permission policy to the Lambda execution role in Account A that allows the sts:AssumeRole action on the ARN of the IAM role in Account B.Answer
- Modify the Lambda function code to call the sts:AssumeRole API operation to retrieve temporary credentials, and use those credentials to instantiate the DynamoDB client.Answer
- CAttach an identity-based policy to the Lambda execution role in Account A that allows dynamodb:PutItem on the ARN of the DynamoDB table in Account B.
- DUpdate the trust policy of the IAM role in Account B to include a statement that allows the dynamodb:PutItem action on the DynamoDB table.
- EConfigure the Lambda function environment variables to store the access key ID and secret access key of an IAM user in Account B who has access to the DynamoDB table.