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:
- Log into the AWS console
- Search for “API Gateway” in the services tab
- Press “Create API”
- Choose REST / New API / assign a name to your api
- Once Created, add a resource to you api
- Create a method
- 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.