Serverless Computing with AWS Lambda
For when you need to run just a bunch of code on a server, why rent an entire machine?
When the client isn't really able to serve the computational needs, then a server is summoned. This happens usually in cases where -
While standard servers can easily cater to all of these requirements, they still prove to be an overkill. Imagine running an entire virtual machine with a server environment just to generate a bunch of strings!
This is where the concept of 'serverless' backends comes in. A serverless backend still runs on a server but allows you to shift your focus from managing the server to optimizing your code. This means that in a serverless environment, you are only accountable for the amount of time and resources your code expends. This is made possible by sharing a single server for a lot of such concise serverless backends. There are many cloud service providers which offer this amazing functionality. Here, I am going to throw some light at Lambda, the serverless computing solution offered by Amazon Web Services.

AWS Lambda is a serverless backend service provided by Amazon Web Services which offers a variety of customizations and enhancements. All you need to do is to upload your code into Lambda, and it will take care of all processes, including deploying and scaling your code. It comes with a bunch of 'triggers' which help you to set a piece of code to be called on another AWS service's event. This can come very handy when trying to create DevOps solutions, or post-submission data validation systems.
The official website does a great job in listing out a variety of use cases for the service.
Basically, a Lambda function consists of three major parts -
AWS Lambda is a part of the AWS Starter Account too, which means that if you're a student, you can get it running without going through the hassle of creating a standard AWS account with billing details. I'm going to show how to set up a basic Lambda function in NodeJs runtime environment which takes in two numbers and carries out a few calculations on them.
For an input as
{
"Number1": 20,
"Number2": 4,
}
the function would respond with
{
"Number1": 20,
"Number2": 4,
"sum": 24,
"difference": 16,
"product": 80,
"quotient": 5
}
Here we go -
Sign up for an AWS Educate Starter account or a standard AWS account.
Log in to your Amazon Web Services account and navigate to the Lambda console. Click on Create Function and choose Author from Scratch so that you can start with a minimal boilerplate.
Choose a name for your function, select the Nodejs runtime and define a role for your Lambda to use. Since any external resources or triggers aren't required currently, you don’t need special permissions, but this is where you would add a role with those permissions.

Instead of simply defining the function, AWS also allows use to define test events, which can directly be run against our Lambda function to test them. It is always advisable to create one. Choose the "Configure tests" option from the "Select a test event" dropdown.

AWS provides a great number of templates. In the current scenario, you can use the Hello World template and modify it to meet the requirements 
Once the test is created, you can trigger it with the Test button. 5. Now add the code for your function
exports.handler = (event, context, callback) => {
var n1 = event.Number1;
var n2 = event.Number2;
var sum = n1 + n2;
var product = n1 * n2;
var difference = n1 - n2;
var quotient = n1 / n2;
callback(null, {
"Number1": n1,
"Number2": n2,
"sum": sum,
"product": product,
"difference": difference,
"quotient": quotient
});
};
That's it! Now you can test your function by clicking on the Test button.
So that was all about the introduction of an amazing AWS service. Make sure to check out the official AWS documentation to explore more possibilities with Lambda functions.
Thanks for reading!