SVS327: Build interactive web apps with AWS Lambda

Resources for SVS327: Build interactive web apps with AWS Lambda

This chalk talk built LambdaLine, a racing game with a live leaderboard, on one AWS Lambda Web Function. It covered multi-Region on one URL, built-in canary deploys, server-sent events from a standard web server, and what makes Web Functions simple to run: no adapter, fewer cold starts and active CPU billing.

LambdaLine source code

GitHub repo

The racing game from the session: one Web Function serving the game, the API and the live leaderboard in three AWS Regions.

What is a Lambda Web Function?

Your web server is the function

Your server listens on the host and port Lambda gives it, and frameworks such as Express and Hono run as they are.

Multi-Region on one URL

Lowest-latency routing

A MultiRegion endpoint sends each request to the lowest-latency Region. LambdaLine reads and writes a local replica of one Amazon DynamoDB global table in each Region.

Shipping a new version and canary deploys

Revisions and traffic splits

One aws lambda-web deploy command creates a new revision. The dev endpoint follows it, and you set the global endpoint's traffic split to canary, promote or roll back.

Server-sent events

Streaming as plain HTTP

The live leaderboard is an ordinary streamed HTTP response, with one database poller shared by every stream in an environment.

Simple to run

Many requests per environment, active CPU billing

Each execution environment serves many requests at once, so a busy app starts fewer environments. You pay for the CPU your code actively uses, not for time spent waiting.

Deploying with AWS Amplify

Full-stack hosting

Build and deploy full-stack web apps on AWS with AWS Amplify.

Which to choose

Event Functions, Web Functions or containers

Event Functions for events and APIs that already work, Web Functions for web frameworks, streaming and many requests per environment.

Presented by:

Julian Wood

Julian Wood

Julian is a developer advocate at AWS who loves helping developers learn how serverless and AI technologies can transform the way they build and run applications in the cloud.