I have created a new IAM role, which has access (scan/Query) to specific DynamoDb tables.
I am trying to use STS Assume Role API call from my lambda function, so that the lambda function gets access to the specific Dynamo Db tables.
The Assume Role call was successful, I got the role ID, AccesskeyId, Secret Access Key and Session Token.
When I make a call from my lambda function, to access the Dynamo DB, I am getting an error
AccessDeniedException: User: arn:aws:sts::>:assumed-role/ota-dev-us-east-1-lambdaRole/ is not authorized to perform: dynamodb:Scan on resource: arn:aws:dynamodb:us-east-1:>:table/<>
My question is, even after the Role Assume call was successful in the Lambda function, why the lambda function was still using the older role to access the Dynamo DB?
I was expecting the Lambda function to assume the new role, but from the logs it looks like, it is using still the older role.
Looks like I am missing some steps in between.