title: aws appsync environment variable for api key in lambda function
body: <p>I have react web app that uses aws amplify to build its backend. This backend consists of a graphql api with a dynamodb table as data source (created by the model declared in my graphql schema) and a lambda function that fetches information from a 3rd party api and saves the results into the dynamodb table to make it available for the app.</p>
  
  <p>Following this tutorial: </p>
  
  <p><a href="https://docs.amplify.aws/cli/function#graphql-from-lambda" rel="noreferrer">https://docs.amplify.aws/cli/function#graphql-from-lambda</a> </p>
  
  <p>I created the lambda function running the "amplify add function" command. I answered "yes" when I was asked if the lambda should have access to other amplify resources and I gave the lambda write and update access to my graphql api, so that I can perform mutations from the lambda.</p>
  
  <p>When I finish the creation process, amplify informs me that I have two new environment variables available in the lambda:</p>
  
  <pre><code>API_&lt;MY_APP&gt;_GRAPHQLAPIENDPOINTOUTPUT
  API_&lt;MY_APP&gt;_GRAPHQLAPIIDOUTPUT
  </code></pre>
  
  <p>The problem is, however, that I also need the api key in order to be able to perform the mutations (my graphql api has "api key" as primary id method).</p>
  
  <p>The tutorial makes use of process.env.API_KEY. However they don't explain where this variable comes from, as in my case its value is undefined.</p>
  
  <p>Do you know how to make the api key available to my lambda?</p>
  
  <p>P.S.: Hardcoding is not an option, as I have several backend environments.</p>