What is actually Serverless

Don’t just get confused by the name Serverless, It obviously doesn’t mean “without server”, it means it’s not your server, or don’t worry about where is your code running. Serverless is misleading because servers still exist, but developers do not need to worry about managing the server.
Why Serverless? ⏰💰
Our application runs on a server and we are responsible for managing the resources for it. We are charged for keeping the server up even when we are not serving out any requests. We are also responsible for the uptime and maintenance of the server and all its resources. For small or startup companies these things will be too much to handle because you need a team for DevOps.
But Serverless Model will help you reduce loads of work, time, and cost. The reason serverless is getting hype because of many reasons like It is very inexpensive, Auto Scale/ Scalable, No server maintenance needed, More Secure, Easy to use. Especially the part where you only pay for the uptime.
Serverless is also known as FAAS 👨💻
FAAS means Function as a Service, We basically write different functions for doing a different kind of work. You might be used to deploying your application as a single Rails or Express monolith app. But in the serverless world, you are typically required to adopt a more microservice-based architecture.
Cloud Platforms that provide Serverless ☁️ 💻
There are multiple cloud platforms providing this service, such as OpenWhisk, Google Cloud Provider, Microsoft Azure, Amazon Web Services. But We will basically be talking about Amazon Web Services (AWS) Lambda.
What is AWS Lambda
AWS Lambda is an event-driven, serverless computing platform provided by Amazon as a part of Amazon Web Services. AWS Lambda(or Lambda for short) is a serverless computing service provided by AWS. Lambda basically introduced for Node.js but now it supports JAVA, Python, C#, and JS. In shorts, Lambda function exports your functions/Module send to AWS, wraps it up and create an endpoint for your function and provide you API for it. It is exactly that simple as it sounds.
What events can trigger a Lambda?
- HTTP events
- Scheduled(Cron Jobs)
- Watcher monitors other parts of the AWS echo system such as S3 buckets.
Develop and Deploying 🔥
Serverless framework provides you command-line interface from where you configure your deployment. Deployment here is very easy, there is only one .yml file which will take care of all your configurations. You just need to install the serverless command line and AWS Command Lineand allow Serverless to use your AWS credentials to deploy.
How to deploy 🌈
Okay, In this case, I will be deploying a simple Node.js application to AWS Lambda using Serverless framework. All you need to do is create a user using Identity and Access Management (IAM) in AWS which will give you access key 🔑 and secret key 🔐. Below code will allow the serverless to get your AWS services

| serverless config credentials --provider aws --key <access key 🔑 > --secret <secret_key 🔐 >--profile
Once the serverless configuration is done. you can just create a boilerplate for serverless functions by the below code.
| sls create -t aws-nodej 💥

we can use serverless as sls in shorts. Now you can just create your
| sls invoke local -f hello 💥

In the above screenshot you would have seen there is a handler.js file which is having a function exported. That’s where your code will go. And the “-f hello” in command is telling only that particular function to be triggered. Finally deployment.
| sls deploy -s production -f hello 💥
You can use -s for deployment. you can even deploy to the development environment. for Checking logs
| sls logs -f hello -s production — startTime 10m. 💥

And Finally! You can see the endpoint generate. Cheers 🍻 🎉
