LocalStack doesnt validate DynamoDb action
I changed my lambda logic to pull data from dynamo using QueryCommand to BatchGetCommand.
Forgot to change my CDK code to change permission from 'dynamodb:Query' to 'dynamodb:BatchGetItem', perhaps my tests which is running based on localstack should have been failed. But its not.
I got permission error in AWS only.
My expectation was this would have been caught in localstack.
Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our Slack Community for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our contributing guidelines and our contributing guide.
Hi @vijaimp, thanks for your report.
Could you please provide us a minimal sample of AWS CLI commands that work on LocalStack but fail on AWS? This will help us implement the missing functionality in LocalStack.
its not about CLI command. Its about CDK infra code (infra as code) which can be deployed in localstack and AWS.
I was using QueryCommand in my lambda to query dynamo table , which was working fine with below below infra code (CDK)
readonly myDynamoTable: Table; myDynamoTable.grant(myLambda, 'dynamodb:Query');
I changed the implementation in my lambda to use BatchGetCommand instead QueryCommand to fetch more rows in batch to improve the performance. Forgot to change the lambda permission as below in infra code.
readonly myDynamoTable: Table; myDynamoTable.grant(myLambda, 'dynamodb:BatchGetItem');
Expectation: LocalStack should have been thrown error, saying lambda doesnt have permission to use BatchGetItem.
Actual: LocalStack doesnt throw any error where it get caught in AWS.
Error in AWS myLambda is not authorized to perform: dynamodb:BatchGetItem on resource: myDynamoTable because no identity-based policy allows the dynamodb:BatchGetItem action
Hello 👋! It looks like this issue hasn’t been active in longer than five months. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.
i will check and update
Hello 👋! It looks like this issue hasn’t been active in longer than five months. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.