Episode 3: Rest API with API Gateway that invokes Lambda

·

2 min read

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:

Screen Shot 60.png

Select Build under REST API:

Screen Shot 61.png

Enter any name, and select Create API

Screen Shot 62.png

Under Actions select Create Method

Screen Shot 63.png

Under drop down, select Get as we will be getting all the data from DynamoDB via Lambda

Screen Shot 64.png

Once selected Get you should see something similar to below:

Screen Shot 65.png

In the Lambda Function select the function that you would the API Gateway(AG) to triggering:

Screen Shot 66.png

Before AG can trigger, it needs permission to invoke Lambda:

Screen Shot 67.png

Once all configured, the below is the view you will see:

Screen Shot 68.png

Select test from the above view, and once the below view is prompted, you can select test again:

Screen Shot 69.png

If all successful, we should see a successful response (HttpStatus 200)

Screen Shot 70.png

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:

Screen Shot 71.png

Screen Shot 72.png