Deploying a Static Site

Deploy a Hugo, Next.js, or Vite site with CloudFront and S3.

Static sites are deployed using the static-website module — S3 for storage, CloudFront for global CDN, and automatic HTTPS via ACM certificates.

Prerequisites

  • SharedServices account with an artifact bucket provisioned
  • Workload account linked and validated
  • DNS configured (service discovery zone + certificate)
  • A GitHub repository with your static site code and a build script

Step 1: Create the Application

  • Deployment Type: S3 Artifact
  • Tech Stack: Hugo, Vite, Next.js, Gatsby, etc.
  • Build Script: Path to your build script (e.g., scripts/build.sh)
  • Build Output Directory: Where build artifacts land (default: dist)

Step 2: Scaffold the Application Repository

Scaffolding creates a build.yml workflow that:

  1. Runs your build script (or npm ci && npm run build)
  2. Packages the output as a zip
  3. Uploads to the SharedServices artifact bucket
  4. Notifies Opsitron of the new artifact

Step 3: Deploy Infrastructure

Create a Module Deploy request for your app and environment. The AI agent deploys the static-website module which creates:

  • S3 bucket for website content
  • CloudFront distribution with custom domain
  • Origin Access Control for secure S3 access
  • DNS A record pointing to CloudFront
  • SSM parameters for deploy workflow discovery

Step 4: Push Code

Push to main. The build workflow uploads your artifact. Opsitron auto-deploys:

  1. Downloads the artifact zip from SharedServices
  2. Syncs to the website S3 bucket (immutable assets get long cache, HTML/JSON get no-cache)
  3. Invalidates CloudFront
  4. Waits for invalidation to complete

Your site is live with HTTPS, global CDN, and automatic cache invalidation on every deploy.

Cost

A static site on Opsitron costs very little:

ResourceMonthly Cost
S3 Standard~$0.023/GB
CloudFront (PriceClass_100)~$0 + $0.085/GB transfer
ACM CertificateFree
Route53 Zone$0.50/zone
Typical dev site< $1/month