| 1 | # AWS Static Site Example |
| 2 | |
| 3 | This example deploys a static website from the local `site/` directory using: |
| 4 | |
| 5 | - `AWS.Website.StaticSite` |
| 6 | - private S3 origin |
| 7 | - CloudFront distribution |
| 8 | - optional ACM certificate in `us-east-1` |
| 9 | - optional Route 53 alias records |
| 10 | |
| 11 | ## Commands |
| 12 | |
| 13 | ```sh |
| 14 | bun install |
| 15 | bun run --filter aws-static-site-example deploy |
| 16 | ``` |
| 17 | |
| 18 | ## Optional Custom Domain |
| 19 | |
| 20 | Set these environment variables before deploy: |
| 21 | |
| 22 | ```sh |
| 23 | export WEBSITE_DOMAIN=www.example.com |
| 24 | export WEBSITE_ZONE_ID=Z1234567890 |
| 25 | export WEBSITE_ALIASES=example.com,static.example.com |
| 26 | ``` |
| 27 | |
| 28 | When `WEBSITE_DOMAIN` and `WEBSITE_ZONE_ID` are provided, the example will: |
| 29 | |
| 30 | - request an ACM certificate |
| 31 | - create Route 53 validation records |
| 32 | - create Route 53 alias records to CloudFront |
| 33 | |
| 34 | Without them, the example still deploys and returns the CloudFront URL. |