How to create domain and subdoma开发者_JAVA百科in in AWS?
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.
Now add sub domains details along with root domain routings like below.
# -----------------------------------
# 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>
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):
- 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.]
- 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.
- 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.
- 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!)
- 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.
You do not 'create' a domain or subdomain in AWS. A domain is created at the registrar level - GoDaddy, Network Solutions, VeriSign, etc. while a subdomain is created in DNS.
If you are referring to how you can create a web server to respond to mydomain.com and/or subdomain.mydomain.com then you will need to alter the mydomain.com DNS records to point to the IP address of your Amazon EC2 instance.
First, launch the EC2 AMI you intend to use as the web server. You will then need to allocate an Elastic IP address using the AWS console and assign it to the web server instance. Make a note of what the Elastic IP is. Now go to your registrar's domain control panel, and add/change the IP address of the A or CNAME records named 'www' and '@' to match the Elastic IP you assigned to the web server instance. Now create a new CNAME record for your subdomain and point it to '@'. Save your changes.
If your web server instance is running Apache, you will now have to configure Name Based Virtual Hosting - plenty of tutorials out on the web for this. If you are running IIS, you will have to assign host headers to your sites. Again, there are plenty of tutorials for that as well. Google is your friend.
Hope this helps.
Though this question is already answered and is years old, I just went through this process this week. I thought it be helpful to have screenshots of what I did to create a domain and subdomain in AWS.
To create Domain:
- Go to AWS Route 53.
- Check for domain name availability
- If its available, click add to cart, then continue.
- The following page add your information then click continue.
- Then on the next page, select Complete Order.
- Domain name has been created now.
To create sub domain.
- Go to AWS Route 53.
- Click on Hosted Zones.
- Click on your domain name
- Click on "Create Record Set".
- On the "Create Record Set" panel on the right, enter the sub domain. Can leave the type entry with the default value. IF you already have an EC2 instance, then select "yes" for Alias. Then in the Alias Target text field, find your EC2 instance.
- Click "create".
- Sub domain is now created.
You don't transfer your domain name to AWS. Rather allocate an Elastic IP address and the associate it to your instance. Then go to your domain provider and point your domain to the Elastic IP address. You don't need to transfer your domain to AWS. You can do this from the AWS management console.
In this way, you can start a second instance and test any application updates, then just move the Elastic IP to the second instance without having to make any changes with your domain provider
http://www.youtube.com/watch?v=c8yuGvnU3A0
AWS Route 53 can (as of 2016) allow you to register a domain via the https://console.aws.amazon.com/route53/home#DomainListing: page. I understand that it actually uses a third party to handle the registration, but you don't need to know that.
Once you have a domain, you can use Hosted Zones to connect to resources. I recall that the registration process above will automatically create a Hosted Zone for your domain name.
To link the domain to a resource, you need to go into that hosted zone and create an "A" Record Set. The interface is pretty self-explanatory.
If you want a subdomain, create another "A" record set in the same Hosted Zone: you have an option to set a prefix on the domain name each time, and of course to link to a different resource.
The https://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html tutorial is a bit heavy on jargon for the beginner, but covers the above points.
Step 1 - For Domain a) Create a Hosted Zone. b) Update the NS and SOA records in domain name provider c) let the domain propagate.24-48hrs
Step 2 - For SubDomain a) Create CNAME record in the above hosted zone for example subdomain b) Point to the address for example website bucket https//bucket_in_S3
Your subdomain is ready and working with immediate effect.
It will be very important for you to design your solution with DNS in mind. Check out their Route 53 product. It's a programmable interface into DNS which also has a low time to propagate. This will be important if you need to make changes. You should be able to tell your registrar to point to Route 53.
I also highly recommend you put all of your servers behind the Elastic Load Balancer (ELB) server and point whatever DNS service you have to it. This will reduce any down time you might have when moving servers and upgrading.
After you create the domain settup in Route 53, just add the alias or CNAME like you do for www.yourdomain.com
here A-Record is yourdomain.com Cname is www.yourdomain.com
and so as your subdomain like
sub.yourdomain.com
the proccess is not hard just technical,
if you want more to learn on this , i will gladly do ,
AWS ROCKS
Creating Domain name or subdomain name is not possible with AWS, You have to create it from the domain registrar and then point them to AWS Route 53 service - which maps you domain names to Ip's along with dedicated Name server for every hostzone.
Therefore the point is first create domain or subdomains from a third party domain registrar, and use AWS route 53 service for the rest Process.
精彩评论