Introduction to AWS Serverless Computing
Before we introduce AWS Serverless Computing, let’s talk about the native architecture that takes care of all the building and running of one’s applications and services; this helps in increase in innovation and agility and allows one to worry less about the servers. It omits the various tasks involved with clusters and server and can be used for any type of application.
Basically in layman language usage of AWS serverless computing will result in
- No servers to provision or manage
- It’ll scale according to the usage
- Pay for only the time when your program is running
- AWS Serverless provides with built-in fault tolerance ability
What does AWS Serverless Platform provide?
AWS manages all the services that a user can use to build and run its program on AWS’s system. AWS handles all the back end tasks like computing, databases, storage, processing and many more, this in result, allows the user to focus on his program and allows him to innovate.
- Compute using AWS Lambda
- Storage using Amazon S3
- Data Stores using Amazon DynamoDB
- API Proxy using Amazon API Gateway
- Application Integration using Amazon SNS
- Orchestration using AWS Step Functions
- Analytics using Amazon Kinesis
- Developer tooling using different tools and services that AWS provides
- Security & Access Control using AWS Identity and Access Management
Pros and Cons of AWS Serverless Computing
Serverless is a boon as it helps a developer to focus all his power into developing rather than worrying anything about deploying and managing servers. Serverless computing can be used to run or build any modern application and increases agility whereas at the same time helps to lower the cost of your product.
Pros of Serverless Computing
- Servers need no attention for installation and maintenance
- Payment is as per the throughput, making it value for money
- You can choose appropriate settings as per your products requirement, thus paying only for the functions you use
- Serverless provides you with many beneficial architects that are built-in and are provided to you by default
- It helps the developer to focus only on the code thus giving him ample time to innovate the program or to interact with customers to get customer feedbacks thus increasing time to market
- You can write code, and when you’re finished with everything, you can straightaway deploy the system, and it’ll be available to the world within a few minutes. Thus no need to put any effort into or for creating and managing servers
Cons of Serverless Computing
- Serverless Architecture executes commands and functions on temporarily created containers. So if a client performs few tasks on your app, the serverless architecture will create a temporary box and will destroy it as soon as the client is done performing tasks, this results in delays which are also known as cold start
- As AWS’s serverless architecture is based on the temporarily created containers, the usable memory is thus limited hindering the processes that require a lot of processing.
- Another issue with AWS Lambda is that AWS decides which third-party apps can be used to work on it, thus giving up a lot of control over your application.
- Currently, Lambda provides with 1000 concurrent executions, all across the AWS account the limit is same. If the user tries to load test while using the same AWS account for both production and analysis, this will result in DoS state (Denial of Service)
- Monitoring and Debugging are quite restrictive to what the vendor provides. It is fundamental with AWS Lambda too. It lacks proper operational tools for monitoring and debugging.
- Running an application that runs 24*7 can be expensive on serverless that running the same form over server-based cloud system.
- Lack of local testing options
- As the serverless application grows, complexity to troubleshooting also increases, because of the way it is designed.
What is AWS Serverless Architecture?
It is a way to build and run services and applications without having to manage infrastructure. Users application still runs on servers, but servers are managed by AWS. It is a method that provides with support for back-end services. Users are charged based on their computation, and nothing else is charged for only the services used. Though these are called serverless but physical servers are still used, but developers don’t have to get the knowledge of it. It offers Function-as-a-Service(FaaS).
Why Use AWS Serverless Architecture?
It provides with various advantages over traditional server-centric or cloud-based infrastructure. It offers developers with greater scalability, quick time to release, more flexibility and all this at a reduced cost as the user pays only for the services used. A developer can focus on their core product instead of juggling between managing and operating servers or run times and developing the application. It helps decrease latency.
Serverless Automated Deployment
User can easily make a serverless application with an automated deployment pipeline from the AWS Lambda console. AWS services integrated with AWS SAM are used to automate deployments. AWS SAM helps deploy new versions of Lambda function and automatically creates aliases that point to the latest version. If gradual rollouts are enabled through AWS SAM, a CodeDeploy resource is automatically created for the user.
Serverless Authentication with JSON Web Tokens
Authentication – It determines if the client’s credentials are valid or not.
Authorization – It determines what functions a client can perform. The privileges might be different for different clients.
JSON Web Tokens (JWT)
This is a compact and self-contained way for securely transmitting the information. It is a string that consists of 3 components separated by “.” character.
AWS Lambda uses a Lambda authorizer, and it is an API Gateway feature. It uses Lambda functions to control access to users API. There are two types of Authorizers:-
- A token-based Lambda authorizer
- Request parameter-based Lambda authorizer
AWS Serverless – Authentication
AWS can be accessed by following types of identities:
- AWS account root user
- IAM user
- IAM role
AWS account root user
- It helps manage roles, users and policies.
- The root user can create, disable or delete access keys.
- Can also change the root password.
- It has access to all the resources provided by AWS.
- Can create policies
- Policies can’t be used within the account to deny access to the root user.
- If the root user gets hacked, his security could be jeopardized.
- Improves user experience.
- Enhances security profiles.
- Simplifies Auditing and Reporting.
- Allows easy access.
- Helps increase productivity and reduce IT costs
- Doesn’t have access to all the resources, only to the funds that the root user provides access to.
- Unable to make policies if not given access for.
- Restricted to use the resources for which permission has been granted or for which access has been provided
AWS Services for AWS Serverless
AWS provides AWS Lambda that lets the user run code without managing servers, and the user only pays for the computations used.
Lambda@Edge allows user to run Lambda functions at AWS Edge locations in response to events of Amazon CloudFront
AWS Fargate is a serverless compute engine built for containers. It helps scale and manage the infrastructure required to run the user’s box.
Amazon S3 provides a developing team with durable, secure and highly-scalable object storage. It’s easy to use and portable
Amazon EFS provides pure, scalable, elastic file storage. It’s self-adjusting and grows and shrink as per the user’s demand.
Data Store Services
AWS provides with Amazon DynamoDB, which is a fast and flexible No-SQL database service for all applications; it needs millisecond latency at any scale.
Amazon Aurora Serverless – It is an on-demand (MySQL-compatible system) auto-scaling configuration. In this database will automatically start-up and shut down. The system will scale according to the user’s application’s needs.
API Proxy Services
Amazon API Gateway – It’s a fully managed service that makes the task easy for developers to create, maintain, publish, monitor and secure APIs at any scale. Gateways allow you to process thousands of concurrent API calls and helps the user to handle traffic management, authorization and access control, monitoring, and API version management.
Application Integration Services
Amazon SNS – It is a fully managed pub/sub messaging services that help decouple and scale microservices, distributed systems and serverless applications.
Amazon SQS – It is a fully managed messaging services that help decouple and scale microservices, distributed systems and serverless applications.
AWS AppSync – It helps simplifying application development by letting you create a flexible GraphQL API, it helps secure access, manipulation and combines data from one or more data sources.
Amazon EventBridge – It is an event bus service for serverless computing which helps to make access application data easy from many sources and send it into the user’s AWS environment.
AWS Step Functions – Zit helps to make it easy to coordinate the components of distributed applications and microservices; it uses visual workflows for the same.
Amazon Kinesis – It is used to stream data on AWS. Kinesis offers great services to help load and analyze the streaming data.
Amazon Athena – It is a service that’s interactive and makes it easy to analyze the data in Amazon S3 using standard SQL. Athena is serverless.
Developer Tooling Services
AWS provides with tools and services that help developers in the serverless application development process. It offers many more tools like tools for continuous integration, delivery, testing, deployments, monitoring and diagnostics, SDKs, frameworks, and integrated development environment(IDE) plugins.
AWS vs Google Cloud vs Azure
AWS Lambda is better than others as a programming language is quite diverse and Lambda provides with more version and more types of supported languages than other serverless architecture providers.
Stateful Functions Support
AWS LAMBDA does not provide with this support, but it can access the AWS storage services where AZURE provides this feature, and Google Cloud has no such element as of now.
IAM policies can be attached to Lambda whereas RBAC is supported at Subscription and Functions are inside in Azure. Google Cloud has not publicly released anything related to this.
AWS uses S3 & DynamoDB for complete stateless persistent storage whereas in Azure Environment variables can be set so that it can be used in functions, Azure stores in blob storage. Google Cloud provides with Cloud Storage, Cloud Datastore, Cloud SQL for the same.
In AWS deployment is done in zip format, the zip is uploaded to Lambda/S3 whereas in Azure Git, dropbox, visual studio, Kudu console etc. can be used for deployment. In Google Cloud CLI, Zip upload, Cloud Storage or Source and inline web editor are used for the purpose.
Maximum number of functions
In AWS and Azure, there’s no limit on a maximum number of functions whereas in google the limit is up to 1000 per project.
AWS Serverless Application Use-Cases
- Web Application and Backend
Serverless web applications and backend could be made using AWS Lambda, Amazon API Gateway, Amazon S3 and Amazon DynamoDB and these would help handle web, mobile, IoT and chatbot requests
- Weather Application
- Mobile Backend for social media app
- Data Processing
Many different variants of real-time data processing systems can be built in AWS Serverless Computing using AWS Lambda, Amazon Kinesis, Amazon S3 and Amazon DynamoDB
- Image Thumbnail Creation
- Analysis of Streaming Social Media data