Deploy VitePress on AWS

Deploy your VitePress documentation sites to AWS using Thunder patterns. This guide covers static site deployment using S3 and CloudFront.

VitePress sites are deployed using the Static construct, which provides optimized static hosting with CDN distribution.

Static Deployment


Deploy VitePress sites to S3 and CloudFront using the Static construct.

Create Project

Terminal window
npm create vitepress@latest my-vitepress-site
cd my-vitepress-site
npm install

Install Dependencies and Setup Stack

Terminal window
npm i tsx @thunder-so/thunder --save-dev
stack/index.ts
import { Cdk, Static, type StaticProps } from "@thunder-so/thunder";
const myApp: StaticProps = {
env: {
account: 'your-account-id',
region: 'us-east-1'
},
application: 'your-application-id',
service: 'your-service-id',
environment: 'production',
rootDir: '', // e.g. 'frontend' for monorepos
outputDir: 'docs/.vitepress/dist',
};
new Static(
new Cdk.App(),
`${myApp.application}-${myApp.service}-${myApp.environment}-stack`,
myApp
);

Deploy

Build and deploy your VitePress site:

Terminal window
npm run docs:build
npx cdk deploy --all --app="npx tsx stack/index.ts"

After deployment, you’ll receive a CloudFront URL to access your documentation site.