1
votes

I'm creating serverless application in nodejs env using aws lambda. I need to add custom domain in API Gateway. Domain (lets say example.com) is registered with domain.com and hosted with other company. Parent domain (example.com) is working fine with other hosting company. Now I want to add its subdomain (api.example.com) in route 53 (aws)

  1. I've created Hosted Zone in Route 53 with name example.com (Parent domain)
  2. NS and SOA records are created automatically.
  3. Cname api.example.com in route 53 points to cloudfront url
  4. In domain.com i've added cname for api.example.com that point to cloudfront url

I know dns can take upto 48 hours to resolve. I've also seen WHM , cname can also be added there but i didn't touch there.

please help.


Update #1

I've done as deceze described in the answer section. below are the screenshots

screenshot of NS-Record entered in my Parent Domain Registrar

Subdomain route53 screenshot

I have some doubts on this nameserver section (in my parent domain registrar) , may be it has some effect on NS-record as the default nameservers not used.

its has been around 20 hours , still not worked. Any Suggestions.

1
What does domain.com have to do with example.com? Nothing, as far as I can tell. You need to point the NS record of example.com to the AWS DNS servers at your registrar.deceze♦
domain.com is a registrar of example.comdanish
So, example.com already exists and is registered at ExampleNIC and there are existing DNS server for example.com? And you can edit records in that existing DNS record and are trying to set up api.example.com as a new subdomain with its own DNS servers, yes?deceze♦
example.com already exists and is registered at ExampleNIC - YES there are existing DNS server for example.com - YES And you can edit records in that existing DNS record - YES trying to set up api.example.com as a new subdomain with its own DNS servers - MAY BEdanish
Well, either you manage api.example.com using the existing nameserver records, or you manage api.example.com as a delegated subzone using different nameservers. Your choice.deceze♦

1 Answers

1
votes

The authorative nameserver for example.com needs to delegate authority for api.example.com to the AWS nameservers. Which means, NS records for api.example.com containing the authoritive AWS nameservers for api.example.com need to be in the record of example.com.

  • create the zone api.example.com in Route 53
  • set its A record to point to your CloudFront distribution

Now you have a bunch of nameservers which are the authority for api.example.com. Now you just need to officially delegate authority for that subzone:

  • create NS records for api.example.com pointing at your AWS nameservers in the existing example.com records

The lookup works like this from a client's perspective:

  1. rootnameserver, where's api.example.com?
    NS for com is 1.2.3.4
  2. 1.2.3.4, where is api.example.com?
    NS for example.com is 2.3.4.5 (your existing DNS server)
  3. 2.3.4.5, where is api.example.com?
    NS for api.example.com is 3.4.5.6 (this is the delegation)
  4. 3.4.5.6, where is api.example.com?
    A for api.example.com is 4.5.6.7 (this is your Route 53 record)