logo-StatusNeo
d

WE ARE EXPERTS IN TECHNOLOGY

Let’s Work Together

Image Alt

StatusNeo

All You Need To Know To Get Started With Serverless

The Traditional server-based computing typically follows three-tier architecture.

Serverless changes these paradigms all together, all the steps that are discussed above apart from writing application code are no longer needed with serverless. Without thinking about any servers, they focus on application logic, there are no servers to maintain, no operating systems to take care of, no software to manage, no hardware to upgrade, and application have built-in high availability and fault tolerance which means faster time to market.

Serverless may be a buzzword, but it’s not an empty one. AWS  Lambda which is function as a service is core component of amazon serverless platform one pay only for the time his code runs there is no charge if code is not running if code runs for 100 milliseconds they are charged only for that 100 milliseconds and not more, that’s a very fined grained control and results in substantial cost savings for one’s business.

Here are the steps to create a Lambda function:

  1. Go to AWS management console –> services menu –>  Lambda. Then, click Create function.

2. Click on Author from scratch, configure the following:

  • Function name: FAQ
  • Runtime: Node.js 12.x
  • Choose or create an execution role
  • Execution role:  Use an existing role
  • Existing role:  lambda-testing
  • Then click on Create function.

3. Open the function code section and scroll it down and delete all the code that present in the code editor section.

4. Write your code into index.js tab.

5. Select Basic settings, for description, enter: Provide a random FAQ. (Here, AWS lambda functions can be triggered automatically by activities such as data updating in AWS DynamoDB database).

6. Go to Designer section to create API gateway endpoint. Click to +Add trigger and configure:

  •  Select a trigger: API Gateway
  • API: Create a new API
  • Choose a template: Rest API
  • Security: Open
  • Expand à Additional settings
  • API name: FAQ-API
  • Deployment stage: myDeploy

7. Click Add and then click save at the top right corner.

8. Click the right arrow to view the details of API under API gateway. Copy the API endpoint to the clipboard. Open a new browser and paste the API endpoint there. In isolation also we can test the Lambda function. Now, return back to the Lambda management console.

9.  Click Test and configure:

  •  Event name: Basic_Test
  • To represent an empty JSON object, delete the default keys and values, and retain this {} (empty brackets). Click Create à Test

10. In the Execution result: succeeded window, expand details. Click Monitoring tab à view logs in CloudWatch. Click on any one log streams, the same event data of Lambda Console will be displayed there.

Comments

  • Ayushi Gusain

    May 24, 2020

    Well Megha this article was really helpful, being serverless is the need for future. I was myself trying to figure out the creation of lamda function and this really helped me.

    reply
  • Mridul Markandey

    May 24, 2020

    Well -written, and very well explained Found this very informative.

    reply
  • Rohit Rawat

    May 24, 2020

    Great!!!

    reply
  • Rishabh Negi

    May 24, 2020

    Got my first lambda up and running. Thank you!

    reply

Add Comment