my picture

Building a code pipeline and website with AWS

Everyone's talking DevOps, continuous delivery and continuous integration, so I thought it would be a good exercise to leverage my new found skills on AWS to build and deploy a static site using a modern pipeline, VSCode and GitHub while supporting encryption on the website.

Let’s get to it. Base assumptions you have an AWS Free Tier account, you love to learn and not afraid to leverage the web for help. I’m sure I’ve probably missed one or two key configurations along the way.

Create the domain
Outside of the free tiering, Amazon charges $12.00 a year for registering a new domain name and $0.50 a month for supporting the hosting of that domain. If you are not actively using your domain, make sure you clean up so you are not charged month over month.

AWS Domain Registering
AWS Create Hosted Zone

Use S3 for Web Site Hosting
The easiest and cheapest way to demonstrate the code pipeline is to create a couple of S3 buckets with the same name as the domain name created above like and will have one file ‘index.html’ and will be configured to redirect traffic beginning with www to the hosted site.

The link below (and subsequent links) will provide the details to create the S3 buckets, the correct policy for website use and the Route 53 configuration to redirect the custom domain name above to the S3 bucket.

Creating a static website with S3

Next I decided to leverage my existing GitHub account and created a brand new repository for my single ‘index.html’ file. That way I could make changes and have a free place to manage source control. Probably I don’t want to get into all the details of creating a GitHub account here or using VSCode, but the really cool part of leveraging Git was the ability to integrate VSCode, GitHub and AWS CodePipeLine to deploy changes made to ‘index.html’ immediately to

This article from Sithum on Medium was simple to understand and execute.

Automating code deployment to S3 with GitHub

To pull in a git repository, use the Git Clone option in the VS Code command palette.

Use HTTPS for all traffic on the Website
To force HTTPS for all traffic to the website we need to do enable additional services and finish with a couple of other configurations.

Firstly, create the SSL Certificate. This uses AWS Certificate Manager

Create an ACM

Secondly, create a CloudFront Distribution

To use HTTPS with S3 we have to use CloudFront distribution, since there’s a capability available to redirect all traffic from HTTP to HTTPS.

There is a cost associated with this so if you are in the free-tier select use only US, Canada and Europe for the distribution. If you only have a couple of files the cost will be minimal.

As of the time of writing – in the tutorial below, there is one change. For the SSL certificate – use the certificate you created in the last section not the default cert.

Create the distribution

Once the deployment has occurred, it takes about 15 minutes, you will see a URL similar to this in the CloudFront Dashboard. Make sure the URL and content work by copying the URL to a browser and including the /index.html at the end.

Update the Hosted Zone with CloudFront distribution
The final step. Update the Route 53 Record set to the CloudFront distribution created above. Replace the original alias created with the S3 bucket target with the URL for the CloudFront distribution