torinagrippa
10/27/2017 - 6:22 PM

API key for AWS Serverless

const r2 = require("r2");

const headers = {  
    "x-api-key": "dsAfJaodifhoae76asdfkj987dfliiuehfns6" 
};

const myProfile = () => {  
  return r2.get("https://your-api/dev", {
    headers
  }).response;
};

myProfile()  
  .then(res => res.json())
  .then(json => console.log(json));
Serverless: Stack update finished...  
Service Information  
service: my-lambda-service  
stage: dev  
region: us-west-1  
stack: update-account-columns-dev  
apiKeys:  
  celery_qa: KrdJFKaodifhoae76asdfkj987dfliIdaffiD
  anotherKey_qa: dsAfJaodifhoae76asdfkj987dfliiuehfns6
endpoints:  
  POST - https://dkfj7dkfh7.execute-api.us-west-1.amazonaws.com/dev/
functions:  
  my_lambda: my-lambda-service-dev-my_lambda
provider:  
  name: aws
  runtime: python3.6 # This could be any runtime
  stage: dev
  region: us-west-1
  apiKeys:
    - celery_${opt:stage}
    - anotherKey_${opt:stage}