AWS lambda HelloWorld!!!
AWS Lambda is an event-driven, serverless computing platform provided by Amazon as a part of the Amazon Web Services. It is a computing service that runs code in response to events and automatically manages the computing resources required by that code. It was introduced in November 2014.
Function as a Service — FAAS (Server less)
In this tutorial, we are taking an existing blueprint hello world example to explore lambda.
AWS Lambda provides you with computing power in the cloud by allowing you to execute code without standing up or managing servers.
AWS Lambda is offer service to run code without thinking about the server and pay only for the compute time you consume.
- Author a Lambda function using Node.js via the aws management console
- Test a Lambda function via the aws console
- Lambda is found under the Compute section on the AWS Management Console.
- Lambdas have a time limit of 15 minutes.
- The code you run on AWS Lambda is called a “Lambda function.”
- Lambda code can be triggered by other AWS services.
- AWS Lambda supports Java, Go, PowerShell, Node.js, C#/.NET, Python, and Ruby. There is a Runtime API that allows you to use other programming languages to author your functions.
- Lambda code can be authored via the management console.
Go to Lambda →Click on create function → in search select Runtime and runtime environment is nodejs you can select what you prefer.
Then select the hello-world blueprint.
- Create a Lambda Function:- Enter function name. Execution role select “Choose or create an execution role”
2. Click on create function:-
3. Click on the Test button to provide some test data:- provide some test data and click on creat button
Once this is done scroll down, you will see code editor and on top of that “Test” button is there click on it and you will see the result on the console.
This is very basic let us do one thing modify the existing function line no 5 with below line of code and save
body: JSON.stringify('Hello ' + event.key1 + ' from Maheshwar!'),
Scroll down to the “Basic settings” section.
- For the Description, enter “My Function”.
- Change the “TimeOut” from 3 seconds to 5 minutes.
- Click the “Save” button in the upper right-hand corner.
Now Test your code changes and enjoy!!