Overview and prerequisites
How a push to your fork becomes a new website on S3, and what must already exist.
About 10 min · Verified 8 October 2026
In guide 1 you built the website on your laptop and uploaded it with aws s3 sync. Here AWS does that for you: every push to main on your fork is tested, built with the correct API address baked in, and synced to your S3 website bucket.
What happens on every push#
- You push a commit to
mainon your fork. - CodePipeline starts, downloads the commit into the private artifact bucket (Source).
- Build (CodeBuild project
shortlink-web-build): runsnpm ci, the 23 frontend tests, thenvite build. The environment variableVITE_API_BASE_URLis set on this project, so your load balancer's address is compiled into the JavaScript. Output: thedist/folder, plus the deploy buildspec, packaged asBuildArtifact. - DeployWeb (CodeBuild project
shortlink-web-deploy): unpacksBuildArtifactand runsaws s3 sync … --deleteinto your website bucket, then re-uploadsindex.htmlwithCache-Control: no-cache. - Visitors get the new site on their next load. There is no server and no downtime.
The one thing that is different from the backend#
The deploy step needs your bucket name, and the file that does the syncing lives in the repository. That is where a fork matters most.
Before you begin#
You need the deployment from guide 1, at least chapters 1 to 11.
curl -sI <WEB_URL>/ | head -n 1
aws s3 ls s3://<WEB_BUCKET>/ --region ap-south-1Replace <WEB_URL> <WEB_BUCKET> with your own value (or fill in the known ones once under My values at the top of the page).
You should see
HTTP/1.1 200 OK, and a listing with index.html and an assets/ folder at the top level.Names used in this guide#
| Resource | Name |
|---|---|
| GitHub connection | shortlink-github (reuse it if you made it in guide 2) |
| Pipeline | shortlink-web-prod |
| Build project | shortlink-web-build |
| Deploy project | shortlink-web-deploy |
| Pipeline artifact | BuildArtifact |
| Website bucket | <WEB_BUCKET> |
Found a mistake? Edit this page on GitHub.