Serverless and Managed Compute

Run code as functions or scale-to-zero containers, wired to events, and learn where serverless shines and where it hurts.

Intermediate · about 6 hours · difficulty 3/5

Learn first: AWS Core Services

Serverless means you never manage servers or clusters: you hand the platform code or a container image, and it runs, scales and bills per invocation or per second.

The main shapes

  • Functions as a Service: AWS Lambda, Azure Functions, Google Cloud Functions. Short-lived handlers triggered by events.
  • Serverless containers: Cloud Run, Azure Container Apps, AWS Fargate and App Runner. Any container, scaled on HTTP requests or queue depth.
  • Serverless data services: DynamoDB, Aurora Serverless, S3, SQS, EventBridge, Pub/Sub.

Event-driven design

Functions shine when glued to events: an object lands in a bucket, a message arrives on a queue, a cron schedule fires, an API Gateway route is called. Design handlers to be idempotent (the same event may arrive twice), keep them small, and push failures to a dead-letter queue.

Operational realities

  • Cold starts add latency when a new instance boots; mitigate with smaller packages, provisioned concurrency or min instances.
  • Limits: execution timeouts, payload sizes and concurrency quotas.
  • Observability needs structured logs and tracing because you cannot SSH in.
  • Cost is tiny at low volume but can exceed a container at steady high load.
  • Package and deploy with IaC (Terraform, SAM, Serverless Framework, CDK), not console uploads.

Good enough to move on: you can build an event pipeline with a queue, a function and a dead-letter queue, explain cold starts, and estimate when a steady workload would be cheaper on containers.

Key concepts

  • Functions as a Service
  • Serverless containers
  • Event sources and triggers
  • API gateways
  • Idempotency and dead-letter queues
  • Cold starts and concurrency limits
  • SAM, CDK and Serverless Framework

Mini project

Build an image-thumbnail pipeline: upload to a bucket triggers a function that writes a resized copy to a second bucket, with failures routed to a dead-letter queue and an alarm on it.

Check yourself

A queue-triggered function occasionally processes the same message twice. Why does that happen, and how do you make it harmless?

Free resources