Custom client domains for my web service - amazon-web-services

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.

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.

Whats is the difference between AWS ELB and Route53?

I am new to AWS Route53 and trying to brush up some of the basics. I have a question that might sound silly.
Lets say i have a public load balancer created with its DNS (AWS auto generated). Now i went ahead and got my corporate company to create a CName for the actual ELB A record, so say that CNAME is www.my-website.com.
Now when users start browsing www.my-website.com, their router DNS directly know where this public www.my-website.com is hosted and then once the DNS resolution happens, the request is directly forwarded to my ELB that has that CName to it.
Now all this is good but i would also like to play with Route53 here, so i go ahead and use Route53 to create a hosted zone and add my domain www.my-website.com under it and then create a record set with alias pointing to my actual ELB followed by rest of the configuration.
Now when someone hits www.my-website.com on their browser will the request directly go to the ELB or go to Route53 that will then route it to that ELB?
A summary of what these services provides is below:
Route 53 is a DNS Provider provided as a service by AWS. The functionality you're describing using is to store your DNS records within it for resolution.
An ELB is an appliance to distribute traffic across multiple nodes.
With your records in Route 53 the below journey takes place:
When a client in the browser attempts to go to www.example.com it will first check in its internal cache for any previously stored values for the domain, if theres a value it will be evaluated against a TTL to see if it has been expired.
If no value or expired the client will connect to the root domain, then the top level domain continuing until it finds the DNS provider for your domain (. -> .com. -> example.com..
Once it finds this DNS provider it will query for your domain, if it matches it will return the resolution value and the TTL.
If the value is that of a CNAME (such as an ELB) this process will begin again to resolves the IP address(es) for your hostname. This IP address will be cached by your local client.
If you're using Route 53 and an ELB one advantage would be to use Alias records they actually set your domain record to the IP address which improves the speed of DNS resolution.
So in summary Route 53 is only contacted if the client does not know the resolution value for your domain.

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

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.