title: How do 2 api in api gateway share same lambda function but different environment variable
body: <p>I currently have an api called “cms-api”, which contains a dynamodb scan function in it.<br></p>
  <p>getOrganization.js<br></p>
  <pre><code>'use strict'
  const AWS = require('aws-sdk');
  
  exports.handler = async function (event, context, callback) {
      const documentClient = new AWS.DynamoDB.DocumentClient();
  
      let responseBody = &quot;&quot;;
  
      const params = {
          TableName : &quot;Organization&quot;
      };
  
      try{
          const data = await documentClient.scan(params).promise();
      }catch(err){
          responseBody = `Unable to get Organization: ${err}`;
      }
  }
  
  </code></pre>
  <p>“Organization” Table has below attributes<br></p>
  <pre><code>------------------------------------------
  Id    isActive    name
  1    true              tim
  2    false            tom
  3    true             ken
  4    true            joe
  ------------------------------------------
  </code></pre>
  <p>Later, I create another api in api gateway called web-api,<br>
  I want to use the same lambda function getOrganization.js in my resource.<br>
  But the getOrganization.js should only return the data with isActive = true.<br></p>
  <p>Is it possible? Or should I create a new lambda function every time?<br></p>
  <p>Attached my consideration before.<br>
  <a href="https://stackoverflow.com/questions/65128462/should-i-create-public-api-based-on-the-current-internal-api/65129189#65129189">should I create Public api based on the current internal api</a></p>