Is it possible to use Lambda function environment variables in IAM policy conditions.???.
Basically, In my app each user has a to-do-list which can update. In database (dynamoDB), I have a table (todo table). So each user can update the record related it own id.
In my system, basically a client user (cognito user) sends an API request to API gateway. And the API endpoint trigger lambda function and lambda function write data on database table.
So Thing I want to do is putting a control in lambda function execution role policy, this control will check whether the user id of user who trigger function match the user id in requested record.
Therefore, I create a global enviroment variable called "usr_id" but I could not see any way to use this varible in IAM policy condition.
Is there any way to access lambda enviroment variable or any value (which we can assign usr_id) in IAM policy ???
a general structure of a reques in my system
Thanks