1. What is serverless? #
The ultimate level of abstraction, where the server becomes invisible.
No-Ops? #
Serverless does not mean there are no more servers, but that you no longer have to manage them. You only provide a function (FaaS) that runs in response to an event (click, file upload, message in a queue).
2. The advantages: cost and agility #
Cost is calculated by the number of executions and their duration (often to the millisecond). If your code does not run, you pay €0. This enables instant scaling from 1 to 10,000 requests per second.
3. Use cases and limitations #
Ideal for APIs, image processing or scheduled tasks. Watch out, however, for 'cold starts' (latency on first start) and execution time limits (often 15 minutes max per function).
Hands-on: a serverless function #
Deploying and calling a function.
Writing and deploying #
# handler.py
def handler(event, context):
return {"statusCode": 200, "body": "Bonjour depuis le serverless"}
# AWS Lambda
zip function.zip handler.py
aws lambda create-function --function-name bonjour --runtime python3.12 --handler handler.handler \
--zip-file fileb://function.zip --role arn:aws:iam::123456789012:role/lambda-role
aws lambda invoke --function-name bonjour out.json && cat out.json
aws logs tail /aws/lambda/bonjour --follow# Google Cloud Functions / Azure Functions
gcloud functions deploy bonjour --gen2 --runtime=python312 --trigger-http --allow-unauthenticated --region=europe-west1
func init MonProjet --python && func new --name bonjour --template "HTTP trigger" && func startCommon mistake: Cold starts, duration limits and vendor lock-in are the three pitfalls of serverless: measure the latency of the first call.
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
IaaS, PaaS, SaaS: differences and examples of cloud service models
IaaS, PaaS, SaaS: what is the difference? Definitions, concrete examples (AWS, Azure, Google Clou...
Compute on AWS: EC2, Auto Scaling, Lambda and containers
Choose and use AWS compute services: EC2 instances (types, AMIs, EBS, user data, purchasing model...
Edge computing: definition, solutions and modular data centers
Edge computing explained: processing data as close as possible to its source, use cases (IoT, ind...
What is cloud computing? The NIST definition
Understand the fundamentals of cloud computing through the 5 essential characteristics defined by...
Cloud deployment models: public, private, hybrid, community and multi-cloud
Understand cloud computing deployment models according to NIST: public, private, community and hy...
Compute on Azure: virtual machines, App Service, Functions and containers
Choose and use Azure compute: virtual machines and scale sets (VMSS), App Service, Azure Function...
Compute on Google Cloud: Compute Engine, GKE, Cloud Run and Cloud Functions
Choose compute on Google Cloud: Compute Engine VMs and managed instance groups, Google Kubernetes...
CaaS: state of the art and best practices
Container as a Service (CaaS) is a cloud computing model that lets companies manage and deploy ap...
Stop moving to the Cloud, to micro-services...
I will certainly shock more than one person in this article, but don't hesitate to read to the en...