Skip to content

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.

GitHubyour fork · mainpushSourceCodeConnectionsBuildCodeBuild · test + vite buildartifactDeployCodeBuild · s3 syncS3 websitepublic static filesPrivate artifact bucketcodepipeline-<region>-…
A push to main on your fork starts CodePipeline. CodeBuild tests and builds the React app with your API URL baked in, then a second CodeBuild project syncs it to the S3 website bucket.

What happens on every push#

  1. You push a commit to main on your fork.
  2. CodePipeline starts, downloads the commit into the private artifact bucket (Source).
  3. Build (CodeBuild project shortlink-web-build): runs npm ci, the 23 frontend tests, then vite build. The environment variable VITE_API_BASE_URL is set on this project, so your load balancer's address is compiled into the JavaScript. Output: the dist/ folder, plus the deploy buildspec, packaged as BuildArtifact.
  4. DeployWeb (CodeBuild project shortlink-web-deploy): unpacks BuildArtifact and runs aws s3 sync … --delete into your website bucket, then re-uploads index.html with Cache-Control: no-cache.
  5. 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.

Your computerQuick checks
curl -sI <WEB_URL>/ | head -n 1
aws s3 ls s3://<WEB_BUCKET>/ --region ap-south-1

Replace <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#

ResourceName
GitHub connectionshortlink-github (reuse it if you made it in guide 2)
Pipelineshortlink-web-prod
Build projectshortlink-web-build
Deploy projectshortlink-web-deploy
Pipeline artifactBuildArtifact
Website bucket<WEB_BUCKET>

Next: edit the deploy file in your fork.

Found a mistake? Edit this page on GitHub.