Site deployment to S3 and SSL
Previous Hosting and Deployment
Previously, the website was hosted using GitHub Pages, a free static website hosting provided by GitHub. Once Pages is configured, the updated site can be deployed by pushing it to GitHub with
The old website used the Jekyll static site generator. As Jekyll is written by GitHub, GitHub Pages also natively supports Jekyll sites, running the build step for you.
S3 Website Hosting
AWS S3 can be configured to host static websites. As the Jekyll build process produces a static website, this static site can be hosted on S3. This requires an extra build step; with GitHub Pages the Jekyll build was managed by GitHub, on S3 it needs to be run manually. The website is deployed by uploading it to S3.
These two steps can be automated using the following
build: # Create the static and store it in _site/ jekyll build deploy-prod: build # Deploy the production website to S3 aws s3 sync _site s3://jamesroutley.co.uk --delete
A development environment was set up at dev.jamesroutley.co.uk.
S3 static websites are assigned a URL, such as http://jamesroutley.co.uk.s3-website-eu-west-1.amazonaws.com/. To access the website from a custom domain name, a Route53 Alias Record pointing the custom domain name to the S3 bucket should be created.
While S3 can be used to host static websites, it doesn’t natively support SSL. To set it up, a CloudFront distribution must be created. CloudFront is AWS’s content delivery network (CDN), a geographically distributed network of servers used to deliver web content. CDNs are usually used to speed up web response times and reduce server load. CloudFront is used in this case because it supports SSL. To set it up, this guide can be followed. A free SSL certificate was obtained from AWS Certificate Manager.