I tried Integrating AWS RestAPI with AWS Lambda

I tried Integrating AWS RestAPI with AWS Lambda

Clock Icon2023.01.31

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

Introduction

Hemanth of Alliance Department here. In this blog, i tried integrating AWS RestAPI with AWS Lambda.

AWS Lambda

A serverless compute service that runs code as a reply to events and automatically takes care of the bottom resources. It runs code on high availability compute infrastructure and performs all the administration of the compute resources. A few examples are HTTP requests vis Amazon API Gateway, changes to objects in S3, and many others.

API Gateway

A fully managed service that makes developers easily create, publish, maintain, monitor, and secure APIs at any scale. Using API Gateway can create Restful APIs and WebSocket APIs which have real-time two-way communication applications. It is a front door for applications to access data, business logic, or functionality from your backend services.

RestAPI

It is a web service AIMAGEarchitecture that enI hopes activities on resources, including data retrieval or modification, by using HTTP verbs (GET, POST, PUT, DELETE, etc.). When interacting with AWS services, REST APIs can be used to carry out a number of tasks like building, reading, updating, or removing resources.

Demo

Go to AWS Concole, search for Lambda and click create function Give the function a name while maintaining the current default settings. Type the randomn message code here click on deploy and next click test, give it a name Next click Save Click test again and you'll get a response Since Lambda is created let's move on creating RestAPI
First go to API Gateway and click build on RestAPI Next click on create newAPI, Type down a name and click Create API Now in actions click on create resource Give a resource name and click on create resource Now creating a method and selecting GET from it Type down the lambda function name and click save Click on GET and move inside integration response Adding a mapping template of application/JSON Going back and clicking on test Go to actions and click deploy open the link in new tab and add /"your rescourcename" in the link

Conclusion

Hope with this you get an idea of how to integrate AWS RestAPI and AWS Lambda. Thank you for seeing the blog till the end.

Share this article

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.