A developer is configuring a serverless application where an AWS Lambda function in Account A () needs to ingest records from an Amazon Kinesis data stream located in Account B (). The Lambda function runs under the execution role `arn:aws:iam::111111111111:role/LambdaExecutionRole`.
To accomplish this, the developer creates a role named `CrossAccountStreamReader` in Account B with the following permission policy attached:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"kinesis:DescribeStream",
"kinesis:GetShardIterator",
"kinesis:GetRecords"
],
"Resource": "arn:aws:kinesis:us-east-1:222222222222:stream/DataIngestStream"
}
]
}
The Lambda function code is written to assume this role using the AWS Security Token Service (STS) before calling Kinesis APIs. However, when executing the function, the developer receives an `AccessDenied` error during the STS `AssumeRole` API call.
Which TWO configurations are required to resolve this error? (Select TWO.)
- Attach an IAM policy to `LambdaExecutionRole` in Account A that allows the `sts:AssumeRole` action on `arn:aws:iam::222222222222:role/CrossAccountStreamReader`.Answer
- Configure the trust policy of the `CrossAccountStreamReader` role in Account B to allow the `sts:AssumeRole` action with the Principal set to `arn:aws:iam::111111111111:role/LambdaExecutionRole`.Answer
- CConfigure the trust policy of `LambdaExecutionRole` in Account A to allow the `sts:AssumeRole` action with the Principal set to `arn:aws:iam::222222222222:role/CrossAccountStreamReader`.
- DAttach a resource-based policy to the Kinesis data stream in Account B that grants the `kinesis:GetRecords` action to the principal `arn:aws:iam::111111111111:role/LambdaExecutionRole`.
- EAttach an IAM policy to `LambdaExecutionRole` in Account A that grants `kinesis:GetRecords` permissions on the resource `arn:aws:kinesis:us-east-1:222222222222:stream/DataIngestStream`.