Routing to a file path with AWS Route 53 - amazon-web-services

All,
I'm sure there's a very simple solution that I'm missing but I've given up looking!
I'm using Route 53 on AWS with elastic beanstalk. At the moment I've got a CNAME to route to my elastic beanstalk instance which is working fine, but I'm trying to get another one with a different subdomain linking to another path but don't seem to be having any success.
For example:
CNAME 1: www.example.com Routing to mysite.eu-west-1.elasticbeanstalk.com
CNAME 2: news.example.com Routing to mysite.eu-west-1.elasticbeanstalk.com/news
I've tried testing the second one, and noted that the response returned as \057 in place of the forward slash, not sure if that's part of the reason.

Route53 is a DNS service. DNS is only used for the domain name portion of the request. Route53 can not route to a specific path. You would need to configure your Apache or Nginx server on your Elastic Beanstalk instance to route requests for the 2nd domain name to that specific path.

Related

Route .nz domain to elastic beanstalk (can't use Route 53)

I've got a website hosted on elastic beanstalk and a .nz domain on www.sitehost.com.
I need to route the domain to the website. All the documentation I'm seeing tells me to transfer the domain to Route 53... but you can't use .nz domains with Route 53.
I've had a look at setting up DNS records on my current domain host but I'm not 100% which records/information need to be added. Is it as simple as adding DNS records? Or can you only route elastic beanstalk websites through Route 53 and do I need to take my website off AWS and host somewhere else??
Appreciate any advice!
Cheers,
Daniel.
Is it as simple as adding DNS records?
Depends on the capabilities given to you by sitehost and what is your domain. If you want to point subdomain (e.g. www.mysite.nz) to EB, just use CNAME record. If you want to point root domain (e.g mysite.nz) CNAME can't be used, and you may need to contact sitehost if they have any special/custom records for root domains.
Or can you only route elastic beanstalk websites through Route 53 and do I need to take my website off AWS and host somewhere else??
You can host it on AWS. But if the sitehost does not allow you to create CNAME or other records, then you can setup Route53 as your DNS service. This is different then migrating a domain. Your domain is still in sitehost, but all its records are managed by R53. This requires you to setup NS records in sitehost. But again, it depends if sitehost allows you to do it.

Route53 doesn't propagate to Elastic Beanstalk

I registered an .link domain name with Route53 and experimented a little bit with it.
First I created an record to route traffic to my S3 static webpage. After that I deployed an Elastic Beanstalk app and tried to route the traffic to the Elastic IP of my EB instance.
I am getting the whole time "no response" messages. When I do a test on the record set, I am getting the right IP in the "Response returned by Route 53" field.
I even done an whois request on my domain name, and nowhere were mentioned the information I entered during the registration.
Did I forget something or do I have to pay attention on something?
I noticed that the Domain name status code is blank for this domain name.
Like you, I'm using Route53 to route traffic to an Elastic Beanstalk instance.
In EB, under "All Applications", I have a running application with a URL ending in ".elasticbeanstalk.com"
Then, in Route 53, I have a record which routes a particular subdomain to my EB URL:
The blank Domain name status has nothing to do with the problem. The domain name works now and the Domain name status is still blank.
The problem was that the nameservers for the registered domain not matched the nameservers of the hosted zone. The support provided me the correct namerservers, I replaced the nameservers of the registered domain and the hosted zone with the one the support provided me and everything works fine.
Kind regards

AWS Route 53 aliased A record is causing 301

I have an Elastic Beanstalk application that I'm attempting to route a custom domain name to using a Route 53 hosted zone, i.e., mycustomdomain.com should route to fooelbapp.us-east-2.elasticbeanstalk.com. Within the Route 53 hosted zone, I've created an A Record with mycustomdomain.com as the name and a value of ALIAS fooelbapp.us-east-2.elasticbeanstalk.com. Now when I attempt to navigate to mycustomdomain.com, I receive a redirect to fooelbapp.us-east-2.elasticbeanstalk.com, which is not the expected behavior. The expected behavior is a 200 response and the page to load under the custom domain name, not the Elastic Beanstalk CNAME URL. Has anyone else experienced this issue?
The Elastic Beanstalk application is a WordPress 4.8.2 site on PHP 7.
Solution
#Mark B is correct, the issue was caused by my Site Address and WordPress Address being set to the Elastic Beanstalk CNAME URL, after correcting this everything works as expected and my custom domain name now resolves to the Elastic Beanstalk application without 301 redirecting.
Route53 does not issue HTTP redirects. What is happening is your application server thinks it is serving the domain fooelbapp.us-east-2.elasticbeanstalk.com, probably because that's the domain it finds when it starts up. So any requests it receives that aren't for that domain it is redirecting.
You need to configure your application to be aware of the actual domain name you want it to serve. How you would do that will depend on what web server you are using. If you need more help please provide more details about your environment.

Accessing hostname when traffic passed through AWS Application Load Balancer

For our application we are using AWS Application Load Balancer (ALB) and have a listener for HTTP: 80 to forward traffic to the TargetGroup.
The way we have setup our application is that we will have a number subdomains and need to access these original subdomains (companyA.something.com) from within the application. Currently the application sees the DNS name of the ALB itself.
So far I have tried to setup the subdomain (in Route53) a couple ways:
Created subdomain as A record with ALIAS pointing to the ALB DNS
Name
Created Hosted Zone for subdomain adding NS records for the
subdomain to the zone file for the parent domain
http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingNewSubdomain.html
I discovered that these are basically the same and the application still sees only the ALB DNS Name.
Is there anyway for me to get the original subdomain my users are going to without overriding with the ALB DNS name?
Thanks in advance,
Aaron
You need to check the HTTP HOST header. The framework you use should already be able to handle it for you.

Using Cloudflare with Amazon EC2 and load balancers

I am running my website on AWS.
I have one load balancer for my two web servers. My load balancer doesn't have a static IP address, it has a domain name.
I want my traffic to come only via the load balancer. I am using Cloudflare's DNS instead of Route 53, because that's what the Cloudflare instructions said.
I cannot add the load balancer's IP as an A record because it is dynamic and cannot be added through Cloudflare's DNS panel (Not like Route 53). Help me I am stuck in this situation. No solution is offered by Cloudflare so far.
Has anyone faced the same issue?
You can set your Cloudflare record as a CNAME alias of your ELB's A record
See:
https://support.cloudflare.com/hc/en-us/articles/200168986-How-do-I-add-a-Amazon-ELB-Elastic-Load-Balancing-record-to-CloudFlare-
I suggest to manage your domain DNS with CloudFlare.
Add a CNAME record for your subdomain demo which points to that IP.
On CloudFlare Console go to Crypto > Origin Certificates. Create a new one with RSA, then import it to AWS Certificate Manager at us-east-1. For the certificate chain use this.
Be sure that Always use HTTPS in Crypto tab is on.
After some minutes you should be using your domain pointing to AWS with HTTPS working fine.
That's what I did to make a subdomain to work with an AWS API endpoint with SSL.
I decided like this:
I created in the cloudflare, in the DNS table, two CNAME records that point to the dns name of the load balancer generated in aws.
The first record created must contain in the "Name" field, the value "www" with the "content" field pointing to the url of the load balancer in aws. The second record, on the other hand, points to root, containing the value "#" in the "Name" field and "Content" pointing to the same load balancer server in "aws".
See the images below for a better understanding.
I've tried with the Cname record with target as Load Balancer DNS name, but the website is not secured.
If you need static IP for your Load Balancer then use Global Accelerator. It will provide you a static IP. After that create an A record with domain name in cloud flare and content with your Static IP provided by Global Accelerator and the Proxy status must be Proxied.