title: AWS Lambda NodeJS Request using Certificate, Private Key and CA
body: <p>To connect to a specific API we need to include a certificate, the private key and a CA from a NodeJS function deployed to AWS Lambda.</p>
  
  <p>In test environments we can just use the fs.readFileSync to a local path on the test server but this doesn't apply of course in AWS Lambda.</p>
  
  <p>Our call is as follows:</p>
  
  <pre><code>return request({
        method: args.method,
        uri: this.baseUrl,
        headers: {
          "User-Agent": "XXXX-Wrapper"
        },
        form: this.queryParams,
        json: false,
        cert: this.cert,
        key: this.key,
        ca: this.ca
      }, callback);
  </code></pre>
  
  <p>Is there a way to read the certificate information from either a AWS KMS or is the only way to upload these certificates to a private S3 bucket and read them from there?</p>
  
  <p>We've also tried to store the raw certificates in the Parameter Store as encrypted values and read them from there as NodeJS process variables but this didn't seem to work.</p>