Cloud Parts

Serverless web app on AWS

CloudFront serves the site from S3 and sends API calls through API Gateway to Lambda functions backed by DynamoDB.

Fits: Startups and side projects; spiky or unpredictable traffic5 technologies
Live model
What you’re watchingPage loads go to CloudFront and are mostly cache hits; misses fetch from S3. API calls go to API Gateway, pass its throttle and run on Lambda, which reads and writes DynamoDB. Watch Lambda add instances, with cold starts in amber, when calls bunch up.

Click any box to open its page. Open it in the playground to rewire it, change the traffic or take parts down.

A web app with no servers to patch and almost no cost when nobody is using it. Static files (HTML, JavaScript, images) sit in S3 behind CloudFront’s cache. API calls go through API Gateway, which checks and throttles them, to Lambda functions that start on demand and keep their state in DynamoDB. Every piece scales by itself, and you pay per request.

How it flows

  1. 1

    The page comes from the edge

    A browser asks CloudFront for the site. Most files are already cached at the edge location nearest the user; on a miss, CloudFront fetches them from the S3 bucket and keeps a copy.

  2. 2

    API calls are checked first

    Calls to the API’s own domain go to API Gateway, which validates the user’s token and enforces rate limits before any of your code runs. Requests over the limit get a 429.

  3. 3

    Lambda runs your handler

    Each call runs a Lambda function. If no instance is free, Lambda starts a new one (a cold start, from under 100 ms to over a second); idle instances are reclaimed after a while.

  4. 4

    State lives in DynamoDB

    The function reads and writes items in DynamoDB, which answers in single-digit milliseconds at any scale. Because functions keep nothing between calls, any instance can serve any request.

Why this shape works

  • Close to zero cost at zero traffic, and no servers or capacity to manage
  • Each layer scales independently and automatically, from one request a day to thousands a second
  • The CDN absorbs most page traffic and keeps static files close to users
  • Security boundaries are explicit: the gateway authenticates, IAM controls what each function may touch

Where it strains

  • Cold starts add latency to the first requests after a quiet spell or during a burst
  • Lambda’s 15-minute limit and stateless model don’t suit long jobs or persistent connections
  • DynamoDB rewards designing tables around your access patterns up front; ad-hoc queries are awkward
  • At steady high traffic, per-request pricing can cost more than a few always-on containers

Common swaps

Built from

Architectures with parts in common

Sources

Improve this page on GitHub