Serverless in AWS and Azure: Amazon Lambda, Amazon Fargate, and Azure Function

Featured image

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 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.

Serverless is building and running applications without servers, that is without the burden of managing infrastructure. It does not mean we don’t use a server, it just meant we don’t need to manage the required server or infrastructure ourselves. The cloud service provider manages all the infrastructure for us.

Use cases for Serverless

Amazon Lambda

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.

AWS Lambda use case source

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.

Pricing

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.

Hands-On Tutorials

Using AWS Lambda with the Mobile SDK for Android

Using AWS Lambda with Amazon S3

Web application to request unicorn rides ride

Building Lambda functions with Python

Create a Lambda function with the console

Code Examples

Use AWS Lambda to build serverless backend for an iOS mobile application

Humidity sensor application to monitor humidity under a set threshold with AWS Lambda

To-Do App

Real-time data processing with Amazon Kinesis and AWS Lambda

Processing Interview Markdown files

Official Resources

Amazon Lambda

Amazon Lambda Documentation

Amazon Lambda Blog

Other Resources

AWS Lambda - The Ultimate Guide

AWS Lambda with Python: A Complete Getting Started Guide

AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Tutorial For Beginners | Simplilearn(video)

AWS Lambda Tutorial | AWS Tutorial for Beginners | AWS Cloud | AWS Lambda | AWS Training | Edureka

AWS Lambda Introduction

Amazon Fargate

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.

How AWS Fargate works source

Pricing

AWS Fargate pricing is based on the amount of vCPU and memory resources consumed by your containerized applications.

Hands-On Tutorials

Getting Started with Amazon ECS on AWS Fargate

Creating a Cluster with a Fargate Task Using the AWS CLI

Deep dive into Fargate Spot to run your ECS Tasks for up to 70% less

Code Examples

Application Tracing on Fargate with AWS X-Ray

Official Resources

AWS Fargate

AWS Fargate Documentation

AWS Fargate Blog

Other Resources

AWS Fargate Tutorial | AWS Tutorial For Beginners | AWS Certification Training | Edureka

Deep Dive into AWS Fargate

Deep Dive into AWS Fargate 2

Azure Functions

Azure Functions is a serverless compute service that runs event triggered code without provisioning infrastructures like compute. “Compute on demand”.

Azure Functions use case source

Pricing

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.

Hands-On Tutorials

Filtering sensor data simulated on IoT Edge with Azure Functions

Detect poor sentiment on Tweets and send email using Azure Functions and Logic App

Thumbnail generation with Azure Event Grid and Azure Functions

Update web application using Azure Functions

Code Examples

Trigger HTTP API endpoint with Azure Function to classify images

Official Resources

Azure Functions

Azure Functions Documentation

Azure Functions Blogs

Other Resources

Azure Function Apps Tutorial | Introduction for serverless programming