It only took a few decades for a room-sized computer to fit into our pocket (and with more power). We’ve also quickly moved from software applications being installed on the computer, to applications being served through the cloud. And now, the need for physical servers is being replaced with virtualization. We’ll take a look at the Amazon Web Service (AWS) serverless offerings that have made it possible for developers to create and run API applications with virtually unlimited scalability and without managing any servers.
Previously, in order to publish a web application over internet, you needed to host through some physical server, where we used server as a service. Virtualization changed this mechanism from physical servers to clouds. Any number of servers can easily be created with any specification though virtualization.
Amazon Web Services (AWS) is one of the lead cloud service provider. AWS provides many services in order to configure any application on cloud.In order to configure web application on AWS, you would required Amazon Elastic compute cloud (Amazon EC2) in conjunction with Elastic Beanstalk services for deploying onto Amazon EC2. Amazon EC2 offers flexibility and a whole range of EC2 Instance types to choose from.
Amazon EC2 was designed to make web-scale cloud computing easier for developers and allow for resizable computing capacity in the cloud. With Amazon EC2, applications can scale up and down to meet your needs. You have complete control of your instance, root access to each instance, and ability to stop, start and reboot from a web service API.
Amazon EC2 also offers flexible cloud hosting services, with a range of EC2 instance types, operating systems, and software packages. These all work in conjunction with Amazon Simple Storage Services (S3), Amazon Relational Database services (Amazon RDS), Amazon Simple DB and Amazon Queue Services (Amazon SQS), and many more, providing a reliable 99.95% commitment of availability for each Amazon EC2 Region.
With Amazon EC2, a wide range of tools are available to automatically monitor and log your instances and traffic. However, triggers are not set up unless they are configured by you and approved by AWS.
What do you mean by server-less ? Serverless, in this case, means it is without any permanent infrastructure. So there is still a server, but it only has a 40 millisecond life cycle.
With a traditional HTTP server, the server is online 24/7, processing requests one by one as they come in. If the queue of incoming requests grows too large, some requests will time out. AWS provides server-less architecture with AWS Lambda in conjunction with Amazon API gateway, each request is given its own virtual HTTP "server" by Amazon API Gateway. AWS handles the horizontal scaling automatically, so no requests ever time out. Each request then calls your application from a memory cache in AWS Lambda and returns the response via Python's WSGI interface.
AWS Lambda is a service for running code in response to events, such as changes to data in an Amazon S3 bucket and Amazon DynamoDB tables. AWS Lambda also works as a compute services to run your code in response to HTTP requests using Amazon API gateway or API calls made by using AWS SDKs. It is an ideal computer platform for applications that run within the standard runtime environment. AWS Lambda currently supports Node.js, Java and Python languages. Code is supplied by the customer and templates are available for specific functions. It executes only when needed and scales automatically to meet requirements which enables Lambda to build data processing triggers for AWS services.
AWS Lambda manages the computer fleet that handles memory, CPU, networking and other resources, but this comes with a loss of flexibility for you. Our instance cannot be modified in any way while hosted on AWS Lambda. AWS Lambda needs to perform operational and administrative activities such as provisioning capacity, monitoring fleet health, applying security patches, and deploying code, all while monitoring and logging the AWS Lambda functions.
You pay for the compute time you use, there is no charge when not running, and you can run code from virtually any type of application or backend service – all without the administration responsibility. You just upload your code in the required language and AWS Lambda takes care of everything required to run and scale with high availability. It can be set to automatically trigger other AWS services, or call directly to any web or mobile app.
With Amazon Lambda, provided you are using the required language and you have coded it correctly to launch a triggered event, all the information is gathered specific to those triggers, giving you a “NoOps” function and allowing for real-time analytics of raw data.
Amazon Lambda eliminates the need to understand or worry about infrastructure. Other benefits include:
There are many wrapper written to automate the process of setting up the server-less on AWS Lambda. Below are the list of wrappers with some brief introduction.
By going serverless, you don’t have the high cost of keeping your servers up 24×7. Instead, you only pay for the time taken to process HTTP requests, which is much more cost effective.
You are also only charged for the total number of requests across all your functions. Lambda counts a request each time it starts executing in response to an event notification or an invoke call, including test invokes from the console. A detailed explanation of AWS Lambda pricing is available, but the basics are:
First 1 million requests per month are free $0.20 per 1 million requests thereafter ($0.0000002 per request)
The serverless approach provides an opportunity for developers to deploy their application in minutes instead of days or months.
In my own experience, going serverless really speeds up the application development process. I have done implementation with a Django-based application using Zappa and was able to instantiate the different application environments and automate deployment. It has also helped me to design a stable application where I didn’t need to configure any server softwares such as Apache or Ngnix and I didn’t need to set up any task schedulers thanks to AWS Lambda. This serverless approach will help anyone interested in efficiently taking their application live in less time and for less cost.