Episode 3: Rest API with API Gateway that invokes Lambda
In this episode we will continue on Episode 1 , where we created the ReadLambda function and DynamoDB table Messages
.
Prerequisites
- Lambda Function
Click on the Create API
:
Select Build
under REST API:
Enter any name, and select Create API
Under Actions
select Create Method
Under drop down, select Get
as we will be getting all the data from DynamoDB via Lambda
Once selected Get
you should see something similar to below:
In the Lambda Function
select the function that you would the API Gateway(AG) to triggering:
Before AG can trigger, it needs permission to invoke Lambda:
Once all configured, the below is the view you will see:
Select test
from the above view, and once the below view is prompted, you can select test
again:
If all successful, we should see a successful response (HttpStatus 200)
This was a straightforward tutorial on linking the API Gateway and Lambda Function. In the subsequent episodes we will explore more parameters of the API Gateway and dive deeper.
For now, congrats on creating your very first API Gateway!
Cleanup
Remember to clean up, i.e. deleting the API Gateway and other resources: