Hosting a Secure Website on AWS
I recently wanted to cut down on the number of EC2 instances I was using and use TLS to make sure everything I write on this blog is served with HTTPS. Having TLS (that's https) was important not because I have confidential information but because I want to ensure authenticity. When you go to blog.seanssmith.com you are guaranteed that I wrote the posts here.
My initial plan was to host on S3, distribute files out of Cloudfront, and get a free certificate from letsencrypt. I decided to use Amazon Certificate Manager to get free certs instead of letsencrypt. Everything else is the same.
Setting it all up:
I created a bucket called
blog.seanssmith.com on S3. Note that the bucket name should be the same name as the website, including subdomains. I'm using blog.seanssmith.com but you should change that to your domain
This can be easily done with the AWS cli. You'll need to have the AWS cli and be authenticated for this to work, if you're not see this.
aws s3 mb blog.seanssmith.com
aws s3 ls
The ls works similar to
ls on bash and you should see the bucket you just created listed.
Next create a folder on your local machine (I called mine blog), and add an
echo "Hello World!" > index.html
I created a Makefile to deploy my website really easily. Create a makefile and add:
deploy: aws s3 sync ../blog s3://blog.seanssmith.com \ --exclude ".git/*" \ --exclude ".gitignore" \ --exclude "Makefile" \ --delete
Then deploy it!