Deploy Static Site to AWS on Commit

This is a quick cheat sheet for the steps involved to create a manual pipeline to deploy a static site with CDN and HTTPS to AWS automatically on commit, the simple solution nowadays is to use [Amazon’s Amplify] ( but that wasn’t around back when I had to do this, but you might also need it if you have some non standard build requirements.


  • add buildspec.yaml to project


  • create repository
  • add repo as remote to local git repo
  • push changes to remote repo


  • create bucket
  • make public
  • enable static website hosting


  • add build project
  • use ubuntu with base or whatever needed for project type e.g. Node
  • use latest runtime and image
  • use buildspec file
  • no artifacts
  • automaticaly create service role (use this to attach to policies later)


  • add CodeCommit source stage
  • add CodeBuild build stage
  • skip deploy stage


  • create web distribution
  • origin domain name is s3 bucket - do not use the one from dropdown should be in the format
  • add alternate domain name
  • custom ssl import with ACM
  • Viewer Protocol Policy - redirect HTTP to HTTPS

ACM - AWS Certificate Manager

  • add full domain name
  • DNS validation
  • Create record in Route 53


  • Create Policy For S3 Write Acccess
  • Create Policy For Cloudfront
  • Add CodeBuild service role to policies

Route 53

  • A Record Alias pointing at Cloudfront distribution URL
comments powered by Disqus