Before you go, check out these stories!

Hackernoon logoDNS Migration: Forwarding an External Registered Apex Domain to an AWS S3 Bucket by@rubenbelow

DNS Migration: Forwarding an External Registered Apex Domain to an AWS S3 Bucket

Author profile picture

@rubenbelowRubén Below

Your website will be accessible with

. To access it with
do this three extra steps:

  1. Create an certificate with the AWS Certificate Manager for your domain
  2. Create an AWS CloudFront distribution for your "root" S3 bucket. Associate the certificate to it
  3. Point the
    record of your apex domain to the new CloudFront distribution

How to Point a Naked Domain - Not Registered with Route 53 - to an AWS S3 Hosted Static Website

So people can access your website through
instead of

In this post, we're going to connect an apex domain with an AWS S3 hosted website. The naked domain is bought in a domain name registrar other than AWS Route 53. In this case OVH. For other registrars the steps are similar.

Apex domains, generally, cannot make use of

records. Allowed are A or
records, pointing to static IPs. This makes it harder to use our naked domain for our website:
. This is because of the dynamic nature of AWS S3 instances. They expose a subdomain endpoint, so they can route the internal traffic with freedom.

Let's start.

Copy your current zone file

Log in to your OVH account, go to: Domains > DNS zone, and reduce the

(Time to Live). The authoritative name servers cache will expire faster now. This is good because we're going to change the
(Name Server) records.

Now click on: DNS zone > Change in text format, and copy your RRs (Resource Records).

It should look like:

$TTL 3600
@	IN SOA (2019112215 86400 3600 3600000 300)
                          IN NS
                          IN NS
                          IN MX     100
                          IN MX     1
                          IN MX     5
                          IN A      ???
                          IN AAAA   ???
                          IN TXT    "1|"
                      600 IN TXT    "v=spf1 ~all"
_autodiscover._tcp        IN SRV    0 0 443
_imaps._tcp               IN SRV    0 0 993
_submission._tcp          IN SRV    0 0 465
autoconfig                IN CNAME
autodiscover              IN CNAME
ftp                       IN CNAME
imap                      IN CNAME
mail                      IN CNAME
pop3                      IN CNAME
smtp                      IN CNAME
www                       IN CNAME  ???

* Some values are replaced with: ???

In the next step we're going to import our entries in AWS Route 53. Before, let us delete some entries.

Records to delete:

IN A      ???
IN AAAA   ???
www                       IN CNAME  ???

Create an AWS Route 53 Hosted Zone

Log in to your AWS console, go to Route 53, and click on: Create Hosted Zone. As: Domain Name, use the name of your apex domain:

Modify your DNS file SOA record

Before starting with the next step we need to change the

(Start of Authority) record to match the new one.


@	IN SOA (2019112215 86400 3600 3600000 300)

To the

record in your new Hosted Zone.

The entry should be now like:

@	IN SOA 1 7200 900 1209600 86400

Import your DNS file into Route 53

Now that we have a fresh hosted zone we'll import the RRs we exported from OVH.

Do not import the previously deleted

, and

  1. Click on your new Hosted Zone:
    (you'll see a list of RRs)
  2. Click on: Import Zone File
  3. Paste your previously exported
  4. Import your

If you get: "Error parsing zone file: One resource cannot have multiple distinct TTL values". Delete the mismatching

from the zone file.


600 IN TXT    "v=spf1 ~all"


IN TXT    "v=spf1 ~all"

Add an ALIAS record

So far, so good.

Now we add an

record for the naked domain;
pointing to our AWS S3 bucket.

It should be like this but with an S3 bucket URL instead of a CloudFront URL

Do the same now with an


Add a CNAME record

Add a

record for your
subdomain pointing to your apex domain:

It should be like this

Get your new NS entries

Get the values of your

entry. We're going to use them at OVH in the next step.

They should be like:

Add your new AWS NS values to your domains registrar

In your OVH account go to: DNS servers

  1. Delete the old OVH
  2. Add your new AWS

Good to go.


The changes will take some time to propagate (sometimes up to 24h). We can check the state of the DNS (Domain Name Server) update on:

If the DNS update is done but you cannot access
through your computer, it could be that your ISP (Internet Service Provider) still did not update their RR cache. In this case, you should be able to access your website through a VPN.

Thanks for learning with this tutorial.

Follow me on GitHub.

If for some casual the indications did not work for you; don't mind to drop me a line with the infringing points. I'll update the post correspondingly.


More Posts


The Noonification banner

Subscribe to get your daily round-up of top tech stories!