This site uses the below tools for its core functionality

  • Hover for for domain registration
  • AWS
    • CloudFront for HTTPS/Hosting
    • S3 for object storage
    • Certificate Manager for SSL
    • Route 53 for DNS
  • Zoho for email

What this will cover

  • Registering a domain
  • Setting up the MX and DMARC records
  • Creating an s3 bucket to host files over HTTP
  • Using the AWS cli to upload files to s3
  • Setting up CloudFront for CDN and HTTPS
  • Setting up route 53 for DNS

Registering the domain

Any domain registrar will do, I used Hover because I’m falimilar with it

  1. Go to Hover
  2. Search for the domain you want register
  3. Add to cart, follow instructions, checkout

Setting up MX Records and DMARC

  1. Register with Zoho
  2. I originally used Hover to manage DNS records, but switched to Route 53 as it supports aliases for A records. Aliases are needed for CloudFront
  3. Setup AWS Route 53
    • Create hosted zone on route 53 dashboard (this costs about $0.50 a month)
    • Add the below associated records for mail
    • Add the Route 53 name servers to your registrar, to use Route 53 as your DNS provider
Record Name Record Type Value
samuelspry.dev MX 10 mx.zoho.com
samuelspry.dev MX 20 mx.zoho.com
samuelspry.dev MX 50 mx.zoho.com
samuelspry.dev TXT “v=spf1 include:zoho.com ~all”
_dmarc.samuelspry.dev TXT “v=DMARC1;p=reject;rua=mailto:admin@samuelspry.dev”
zoho._domainkey.samuelspry.dev TXT “key you get from mail provider for dkim

Putting files in s3

Instaling the AWS cli

I followed the instructions here for installing the cli on linux

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

This will install the latest version of the CLI. I followed the instructions here to create my access key

Once you have your access key you can configure it like so, you’ll be prompted to enter your key id and value.

aws configure
# Note the below is from the above 'aws configure' command output
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-west-2
Default output format [None]: json

Creating an s3 bucket

  1. Navigate to the s3 console
  2. Click the Create Bucket button
  3. Choose a name
  4. Uncheck block all public access
    • Note this is in general not a great idea. Ideally you want to limit access to CloudFront, and cloud front only.

After you create the bucket, you’ll want to configure it to serve content over http.

  1. Click on the bucket name you created
  2. Click the properties tab
  3. Scroll to the buttom and select ‘Static website hosting’
  4. Check ‘enable’
  5. Save changes

Uploading files

Uploading files can be done using the webconsole (great if you just need to upload a few files) or through the cli.

To upload a file using the web ui, go to the bucket and then click ‘Upload’

To upload a file using the cli you can use:

aws s3 cp [local_file] [remote_bucket_name]
#example command
aws s3 cp index.html s3://your-bucket-name-here/

Creating certificates

You can create auto-renewing certificates with AWS for free

  1. Request a certificate for the domain you registered
    • You’ll probably want to request *.example.com as you’ll get a certificate for all your subdomains. And its free.
  2. Answer the other questions AWS asks you.
  3. Go to Route 53 and and add the CNAME record AWS gave you.
    • You’ll want to leave the CNAME record in your DNS, AWS uses this record to verify you still control the domain and will auto-renew your cert if this record still exists.

Setting up CloudFront to serve static content over https

  1. Create a Cloud Front distribution on the Cloud Front AWS console page
  2. Select the ssl certificate you created in the previous step.
  3. Select Alternate Domain Names (CNAMEs) you want for the domain
    • I have samuelspry.dev and www.samuelspry.dev for this site
    • Note your certificate has to be valid for all of the Alternate Domain Names you choose
  4. Set the root object of the distribution (your index.html, but it doesn’t have to be called index.html)
  5. Set the Domain Name of the distribution.
    • This is the url that cloud front will act as a CDN for. Its the HTTP url you setup in the S3 bucket from before