Deploy the Pitfal Solutions website to AWS. Use when user says deploy, push to production, or update live site. Runs pre-checks, builds Next.js, deploys Terraform infrastructure, syncs to S3, and invalidates CloudFront cache.
Deploy the Pitfal Solutions website following this sequence:
pnpm testpnpm type-checkgit statuspnpm buildout/ directory was createdcd infrastructure/terraformterraform initterraform plan -out=tfplanterraform apply tfplanaws s3 sync out/ s3://pitfal-static-site \
--delete \
--cache-control "public, max-age=31536000, immutable" \
--exclude "*.html" \
--profile pitfal
aws s3 sync out/ s3://pitfal-static-site \
--cache-control "public, max-age=0, must-revalidate" \
--include "*.html" \
--profile pitfal
Get CloudFront Distribution ID (if not already known):
# Option 1: From Terraform output
cd infrastructure/terraform && terraform output cloudfront_distribution_id
# Option 2: From AWS CLI (finds distribution for pitfal.solutions)
aws cloudfront list-distributions --profile pitfal \
--query "DistributionList.Items[?contains(Aliases.Items, 'pitfal.solutions')].Id" \
--output text
# Option 3: Export as environment variable for reuse
export DISTRIBUTION_ID=$(terraform -chdir=infrastructure/terraform output -raw cloudfront_distribution_id)
Invalidate CloudFront cache:
aws cloudfront create-invalidation \
--distribution-id $DISTRIBUTION_ID \
--paths "/*" \
--profile pitfal \
--no-cli-pager
Note: Cache invalidation takes 1-5 minutes to propagate globally.
Verify site is accessible at https://pitfal.solutions
Run smoke tests if available
If deployment fails:
terraform state list