This is a template for running a SvelteKit node on EC2 behind CloudFront.
sam build
sam deploy --stack-name NAME --guided || sam deploy --stack-name NAME --guided --config-env prod
sam delete --stack-name NAME
npm ci --prod
npm run build
aws s3 sync ./build s3://BUCKET-NAME/build --delete
aws s3 sync ./node_modules s3://BUCKET-NAME/node_modules --delete
aws s3 cp ./package.json s3://BUCKET-NAME/package.json
aws autoscaling start-instance-refresh --auto-scaling-group-name NAME
sudo nano /var/log/cloud-init-output.log