Dynamically Build a Static Website on AWS

Overview
The diagram above illustrates how you can build a dynamically generated static website using AWS cloud services.
What’s Involved
- AWS S3 object storage
- AWS API Gateway
- AWS Lambda
- AWS Simple Notification Service (SNS)
- AWS DynamoDb or RDS
How It Works
The static website is hosted on an S3 bucket as a website.
When a content change is required, an API call is made through API Gateway which does two things:
- Stores the change in the data persistence layer
- Triggers a notification to rebuild the static content
The AWS Lambda function receives the notification, reads the data from the persistence layer and redeploys the static HTML content to S3.
Why is This Useful?
The above architectural pattern can be used for content that is infrequently modified, but frequently accessed. The pattern removes the need for dynamically generated content for each request, and instead only invokes compute resources when the source information changes.
This is extremely effective for documentation, marketing, and mostly static web content. A similar mechanism is employed for sites using Hugo or Jekyll, although their compute cycles typically take place in a developer environment.