Connecting API to Lambda using Serverless

·

2 min read

In this blog i will be using the serverless - a open source tool to create a infrastructure for aws . and connect 2 api with api gateway

What is serverless framework ?

The Serverless Framework is a free and open-source web framework developed using Node.js. It was created for building applications on AWS Lambda, which is a serverless computing platform provided by Amazon Web Services (AWS). The framework simplifies the deployment and management of serverless applications, allowing developers to focus on writing code without worrying about infrastructure.

Key points about the Serverless Framework:

  • First Developed for AWS Lambda: Serverless Framework was originally designed for AWS Lambda, but it has since expanded to support other cloud providers as well.

  • Open Source: It is an open-source project, meaning it is freely available for anyone to use and contribute to.

  • Simplifies Deployment: The framework streamlines the deployment process by providing a clear structure and configuration for serverless applications.

  • Wide Adoption: It has gained popularity in the serverless computing community for its ease of use and support for various programming languages.

Developers can define their application's resources and functions in a configuration file, and the Serverless Framework takes care of provisioning the necessary resources and deploying the code. This approach enables developers to build scalable and cost-effective serverless applications with ease.

Setup :

sudo npm install -g serverless

Prerequisite:

You need to have node js downloaded on your beforehand. If you want to install you can check out my previous blog

https://hashnode.com/post/clmp2uodf000209l2ca7218hz

Step 2

serverless
cd your-service-name

Output

The serverless command will guide you to:

  1. Create a new project

  2. Configure your AWS credentials

     sudo apt install awscli
     sudo aws configure
    

    In this you need to give access ID and and and password . these can easily be obtained using IAM in aws service