Running your code on the cloud without a Server: Amazon Lambda, Amazon Fargate, and Azure Functions.
The word Serverless is becoming a popular word in cloud computing. This does not necessarily mean we don’t use a server, instead it means we don’t need to “provision” that is create the underline infrastructure which is most time a server required to run your code. The cloud provider which can be Amazon Web Service(AWS) or Microsoft Azure or Google Cloud Platform(GCP) or any other cloud provider takes care of the infrastructure required to run our code based on the time spent running the code. This means we don’t pay the cloud provider when your code is not running.
I spend 1 hour every day exploring cloud services in AWS and Azure. I explore based on use case or functionality. Each week I document the resources I used during my exploration. This week I explored serverless services in AWS and Azure. The major serverless services in AWS are Amazon Lambda and Amazon Fargate, while for Azure we have Azure Function. Amazon Lambda is similar to Azure Functions.
This article covers a brief description and use cases of the serverless services in AWS and Azure. It also provide resources on their prices, components, hands-on examples, code examples, and comparison.
Use cases for Serverless
- Application for continuous delivery pipeline
- Data processing
- Real time stream processing
- Real time file Processing for instance run a code when new data is received
- Data preprocessing and model serving in machine learning
Amazon Lambda runs code without servers and clusters. In other words, you don’t need to provision infrastructure. Amazon Lambda also has a code editor where you can write, test, and view execution results. Your code should be uploaded as a zip file or as a container image, the resources required are automatically allocated to it. This code could be run based on a trigger for instance change in data in S3 bucket, response to HTTP request using Amazon API Gateway.
Major Amazon Web Services(AWS) used with Amazon Lambda: Amazon S3, Amazon DynamoDB, Amazon Kinesis, Amazon SNS, Amazon CloudWatch, Amazon API Gateway, AWS IoT Core, Amazon SNS, Amazon SAM, Amazon EventBridge, Amazon Step Functions, SQS, Amazon Aurora Serverless.
Amazon Lambda free usage tier includes 1M free requests per month and 400,000 GB-seconds of compute time per month. Amazon Lambda pricing is based on the number of requests for your functions and the duration, the time it takes for your code to execute.
Amazon Fargate runs containers without provisioning any infrastructure. It works majorly with Amazon ECS and Amazon EKS. Task Definition is the blueprint to run application, it contain the description of containers used in the application. It is always in JSON format.
AWS Fargate pricing is based on the amount of vCPU and memory resources consumed by your containerized applications.
Azure Functions is a serverless compute service that runs event triggered code without provisioning infrastructures like compute. “Compute on demand”.
Azure Functions provides a monthly free grant of 1 million requests and 400,000 GBs of resource consumption per month per subscription in pay-as-you-go pricing across all function apps in that subscription. Azure Function Pricing is based on per-second resource consumption and executions.
Originally published at https://trojrobert.github.io on January 3, 2021.