Why go dynamic
Hub › AWS › Intermediate › Why go dynamic
Goal
After this page you will understand why a static page cannot change its content without a full redeployment, and why an API changes that equation.
Prerequisites
- AWS Beginner tier — you have a static
index.htmlserved by S3 + CloudFront.
The problem with static
The beginner tier produced a public URL that serves one file: index.html. Every byte on that page is baked in at upload time. To change any text you must:
- Edit
index.htmllocally. - Upload the new file to S3.
- Invalidate the CloudFront cache.
- Wait for the new version to propagate.
That four-step cycle is fine for content that rarely changes. But what if you want to show a list of items that updates frequently — a feed, a leaderboard, a product catalogue? Repeating those steps for every update is not sustainable.
What an API buys you
An API is an endpoint your page can call at runtime — in the reader's browser, after the page has already loaded. The flow changes to:
- Browser loads
index.htmlfrom CloudFront (cached; fast). - JavaScript inside
index.htmlcalls the API. - The API returns the latest data as JSON.
- JavaScript renders the data into the DOM.
Now updating the list means updating the API response — the HTML file itself stays the same.
What this tier adds
Three new pieces sit behind CloudFront:
- Lambda function — a small Node.js function that returns JSON.
- API Gateway HTTP API — an HTTPS endpoint that triggers the Lambda on every GET request.
- Cache invalidation — a one-command step to flush the old
index.htmlfrom CloudFront after you update it to call the API.
You build each piece in order across the next five pages.
What you will not do
- Custom domain, Route 53, or ACM certificates — advanced tier.
- Authentication on the API — advanced tier.
- Infrastructure as code (Terraform/CDK) — advanced tier.
Next → The Lambda function