Publish a site to AWS Amplify, deploying a snapshot of your content together with the site in snapshot-file mode.
Consider a snapshot as a directory of static content previously pulled from your content sources, which does not update itself.
> yarn gen:snapshotThe snapshot is written to snapshots/latest.
Commit the snapshot together with the site.
> git init
> git remote add origin git@github.com:username/my-sample-site.git
> git add .
> git commit -m "initial commit"
> git push origin mainSwitch to the AWS Amplify console and deploy your app as a SSR application by following the AWS docs.
Add the environment vars to the hosted app via your console
MOSAIC_MODE="snapshot-file"
MOSAIC_SNAPSHOT_DIR="snapshots/latest"Add the following build settings
version: 1
frontend:
phases:
preBuild:
commands:
- yarn install
- env | grep -e MOSAIC >> .env.production
build:
commands:
- yarn run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*Ensure the Node is set to 16
To publish new content, generate a new snapshot, then commit and push it. Amplify rebuilds the site with the new snapshot.
> yarn gen:snapshot
> git add snapshots
> git commit -m "update snapshot"
> git push origin main