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 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 on S3. Note that the bucket name should be the same name as the website, including subdomains. I'm using 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

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 index.html file:

mkdir blog

cd blog

echo "Hello World!" > index.html

I created a Makefile to deploy my website really easily. Create a makefile and add:

    aws s3 sync ../blog s3:// \
        --exclude ".git/*" \
        --exclude ".gitignore" \
        --exclude "Makefile" \

Then deploy it!

make deploy
Comments ()