title: Access Lambda Environment variables in IAM Policy?
body: <p><strong>Is it possible to use Lambda function environment variables in IAM policy conditions.???.</strong></p>
  <p>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.</p>
  <p>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.</p>
  <p>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.</p>
  <p>Therefore, I create a global enviroment variable called &quot;usr_id&quot; but I could not see any way to use this varible in IAM policy condition.</p>
  <p>Is there any way to access <strong>lambda enviroment variable</strong> or any value (which we can assign usr_id) in  <strong>IAM policy</strong> ???</p>
  <p><a href="https://i.stack.imgur.com/H370R.png" rel="nofollow noreferrer">a general structure of a reques in my system</a></p>
  <p>Thanks</p>