Amazon Web Service - Route Traffic on ELB via SNI - web-services

Sorry in advance if this doesn't make much sense. I'm fairly new to this, so bear with me please.
I'm trying to specify a domain to a specific folder depending on the domain name the user use (example.com or test123.com), through Amazon Elastic Load Balancer (Application load balancer to be specific).
My current setup is that all traffic from the internet goes to a Load Balancer (ELB), from there it round robin between 2 EC2 instances. Both instances are connected to an Amazon Network File System (EFS), as well as a Relational Database (RDS).
I can access the website(s) fine through the DNS of the load balancer (http://web-load-balancer-efs-16512354.us-east-1.elb.amazonaws.com/example/)
What I want to do now set it up so that if someone put example.com as their url it will point to the Load Balancer and from there the server will use the correct folder as root (www.example.com document root would be http://web-load-balancer-efs-16512354.us-east-1.elb.amazonaws.com/example/, but the URL will still be www.example.com).
I created a hosted zone on Route 53 to point the domain name to my load balancer, but currently my load balancer which leads to one of the ec2 instances. Currently the ec2 document root is /var/www/html/efs-mount/.
Is there a way for me to have multiple document root depending on the domain name?
I stumble on something about putting multiple TLS/SSL certificate on your listener and through SNI protocol it'll be able to find right place? http://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html#https-listener-certificates. I'm not sure if this is what I need, or I'm completely off track.
If someone can point me to the right direction on how to do this that would be great.
Thanks

You are indeed off track.
While ALB with multiple SSL certificates may be a part of your strategy, since it allows you to attach multiple ACM certificates to a single instance or group of instances, ALB does not re-write the paths of the incoming requests or determine how the instance resolves web paths into filesystem paths.
This is something configured in your web server itself. Start by searching for something like "name based virtual hosting." Each domain name will specify it's own "document root" in the web server configuration files.

Related

Hosting a tomcat web application in a subdirectory

I am trying to do a feasibility check on the below problem.
I have a tomcat running on EC2 machines which is load balanced using ELB. Currently the ELB is accessible using https://abc.example.com (using ROUTE53 hosted zone).
I want to achieve something where I can reach the application from https://example.com/abc
Is this even possible ?
Thanks in Advance!
You cannot point DNS to a path on your site.
DNS converts abc.example.com into the IP address of the ELB/server. The request for /abc is then sent to the ELB/server on the designated port.
You should consult your web server docs to perform path based routing or consider using an ALB (Application Load Balancer) to perform path based routing.

Runtime DNS Entry of Server Ip in Domain Providers

I had an infrastructure consist of load balancer(nginx configuration) and two servers,
one is for UK and other is US,
Now requirements are I have to deploy runtime application to one of these servers based on client ip, that part is done in nginx conf with geoip module.
and will do server entry as well if not available in nginx upstream list.
Now second part is these servers e.g UK US having an ip's, I want runtime DNS entries for them as well,
Servers can be of AWS,Azure,GCP their domain providers may vary,
So its possible to do DNS entry during deployment stage like first application will be deployed to corresponding server then that server should do entry as well in DNS and get domain name (should be provided by user in runtime).
in short, there is script which is doing runtime domain entries like as.blabla.com in nginx
but I need to have an another parameter for server like 190.80.0.13 for asia, and i want dns entry for this ip as well either this belong to GCP,AWS or any DNS related system.
Question may seem alot twisted, its okay we can discuss further.
In AWS you will be better with AWS Elastic Load Balancer and Route53, using Geolocation, or Geoproximity as routing policy.
For better performance you can add (CDN) Cloudfront distribution.
https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-elb-load-balancer.html

Where to find domain name to existing EC2 instance

I'm new AWS and I have to continue maintaining previous developer service that is hosted on AWS. The ec2 instance that is hosted has map to domain name of https://****c.k**g.g***an.org.au, however I couldn't find this domain name anywhere. I tried looking at route53, but there's no such domain name registered.
Please help, how do I find the domain name that is mapped to the EC2 instance? Where can I get that information. The reason because I want to deploy a new instance but with the same domain name.
Edit: Masking DNS for privacy reasons.
Are you sure your DNS is hosted by Route53? Running dig against k***.g****.org.au has the SOA held by ns1.mooball.net.
The whois for mooball.net returns register.com as the owner, so I would consider reaching out to your internal teams to see who holds that account, then check your DNS delegation settings by logging in to register.com.
Often times the client will control their own DNS, so it would also be worth confirming with your client where their root DNS (garvan.org.au) is hosted - you can then trace the subdomain delegation to see where it is ultimately hosted.
check route53 service in AWS , since the domain is served by https..it could be the domain mapped to a load balancer and the load balancer has the instance...anyway you can know from the route53 there you find all the records

Route 53 DNS: Different DNS for base URL and endpoints (test.co and test.co/api)

Hopefully you all can help - we're looking to migrate our website from an EC2 instance to Webflow hosting. Unfortunately, we'd like to keep our API on the EC2 instance. Is it possible (in DNS in general, and specifically with route53) to have one DNS record for test.co and it's URL's (text.co/zxc, test.co/abc) and one DNS record specifically for the API URLs (test.co/api/abc)?
This would make the process much, much easier, as we wouldn't have to migrate the files to our EC2 instance and could keep the benefits of hosting on Webflow. However, performance is a key concern here for the API layer - my gut tells me that redirects are slow, and would add time to every API call. Not ideal.
Let me know what you think - cheers!
Using Route53 (or any DNS host) you can only resolve the hostname part (not the path) of the URL to your EC2 instance (E.g test.co, text.co) using either using.
CName mapping to the Domain Name assigned to the EC2 instance
A Record to the IP of the EC2 instance
Note: It is recommended to setup an Elastic IP for the EC2 instance if you directly map the EC2 instance to Route53.
You need to map /zxc /abc and /api/abc paths to relevant routes inside your EC2 instance either at WebServer level or using a proxy (E.g Nginx, Apache).
Is it possible (in DNS in general, and specifically with route53) to
have one DNS record for test.co and it's URL's (text.co/zxc,
test.co/abc) and one DNS record specifically for the API URLs
(test.co/api/abc)?
The best solution is to create a subdomain. api.test.com, then create an "A" record that point your api.test.com to your EC2 instance.
NJOY

Custom client domains for my web service

I have a web service running on EC2 behind an elastic balancer. I would like to allow my clients to point their A record to my web service so they could have their domain on my server. Similar to shopify or github pages.
However, I don't want to give them the IP of the web service, I'd like the request to go though the load balancer. How can I achieve this? Should I create a small server to forward requests? How does that work?
Many thanks!
If you are running your service behind an Elastic Load Balancer, you usually do not want to use ELB DNS name (which is something like your-service-ELB-1122334455.us-east-1.elb.amazonaws.com). Instead you will configure (probably using Route53, but any DNS service will do) CNAME or ALIAS record with some friendly name, like yourservice.yourdomain.example (this way, name will be easier to remember, and you have the freedom to change load balancer if needed).
All your customers have to do is to create CNAME DNS record pointing their name to your friendly service DNS name, like:
foo-service.theirdomain.example CNAME yourservice.yourdomain.example.
You also need to be aware that HTTP requests will have Host: header containing name entered by user (in case your server/service relies on that info)
You need to consider using Route53 as your clients's DNS service provider might not be supporting this feature beacuse of DNS rule.
See s3.6.2 of RFC 1034
Amazon created a new aliasing system for Route 53. You can now map the apex of a hosted zone to an Elastic Load Balancer using an Alias record. When Route 53 encounters an Alias record, it looks up the A records associated with the target DNS name in the Alias, and returns the IP addresses from that name.
In order to allow all of our customers to benefit from this new feature, there is no charge for queries to alias records when the target is an Elastic Load Balancer.
Associating Your Custom Domain Name with Your Load Balancer Name.
You can also create a Subdomain That Uses Amazon Route 53 as the DNS Service without Migrating the Parent Domain.