简体   繁体   中英

How to add subdomain on another ec2 instance AWS in Cloudflare?

I am hosting my main site on ec2 let's say instance1, my domain is from go daddy so i put cloudflare nameserver on go daddy. now i have another installation on ec2 let's say instance 2 and it is a subdomain. instance 1 and 2 have different IP's how can i point my subdomain to instance 2? which records should i change in AWS and in cloudflare to achieve this?

My Cloudflare DNS added in Godaddy

NS  lisa.ns.cloudflare.com
NS  sid.ns.cloudflare.com

DNS setting in Cloudflare account

 Type           Name           Value                                   TTL        
    A        mydomainname.com     points to 13.232.XXX.XXX          Automatic       
    CNAME    test                 is an alias of mydomainname.com    Automatic      
    CNAME    www                  is an alias of mydomainname.com    Automatic      
    TXT      mydomainname.com     ca3-b78797cee2b346558bf7a891ff5bd5daXX Automatic

You don't need to change any records in AWS, since you using Cloudflare as your DNS service.
Cloudflare gives you ability to modify DNS zone settings, add A, CNAME and other records.

Just obtain public IP for instance-2 from AWS console, login to Cloudflare, open you domain DNS zone editor and add A record with name of your subdomain pointing to IP of a second instance.

UPDATE: in your cloudflare configuration it should look like:

Type           Name           Value                                   TTL        
    A        mydomainname.com     points to 13.232.XXX.XXX          Automatic
    A        subdomain            points to 123.123.123.123          Automatic       
    CNAME    test                 is an alias of mydomainname.com    Automatic      
    CNAME    www                  is an alias of mydomainname.com    Automatic      
    TXT      mydomainname.com     ca3-b78797cee2b346558bf7a891ff5bd5daXX Automatic

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM