Simple REST API integrating API Gateway with AWS Lambda
Step 1: Go to AWS Management Console and search for AWS Lambda, click on Create Function
Step 2: Select Author from scratch option for choosing the function. Enter the function name and select Runtime as Python 3.9. Keep other settings as default and click on Create Function.
Step 3: Once Lambda Function is created, edit the source code and edit it as following and deploy it.
Step 4: Now, go back to AWS Management console and open API Gateway. Select Build from REST API
Step 5: Choose the protocol as REST, Click on Create new API. In Settings, give API name, description and select Endpoint Type as Regional and then Click on Create API.
Step 6: Create a Resource Group named myresource from Actions. Then create on click Create method and select GET.
Step 7: Select Integration Type as Lambda Function. Make sure that you tick Use Lambda Proxy Integration, give name of Lambda Function as given before and click on Save.
Step 8: Select Actions and click on Deploy API. Select Deployment Stage and create a new one. Give Stage name and click on Deploy.
Step 9: Click on GET from myresource and select the link
Step 10 : You will get to see the following as output
Note : Please delete the resource when not in use