Introduction – What Is Serverless?
People often ask about the serverless model introduce by AWS, how we can run and manage applications and infrastructure on the absence of a server. How apps run, manage, and benefit the customer without server management. Serverless mostly refers to serverless applications that didn’t require to manage or provision any servers. User can emphasis on his/her main products and businesses rather focusing on OS management and patching, provisioning, sizing, scaling, and availability etc. Building apps on a serverless platform, the platform manages above features for you.
Serverless platform should have the following capabilities:
No server management: in serverless platform, you don’t have to maintain or provision any servers. There is no software require to install and manage.
Flexible scaling: Serverless environment supports automatic scaling of your application by adjusting its capacity through the consumption i-e, throughput, memory rather than separate servers.
High availability: Serverless applications support built-in availability and fault tolerance features because, services running the application provide high availability and fault tolerance by default.
No idle capacity: Customer don’t pay for idle capacity which is not being used as compute and storage purposes. So, you don’t have to pay when your code isn’t running.
Benefits of Serverless Model
Abstraction of Compute Resources
Clearly hinted at in the name with a serverless methodology, you have no infrastructure to manage. Because the underlying machine either physical or virtual is abstracted away such as infrastructure provisioning, configuration management and patching. Moving towards a serverless model, it allows more resources to be used as dedicated to enhancing application-level code, which allows organizations to concentrate on these true distinguishing factors rather than considering infrastructure, configuration, and management.
Before the introduction of the serverless architecture, much efforts have been made available to provide these benefits by using PaaS offerings, but these resources did not quite go far enough that users are still being prerequisite to manage aspects of the underlying servers and the configuration of the Platform-as-a-Service (PaaS) itself.
By using serverless methodology, users can only fee for the compute resources that are normally consumed, which help in reducing waste and increasing the efficiency.
Serverless platforms can be charged at a very granulated level, which means that customers do not waste their money on the resources that are being used as idle or underutilized.
Using serverless model, cost for the growth is linear that provides predictable and straightforward forecasting.
By using a serverless model, a platform can scale quickly from hundreds to thousands of concurrent requests. This proactive scalability becomes needless, and furthermore allows the serverless platform to scale to meet the traffic that is spiky, bouncy, and truly unpredictable, such as that generated by breaking news events.
Often, in on-premises environments, the main reason of compromising a platform could be an operator error. At the network layer of your environment, a misconfigured firewall or a misconfigured ACL can open the doors for malicious traffic into your environment, and an unpatched OS can be a piece of cake for attackers; it is not to indicate zero-day or hidden vulnerabilities and weaknesses that can be exploited and oppressed by offenders or agents of industrial or national espionage.
AWS are responsible for providing the security of the basic Lambda execution environment and are able to offer substantial resources and expertise to this, developers are free to concentrate on application level security and can take benefit from the managed security services. We can’t say that security is no longer a concern in serverless environments and clearly an application weakness and vulnerability or cross-site-scripting security hole will still be a problem – but the main benefit is that attack surface is reduced.
What is AWS Lambda?
AWS Lambda is a core platform behind the serverless environment. AWS Lambda is a compute service that allows to run code without managing provisioning servers. It runs your code only when it required and can scale automatically, simply from some requests per day to thousands requests per second. Customer will pay only for the compute time he/she consumes as you don’t have to pay when your code is not running.
By using AWS Lambda platform, a code can be run virtually for any type of application or backend service without any administration. AWS Lambda executes a code on a high availability compute infrastructure and executes all administration tasks regarding compute, including server and OS maintenance, provisioning, scaling, code monitoring, and logging. Customer only needs to provide a code in one of AWS Lambda supported languages i-e Node.js, Java, C#, Go and Python.
AWS Lambda can be used to run your code in response to events i-e changes to data in an Amazon S3 bucket or an Amazon DynamoDB table, HTTP requests using Amazon API Gateway, API calls using AWS SDKs. By using these capabilities, AWS Lambda can be used to easily build data processing triggers for AWS services like Amazon S3 and Amazon DynamoDB process streaming data stored in Kinesis, or you can create your own back-end that operates at AWS scale, performance, and security.
Advantages of Using AWS Lambda
Bring your own code
- Node.js, Java, Python, C#, Go
- Bring your own libraries (even native ones)
Simple resource model
- Select power rating from 128 MB to 3 GB
- CPU and network allocated proportionately
- Synchronous or asynchronous
- Integrated with other AWS services
- Securely grant access to resources and VPCs
- Fine-grained control for invoking your functions
AWS Lambda Pricing
With AWS Lambda, you will pay only for what you are using. You will be charged per requests for your functions and the time duration which takes to execute your code. You can follow Lambda Pricing Lambda@Edge Pricing for further pricing details.
Supported Frameworks with AWS Lambda
The Serverless Framework7 (originally JAWS) is the first to be released and mature framework. Serverless Framework is written in node.js and uses AWS CloudFormation for provision of AWS resources which means serverless framework deploys the Lambda functions themselves, along with any other CloudFormation provisionable resources that can be used to support their execution. Serverless Framework can also be used to deploy non-web-applications to Lambda.
Zappa9 is another framework for serverless applications written in Python language. It can work with any WSGI application, therefore, it can be used with common Python web application frameworks i-e Flask, Django, and Bottle.
Chalice is produced by AWS Labs. Chalice8 is a micro-framework that used to deploy Python applications to Lambda and route requests using API Gateway. Chalice offers Python decorators that can be used to route requests, but don’t propose management of any other AWS services outside of API Gateway.
Sparta is written in Go. Sparta10 is like as Serverless Framework uses CloudFormation to provision and manage AWS resources at back-end.
SAM stands for Serverless Application Model12 is a set of extensions to CloudFormation which designed to enable the serverless applications deployment with API Gateway, Lambda, DynamoDB.
Apex11 is the node.js framework that allows to build, provisioning and management of Lambda functions. Apex can also integrate with other tools such as Hashicorp Terraform.
I hope you’ve enjoyed reading this post, if you feel it has some shareable information, you can share on social media, be sociable!