A developer is configuring an Amazon API Gateway REST API to send incoming event data directly to an Amazon Kinesis data stream using a service proxy integration. To authorize this integration, the developer creates an IAM role named `APIGatewayKinesisRole` with a permissions policy that allows `kinesis:PutRecord` on the target stream. However, when testing the API Gateway integration, the developer receives an error indicating that API Gateway is not authorized to assume the role. The developer inspects the trust policy of `APIGatewayKinesisRole`, which is configured as follows:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "kinesis.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
How should the developer resolve this authorization error?
- Change the Service principal in the trust policy to apigateway.amazonaws.com.Answer
- BChange the Action in the trust policy to kinesis:PutRecord and keep kinesis.amazonaws.com as the principal.
- CGenerate temporary access keys using AWS Security Token Service (STS) and hardcode them in the API Gateway integration request mapping template.
- DAttach an identity-based policy to APIGatewayKinesisRole that allows sts:AssumeRole on the API Gateway REST API resource.