Is it possible to create an Alias record in Route 53 to a resource in another AWS account?
Use Case:
I have 2 AWS accounts. My domain is configured with a hosted zone in account A and I have an ELB in account B. I want to create a record to my ELB in account B for my domain's zone apex - which has to be configured in account A.
Does anyone know how I can get around this? I know I can go through billing support to have the domain transferred to account B but I would prefer not to do this. Also, it is not viable for me to migrate the resources from account B to account A.
So I've found the solution. You can in fact create an Alias record to a resource in another account.
The answer is in the documentation although it's description is a little vague in my opinion. See here under the ELB heading.
If you used different accounts to create your Amazon Route 53 hosted zone and your load balancer – Enter the value that you got in the procedure Getting the DNS Name for an ELB Load Balancer.
As a result, here's what I did:
Copied my ELB DNS name from account B
In account A, I created an Alias record for my zone apex (type: IPv4) and I simply pasted in the DNS name into the text field.
I saved the record and it worked straight away.
After you paste in your ELB's DNS name, you'll notice that the Alias Hosted Zone ID matches the Hosted Zone ID in your ELB's description tab.
I can confirm this is still working, it's just the docs and UX of the portal are terrible.
I wanted to create a CNAME to an ALB at the apex (root) of my hosted zone; this isn't allowed so using an Alias A record instead. My ALB is in a different account, so the UI makes you think you can't do it... but you can.
You can create an Alias record to an ALB/ELB in another account by just pasting into the 'Route traffic to' box. Choose the region, then just dump the address into the box. Now this UI element makes you think it's a normal picklist and you can only pick from valid values... but it is secretly also a textbox allowing you to enter arbitrary text. Great UX guys 👏🏼
So enter your address and just click 'Create records'.
Now AWS updated the Alias records info and it is much more clear, basically you add the DNS entry for the resource in the alias field.
https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-values-alias.html
For those who're looking for why it doesn't work after you followed the procedure:
that is probably that you have another domain in the other account, in this case, don't forget to add a listener rule to the target ELB.
Related
Per this earlier post, I was able to verify a domain of ours (which is in Route 53) to use as a custom domain with GCPs Cloud Run. However, we are struggling to update the DNS records for this domain now.
Our domain mydomain.com was previously used with an AWS EC2 instance. Our hosted zone in Route 53 for this domain currently has 8 records, of various record types (A, MX, NS, SOA, TXT, CNAME). Before uploading the 8 DNS records for cloud run (GCP gave us 4 A DNS records with ip addresses, and 4 AAAA DNS records with ip addresses, to upload), should I first delete all of the previous records in the hosted zone for this domain? I presume these earlier records are associated with our previous use of the domain with the ec2 instance.
Is it safe to delete all of the previous records from the hosted zone? Or maybe it is better to create a new hosted zone to use with GCP cloud run, and keep this initial hosted zone to remain with the EC2 instance? I am not sure if it is possible to have 2 hosted zones for 1 domain, or not. If only 1 zone is possible, I am not sure if i should delete + re-create a new hosted zone to use with Cloud Run, or try to edit my initial hosted zone (by deleting the old DNS records). I just need to move this custom domain from the EC2 instance to the cloud run app.
Thanks!
EDIT BEFORE BOUNTY: here are the DNS records that Cloud Run is telling me to add to my domain host (true values and domain name changed):
... and here is my Hosted Zone for the domain:
...the top 2 records are the new A and AAAA records that Cloud Run has given me (there was previously 2 A records that I deleted). When trying to create the A records, I actually received an error when I tried to create 4 separate A records, so I've put all 4 IP addresses into a single A record (not sure if this is correct).
Unfortunately, in the GCP /run/domains page, I am still receiving this error / warning message:
I do not plan to use the old AWS EC2 instance with this domain again, so perhaps I should delete all of the old DNS records that are associated with it? However I am not sure which records are safe to remove and which are not... Perhaps creating a new hosted zone is best (as suggested in an answer below)? Currently I am going the route of simply editing my old hosted zone (as was suggested in the comment below).
We have been struggling with this for most of the weekend and could really use some advice on getting this domain off of the EC2 instance and onto the cloud run deployment.
Edit2: I did just update the hosted zone with the cloud run DNS records a few minutes ago, so perhaps I just need to give it time? Again, I am not sure at all...
I will point out two most obvious ways and their pros/cons.
1. Safest way
You can create a new managed zone (GCP's equivalent to AWS hosted zones), create all the needed records for your cloud run app in GCP. Then change at your domain registrar DNS servers that you got from GCP (probably something like ns-cloud-a1.googledomains.com).
This way you will have full working copy (with setting to accomodate GCP's Cloud run) and in case you wanted to go back to AWS quickly you just need to point to AWS DNS servers at your domain registrar.
Cons of this solution are that you will have to pay a little bit more because you will be effectively hosting your domain at two providers (but only GCP will be actively used).
2. Easy way.
Create new managed zone at GCP, point your domain to GCP's DNS servers and delete hosted zone at AWS.
You can also backup your hosted zone in AWS - you can have a look at this blog post how to do it.
In my opinion if you ever plan to go back (or have a backup) of your domain records setup for AWS then first approach is the one to go for. Additional cost is also negligible.
UPDATE
Any changes made in DNS settings (adding & removing records, modyfying) requite usually up to 24 hours to propagate across the Internet.
Even more about DNS records and how to manage them.
If you want to add multiple A records to your managed zone edit your zone, click on "add record set" button, next select A record type (or AAA for IPv6 and type in the address first value, next click "add item" button below and type another etc.
If you prefer to do it using gcloud the here's some documentation how to add records to your zone (domain).
I'm trying to get the website I've set up in Elastic Beanstalk live. I bought a domain www.semiflex.work from Hover.com. I understand that I need to connect my domain to Elastic Beanstalk via Route 53, but I'm getting a lot of conflicting information as to how I can do this.
I've tried creating CNAME record sets in both Route 53 and Hover as an Alias with a link to my Elastic Beanstalk website, but that didn't work. I then also replaced the nameservers in Hover with the ones in Route 53, but that didn't work either. It's been roughly 4 days and I can't get my site to run on my new domain. How would I go about getting this to work?
Thanks in advance.
Using Route53 to manage your DNS is simple and straightforward.
Go to to Route53 and create a hosted zone for your domain. As soon as you create your hosted zone, Route53 will generate two default entries: a SOA entry, and an NS entry with 4 nameservers that you assign to your domain in order for Route53 to manage your zone file.
Next go to your domain registrar, in this case Hover, and update the nameservers of your domain to the nameservers provided by Route53.
Now that Route53 is managing the zone file for your domain, you can create an appropriate entry for your ElasticBeanstalk app. Open your domains hosted zone and select “create record set”. On the right hand side, you’ll be able to enter a sub-domain (optionally), like www, next you’ll be able to select the type of record this is, such a an A, CNAME, MX, TXT or other. If you’re using your domain with another AWS service like Elastic Beanstalk, CloudFront, or S3, you’ll want to leave the type as an A record and then in the next section you’ll set Alias to yes. Now, in the target, you’ll either select where you want Route53 to Alias to from the available option in the current account, or if you’re aliasing to a supported service in another account you’ll enter the target such as the ElasticBeanstalk or CloudFront URL.
Click “save record set” and the entry will be live within seconds (assuming the DNS has propagated).
Now that Route53 is managing your DNS, and because IP addresses for services can change, your DNS will not need to be updated because Route53 will automatically take care of updating the destination for the record if/when it changes.
We went through your issue and noticed that you must have misconfigured your route53 settings. You do not need to create an CNAME record for routing your domain through elastic beanstalk environment. Just need to create a record set by enabling Alias and selecting Alias target as your environment URL in the dropdown list.
To do so go through -->> Create Record set -->>Click on Alias -->>Select Alias Target.
This will resolve your problem assuming that you have updated name servers in domain registrar.
Ended up solving this the old fashioned way.
AWS part
On Route 53, create a hosted zone. In that hosted zone, create a record set that is Type A - IPv4 - address, Alias Target = your elastic beanstalk url. Save record set. Then click on that record set, and then click on the button "Test Record Set." Then click "Get Response." Copy the I.P address "in Response returned by Route 53"
Hover part
Set Nameservers on hover = ns1.hover.com, ns2.hover.com. Then click on "DNS" and add two records where Type = A, Host = *, Value = your Route 53 I.P address & Type = A, Host = #, Value = your Route 53 I.P address.
Can take up to 48 hours to work, but it works!
I have a GoDaddy URL that I want to migrate to my website hosted on AWS EC2.
I have followed the steps to transfer the DNS by setting up a hosted zone on Route 53, copying the four Nameservers and saving them in GoDaddy as custom Nameservers.
This was three days ago and the change has still not taken place.
Any ideas as to what I have done wrong?
The url is: www.swsportspsychology.co.uk
These are screenshots of the AWS and GoDaddy accounts:
It appears that the domain is not registered!
I would recommend that you double check that GoDaddy actually took payment and submitted the registration - perhaps its still in progress however, I doubt this as you have stated its been 3 days.
Alternatively (and I would recommend this) if you plan to use this domain with AWS why not register it within AWS in the Route53 Service. As you can see from the image below the domain is available for registration in the AWS Console.
This will make management a lot easier in my opinion, however if you choose to pursue the GoDaddy registration it does look like you're all correctly configured to host that site's DNS when the registration takes place. Good work!
Update: Adding a DNS record to your domain
In this example we are going to configure the A record for your domain and WWW to point to your EC2 Instance.
Open EC2 and highlight your instance, make a note of the Public IP and the Pubic DNS values. Keep these handy.
Open Route53 and click your hosted zone "swsportspsychology.co.uk"
Click the Blue "Add Record" button.
Using the panel on the right hand side;
Leave the Name value empty
Ensure the Record Type is "A - IPV4 Address"
Leave Alias set to "No"
Leave TTL as the current value
In the Value field, type in the Public IP of your EC2 instance only.
Click Create
This will create a record for swsportspsychology.co.uk that will take you to your EC2 instance. Now to setup WWW.
Click Create Record Set again
Using the panel on the right hand side;
Enter "www" in the name field
Ensure the Record Type is set to "CNAME - Canonical Name"
Ensure that the Alias value is set to "No"
Leave the TTL value as the default value
Set the Value field to be the Public DNS value for your EC2 instance that you recorded earlier.
Click Create
You should now be able to access your website by visiting "www.swsportspsychology.co.uk"
I have registered the domain duhastdiewahl.org at Amazon AWS Route 53.
I do it step for step like this:
http://share.pho.to/AAUSM
Create Hosted Zone (NS/SOA-Record default)
Add A-Record to my elastic ip adress for my EC2-Instance
Unfortunately if i ping the adress the name can't be resolved and tools like http://mxtoolbox.com says that the nameservers couldn't be found.
Can anybody tell me what is wrong?
Thank you for your support :)
Your nameservers are configured incorrectly in Route 53 "Registered Domains" -- they don't match the servers assigned to you in "Hosted Zones."
Route 53 is two different services -- domain registration and DNS hosting -- and the settings between the two of them need to match. One possible cause of a mismatch is deleting and recreating your hosted zone. That wouldn't fix anything, but a lot of people seem to try it anyway. When you do that, it assigns four new name servers do your domain for hosting -- but the registrar service doesn't learn about this, because there's not necessarily a connection between the two services. You could register a domain on one AWS account, and host the DNS on another, if you wanted -- the two "sides" of Route 53 are essentially independent.
To fix:
In the Route 53 console, click Hosted Zones, click your domain, and make a note of the assigned 4 name servers. Don't change anything here.
Click "Registered Domains."
Select your domain.
Choose "add/edit name servers."
Enter the correct values for the assigned Route 53 name servers, which you obtained from the Hosted Zones screen.
AWS Elastic Beanstalk suggests using a URL in the following format: https://{appname}.elasticbeanstalk.com/
But I need to change it to my own URL, something like https://tarta.ai
How to do it?
Note: I use Amazon Route53 for my domain.
I know this is old question but since I just done this process for one of my apps, I decided to share it here which may help others too. Here's the steps I've gone through
Login to your AWS Account
Go to your EC2 Panel and select your region
Select Load Balancer from left navigation menu
Found Load Balancer which related to your Beanstalk App
In Description Tab grab Hosted Zone ID
Open Route53 Panel
Select your domain hosted zone
Add A Record for .example.com
Select Alias option to Yes
Search for your Load Balancer related to you app
Confirm it's Hosted Zone ID with what you grabbed in step 5
Do steps 8-11 for www.example.com as well.
References
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customdomains.html
http://aws.typepad.com/aws/2011/05/moving-ahead-with-amazon-route-53.html
Use Amazon Route53. ELBs, including those generated with ElasticBeanstalk, are assigned CNAMEs. You can't just point your top-level domain at a CNAME, as it violates the RFC. You could point a CNAME record like http://www.example.com at it, but that still won't respond at http://example.com. It's an irritating problem; for example, consider this 7-page thread on the AWS forum.
The easiest solution is Route53. It uses special apex records to map TLDs to ELBs, thus avoiding the problem entirely. You can also use an EIP'd public instance to forward traffic to the ELB, although this raises scalability concerns.