AWS Lambda and API Gateway

, ,

The following instructions are given that you have a lambda function created that works. AWS has API Gateway which enables developers to create RESTful API endpoints so people can call it and in turn run a lambda function. If you have never set up an API in API Gateway, you must:

  1. Log into the AWS console
  2. Search for “API Gateway” in the services tab
  3. Press “Create API”
  4. Choose REST / New API / assign a name to your api
  5. Once Created, add a resource to you api
  6. Create a method
  7. Add the created lambda function to the api resource

Once you have followed these steps the API Gateway will give you a url where you can call from your code and it will run your lambda function. One last thing you must do is to deploy the API. To do this, go to the resources tab of the API and click the Actions button and then click “Deploy”. Note that you may need to set up CORS if you want to secure your API.