A developer is implementing an AWS Lambda function in AWS Account (Account A) that must write messages to an Amazon SQS queue in AWS Account (Account B). The security team requires using temporary security credentials via IAM role assumption for cross-account access. The Lambda function is configured with an execution role named `LambdaExecutionRole` in Account A.
The developer attempts to set up an IAM role in Account B named `QueueWriterRole` with the following trust policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
Which of the following actions are required to successfully and securely establish this cross-account access? (Select TWO.)
- Modify the trust policy of `QueueWriterRole` in Account B to replace `lambda.amazonaws.com` with `"AWS": "arn:aws:iam::111111111111:role/LambdaExecutionRole"` in the `Principal` element.Cevap
- Attach an identity-based policy to `LambdaExecutionRole` in Account A that allows the `sts:AssumeRole` action on the Amazon Resource Name (ARN) of `QueueWriterRole` in Account B.Cevap
- CModify the trust policy of `QueueWriterRole` in Account B to replace the `Action` value of `"sts:AssumeRole"` with `"sqs:SendMessage"`.
- DAttach a resource policy to the Amazon SQS queue in Account B that allows the service principal `lambda.amazonaws.com` to perform the `sts:AssumeRole` action.
- EStore the long-term Access Key ID and Secret Access Key of an IAM user from Account B in the Lambda environment variables, and use them to initialize the Amazon SQS client in the function code.