Point branch deploy to subdomain on Route53

We host our site on Netlify with Netlify Edge and use Route53 to manage our DNS.

  • Our Netlify app: example.netlify.app
  • Our domain: example.com

We managed to point correctly our main domain to the production Netlify app build by creating 2 records in Route53:

  • A: example.com point to
  • CNAME: www.example.com point to example.netlifyglobalcdn.com

Now, everything works fine at this point. In our set up, we don’t use Netlify auto-build, but create a build from Bitrise and deploy via Netlify CLI instead.

We have 3 environments: dev, staging and production. While production is in example.com, we cannot manage to point dev.example.com to 1http://dev–example.netlify.app` with CNAME in Route53. Been looking all over the places for a solution but found nothing atm.

I have tried:

  • A: dev.example.com point to
  • CNAME: www.dev.example.com point to dev--example.netlifyglobalcdn.com

I have tried

None works.

The only solution is using Netlify DNS, but we use Route53. The only solution I could think of now is to create 2 extra apps in Netlify, 1 for staging and 1 for dev, and point to the production build of these apps from Route53, but that is a nasty solution.

This is a crucial feature for us because we need to serve multiple environments for our domains for deep-linking. So any help is highly appreciated :slight_smile:

By the way, I don’t know where I found the netlifyglobalcdn link and the load balancer IP to add in the record for Lambda Edge to work, but I can’t find that again. Maybe we should add it into the documentation.

Resources I have tried

Custom subdomain for branch deploy (edited)

Hi, @turbothinh. Much of this will depend on details about the site and the custom domain. Does the custom domain use third-party DNS or Netlify DNS.

If you are using Route 53, then the branch subdomain support guide you linked to applies:

One of the requirements is that the branch subdomain must exactly match the branch name. Another requirement is that the subdomain must be under the primary custom domain. If the primary domain for the site is www.example.com then the staging subdomain would need to be staging.www.example.com and not staging.example.com.

Would you please confirm the real site and branch subdomain being used?

You can private message (PM) that to one of our support staff and I’ve confirmed that PMs are enabled for your community login. Note, that only one person can see the PM and this will likely mean a slower reply than posting the information publicly. Please feel free to reply to however you prefer though.

Hi Luke, thank you for your reply. As you suggested, using the exact branch name as a subdomain of the primary domain fixes the problem. Another requirement for it to work is to request the Netlify support team to add these subdomains to the Let’s Encrypt certificate. By doing the 2 things above, I was able to set up subdomains for these branch builds.

1 Like