CloudIntermediate16 min readUpdated March 2025
Serverless Architecture
Build event-driven applications without managing servers. Learn the serverless building blocks, common patterns and when serverless is the right choice.
What Serverless Really Means
Servers still exist, but the provider manages provisioning, scaling and patching. You deploy functions and managed services; they scale automatically, even down to zero, and you pay per request rather than per idle hour.
The Serverless Building Blocks
A typical serverless application combines managed services:
- Compute — Lambda, Azure Functions, Cloud Functions.
- API layer — API Gateway or function URLs.
- Data — DynamoDB, Aurora Serverless, S3.
- Messaging — SQS queues, SNS topics, EventBridge event bus.
- Orchestration — Step Functions for multi-step workflows.
Event-Driven Example: Image Thumbnails
When a file is uploaded to S3, an event triggers a function that creates a thumbnail. No polling and no idle servers:
python
import io
import boto3
from PIL import Image
s3 = boto3.client("s3")
def lambda_handler(event, context):
record = event["Records"][0]["s3"]
bucket = record["bucket"]["name"]
key = record["object"]["key"]
original = s3.get_object(Bucket=bucket, Key=key)["Body"].read()
image = Image.open(io.BytesIO(original))
image.thumbnail((200, 200))
buffer = io.BytesIO()
image.save(buffer, format="JPEG")
buffer.seek(0)
s3.put_object(
Bucket=bucket,
Key=f"thumbnails/{key}",
Body=buffer,
ContentType="image/jpeg",
)
return {"status": "ok", "thumbnail": f"thumbnails/{key}"}Trade-offs to Consider
Serverless is powerful but not universal:
- Cold starts add latency to the first request after idle time.
- Execution limits on duration and memory make long jobs a poor fit.
- Vendor coupling — event formats and services differ between providers.
- Debugging distributed flows requires good logging and tracing.
- Cost at scale — constant high traffic can be cheaper on containers.
Key Takeaways
- Serverless removes server management and scales automatically to zero.
- Event-driven designs connect managed services with small functions.
- Watch for cold starts, execution limits and vendor coupling.
- Choose it for spiky, event-driven workloads; not every workload fits.
Contact Us
Have a question or feedback? Fill out the form below or reach us directly at support@nvaitraining.com