Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a domain and a subdomain in AWS?

How to create domain and subdomain in AWS?

like image 219
Madhur Avatar asked Aug 10 '11 10:08

Madhur


People also ask

How do I create my own domain on AWS?

Sign in to the AWS Management Console and open the Amplify console . Choose your app that you want to add a custom domain to. In the navigation pane, choose App Settings, Domain management. On the Domain management page, choose Add domain.

How many subdomains can a domain have in route53?

The limits are not expressed directly in number of subdomains, but rather in number of records and hosted zones, among other things. Therefore, there is 10,000 records per hosted zone, but it can be increased. Also you can have 500 hosted zones per account.


2 Answers

Using Amazon AWS Route 53 & Apache 2.4 web server

Create a Canonical name with wild card to route all the sub domains traffic to the root web server located.

Canonical name

Now add sub domains details along with root domain routings like below.

enter image description here

# ----------------------------------- # GS - Virtual Host Configurations # ----------------------------------- <VirtualHost *:80>     ServerName www.gajen.com     ServerAlias gajen.com     DocumentRoot "/var/www/html" </VirtualHost>   # Stagings # --------  # Discovery <VirtualHost *:80>     ServerName discovery.gajen.com     DocumentRoot "/var/www/html/discovery" </VirtualHost>  # Alpha <VirtualHost *:80>     ServerName alpha.gajen.com     DocumentRoot "/var/www/html/alpha" </VirtualHost> 
like image 158
Gajen Sunthara Avatar answered Sep 24 '22 09:09

Gajen Sunthara


I'm finding the other answers here a little cryptic. Here are the main steps for hosting your domain apex and any other host names for that domain in Route53. This is assuming that you've purchased a domain through GoDaddy, or Network Solutions, or wherever. (And as of mid-2014 you can buy domains directly in Route53):

  1. Create a new zone stub in Amazon's Route53 by going to https://console.aws.amazon.com/route53/home and creating a new hosted zone. That process will propagate an empty zone file with four NS records and one SOA record. Copy the four NS server names. [If you purchase your domain in Route53, this will be done for you automatically and you can skip steps 2 and 3 below.]
  2. At your domain registrar (GoDaddy, eNom, Network Solutions, etc.) edit the DNS hosts for the particular domain and drop the four values from Step 1 into place. Save and let propagate.
  3. Now DNS for your domain is hosted in Amazon's Route53 and will most likely be faster and more robust than it was when hosted by the domain name vendor.
  4. Add more records to your new Route53 zone file, such as a zone apex record (the @ record) or a www record, etc.. Note: Route53 does not permit use of the "@" alias -- you must spell out the domain-name.com. (Be SURE to use the trailing dot after the name!)
  5. One great advantage of using Route53 for your DNS is now, if your site is hosted behind an Amazon ELB address, you can map your zone apex (the @ record) to the alias of that ELB address. Just create an A record with your zone apex ("company.com.") in it, being sure to leave the trailing dot. Then select "Alias" just above the record value and you'll be given choices in the drop-down menu, or you can paste the ELB name in. Or, if your zone apex should point to a simple IP address, select A record and add the IP.

If you run nodes in multiple AWS regions (not just across multiple AZ's) you can also use Route53's "latency based routing," which will direct users to the fastest node given latency at any given moment (it's based on lowest latency, not upon nearest geographic location). Or you can use Route53's healthchecks to set your record values -- e.g. if the healthcheck passes, your A record points to 1.2.3.4, if it fails, the A record points to 5.6.7.8.

EDIT: Another helpful Route53 trick I discovered (by happenstance, though I read later that it's a known/supported feature) is that you can use the A record aliasing to point to ELBs (or buckets, CloudFront distros, etc.) in other AWS accounts. They won't auto-populate in the dropdown list of aliases, but you can just copy+paste them into the "alias target" input.

like image 23
Neal Magee Avatar answered Sep 22 '22 09:09

Neal Magee