Create Lambda Function Using Console

What Is Lambda?

AWS Lambda is a Serverless approach which means a compute service that allows us to run application code without the need of provisioning and managing servers.

In other words, Run your application code without creating , managing and no payment for servers.

Benefits Of Using Lambda

  • AWS Lambda offers Scalability , It will scale your code by itself depending on the number of requests it receives
  • Pay only when your code runs.There is no charge when your code is not running.
  • No need to create , manage and monitor servers.AWS will do it for you by running the code on a high-availability compute environment.

Supported Languages

  • Java 11 , Java 8
  • Node.js 12.x , Node.js 10.x
  • Python 3.8 , Python 3.6 , Python 3.7
  • Ruby 2.5
  • Go 1.x
  • .NET Core 2.1

Creating Lambda Function

In this tutorial , We will see how to create a lambda function using aws console.

Login to LAMBDA CONSOLE

Click Create function,

You will be provided 3 options while creating a lambda function,

  • Author from scratch
  • Use a blueprint
  • Browse serverless app repository

Before creating the lambda function , You need to choose

  • the run time environment (the language you have used to write your code).
  • The permission required for the lambda function.
  • Event Triggers to initiate the lambda function.

Services That Invoke Lambda Function

  • Elastic Load balancing (ALB) , Cognito , Alexa , Cloudfront
  • API gateway , Step Functions , Kinesis Data Firehose
  • S3 , SNS , SES , Cloudformation
  • Cloudwatch Logs and Events , Code commit , AWS Config
  • IoT , IoT Events , CodePipeline

For this tutorial , Lets deploy a sample hello world application written in python into our lambda function.

Choose Use a blueprint and search hello

select hello-world-python and click Configure

Under Basic information , provide a name for the function and under Execution role , Select Create a new role with basic lambda permissions

Under lambda function code, You can see the preconfigured code provided by the blueprint

Lets have a look at the code, The lambda_handler which will be called by the event triggers will run the lambda function.

Click Create function

Now that we have successfully created our first lambda function which holds the hello world application written in Python 3.7.

 

Testing Lambda Function

Lets configure a event to test the lambda function, To do so,

Under Select a test event , Click Configure test events

Provide the Event name and click Create.

This test events pass the values to the functions in the code for the keys.

You can find your test events here,

Choose the event and click Test.

If everything goes well, The Execution result should be success.

Form the above screenshot , You can find the Keys value1 , value2 , value3 with their respective values value1 , value2 , value3 which we have passed through the test event.

Conclusion

Now that you can go ahead and create the lambda function on your own.Configure the events to trigger the lambda function.

Hope this article helps , Thanks for reading.

Please do check out my other publications.