Skip to content

krondorl/aws-static-random

Repository files navigation

AWS Static Random

A simple static website hosted on AWS using SST, serving a random number on each page load.

The site demonstrates deploying a static HTML file to AWS S3 and distributing it via CloudFront.

⚠️ Disclaimer

This project deploys infrastructure to your AWS account.
You are fully responsible for any costs incurred.

Please review all AWS resources created by this project before deploying. Running services like S3, CloudFront, or other AWS components may result in ongoing charges, especially if deployed in a production stage or left running.

The author of this repository does not take responsibility for any unexpected charges or misuse.

To avoid ongoing costs, make sure to remove all deployed resources using:

npx sst remove --stage production

Tech Stack

  • 🛠️ SST (Serverless Stack)
  • 🗂️ AWS S3 (Static site hosting)
  • 🌐 AWS CloudFront (CDN)
  • 🧾 Static HTML (with inline JavaScript and inline CSS for simple use case)

Dependencies

Features

  • Deploys a static HTML site to AWS S3
  • Distributes content globally with CloudFront
  • Displays a random number on each page load
  • Simple, minimal configuration

Installation

  1. Clone the repository:
    git clone https://github.com/krondorl/aws-static-random.git
    cd aws-static-random
  2. Install dependencies:
    npm install

Set Up IAM User and AWS CLI

Please read these on how to set up user and CLI:

Usage

  • Start local development server:
    npm run dev
  • Deploy to AWS:
    npx sst deploy
  • Remove from AWS:
    npx sst remove --stage production

Commands at a Glance

  • These are the commands you need to use the program.
  • Please learn what each does, before using them.
npm i
aws --version
aws configure
npx sst dev
npx sst deploy --stage production
npx sst remove --stage production

🚀 Deployment Info

When deploying your static site with SST, the process includes:

  • Uploading files to Amazon S3
  • Creating or updating a CloudFront distribution

This full setup generally takes 8–9 minutes. Most of the time is spent waiting for CloudFront to propagate updates globally. No need to worry — this is normal for first-time or updated deployments.

✅ Good Practice

When you are finished testing the live production website, use the remove script. This way there are (probably) no costs on AWS.

✅ After deletion, double-check:

To confirm everything is gone and you're not billed:

  1. Go to S3 Console – make sure the bucket is gone.
  2. Go to CloudFront Console – check for no distributions.
  3. Go to CloudFormation Console – confirm no active stacks.
  4. Check BillingCost Explorer in AWS Console.

License

See LICENSE file.

Links

History

  • 2025-07-09: Documentation and upload to GitHub.
  • 2025-07-08: First working version.

Releases

No releases published

Packages

No packages published