大网数据广告活动
服务器运维问答

Add sub domain in AWS Route 53

· 52CE 我爱测

My domain is example.com I want to add sub domain like subdomain.example.com My domain register in godaddy. I created Hosted Zone in aws route 53 and changed DNS in godaddy. example.com working as I want. Now I want to add a sub …

问题原文

原帖链接 · Hüseyin KÜÇÜK · CC BY-SA 4.0

My domain is example.com

I want to add sub domain like subdomain.example.com

My domain register in godaddy. I created Hosted Zone in aws route 53 and changed DNS in godaddy. example.com working as I want.

Now I want to add a sub domain in this domain, but I can't get it to work.

I tried first this (site link):

Login to your AWS console.

Click here to go to AWS route53 console. From the left bar click Hosted zones.

From the top bar click Create Hosted Zone.

In the right pane, put subdomain.maindomain.com as the domain name and click Create.

Copy the name servers for this domain for further use.

Now go to the records set for your main domain and click Create Record Set.

In the right pane, put subdomain. in the Name section, choose Type as NS and for Value put the previously copied name servers and then click Create.

But this didn't work.

Then I tried this.

So in that case create a CNAME record where example.com will be canonical name and client.example.com will be alias record.

Once this is done now example.com and client.example.com will both resolve to the same IP address i.e. to the Load balancer.

But still didn't work.

How can I do this?

已采纳解答

原帖链接 · MLu · CC BY-SA 4.0

The key trick in setting up a subdomain is linking the subdomain with the parent domain through a set of name servers - NS records. I.e. the subdomain.example.com is known to its set of nameservers (NS records) and the parent domain example.com must know what these NS are for the subdomain. Just like in GoDaddy where you set the example.com's Route53 NS that are then inserted into the .com zone as a link to your domain. Makes sense?

This is how you create a subdomain in Route53:

  1. Create new Hosted Zone subdomain.example.com in Route53 and copy the set of **NS records* to a clipboard or Notepad or somewhere:

    (I'm using my domain aws.nz for this demo - example.com subdomain can't be created in R53)

  2. The open example.com hosted zone details (or aws.nz in this case) and click Create Record Set. Set:

    • Name: subdomain.example.com
    • Type: NS
    • Value: the list of nameservers from step 1 above.

  3. Create some record in subdomain, e.g. test.subdomain.example.com=192.0.2.123, wait a minute and try to resolve it:

    ~ $ host test.subdomain.aws.nz
    test.subdomain.aws.nz has address 192.0.2.123
    

Hope that helps :)

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-10-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。