Single domain for multiple ELB - amazon-web-services

Is it possible for a single domain name to be associated with multiple AWS ELB on different domains?
Eg. I want example.com to point to my first ELB, and api.example.com to point to my second ELB (which is from a different AWS account).
I tried creating an A record for example.com with the first ELB as alias target, and another A record for api.example.com with the second ELB as alias target, but only example.com is working.
For both of the ELB, I use the same domain name for the AWS cert manager to register for SSL cert, not sure if that affects anything.

The problem was that I forgot to allow all incoming traffic on the security group of the ELB...

Yes, you can use multiple load balancers for the same domain or different domains. For the AWS managed SSL certificate, you will need all domain names in the same certificate or you can use a different SSL certificate for each domain name. I would just create one certificate with "example.com" and "*.example.com".
Your issue is that you are using an SSL certificate for api.example.com that has the name example.com. The SSL certificate must include the name that matches the domain name.
If you do not have an SSL certificate installed on the EC2 instance, then setup SSL termination at the load balancer. This means creating a listener for port 443 that forwards to port 80.
To configure Route53 with an ELB in a different account:
For ELB load balancers, do one of the following:
If you used the same account to create your Amazon Route 53 hosted zone and your load balancer – Choose Alias Target and choose a load
balancer from the list. If you have a lot of load balancers, you can
type the first few characters of the DNS name to filter the list.
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.
If you used one AWS account to create the current hosted zone and a different account to create a load balancer, the load balancer will
not appear in the Alias Targets list.
If you used one account to create the current hosted zone and one or more different accounts to create all of your load balancers,
the Alias Targets list shows No Targets Available under Elastic
Load Balancers.
In either case, the console prepends dualstack. to the DNS name. When
a client, such as a web browser, requests the IP address for your
domain name (example.com) or subdomain name (www.example.com), the
client can request an IPv4 address (an A record), an IPv6 address (a
AAAA record), or both IPv4 and IPv6 addresses (in separate requests).
The dualstack. designation allows Amazon Route 53 to respond with the
appropriate IP address for your load balancer based on which IP
address format the client requested.
Values for Alias Resource Record Sets

Related

My sub domain is not working with Route53

I have a domain (ex: example.com) which is configured and working fine with AWS Route 53 as below configuration
I have A record point to a AWS ELB for 2 EC2 instances (such as A and B which have tomcat 7 installed and configured).
Now I want to setup a subdomain like java.example.com which is pointing to another EC instance such as C but so far is not luck
What I have tried so far is
Try 1. Create another hosted zone such as java.example.com and then create A record which point to the IP of C ==> not working
Try 2. Create A record under hosted zone example.com with name as java.example.com and value is IP of C => not working
Please advice what I'm missing.
What you can do is create a CNAME record named java.example.com and point that to the EC2 instance.
If you want to use A record then create a Load Balancer, put your EC2 behind the load balancer and then use the DNSName of the load balancer as the value for your A record
Check here for more details https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-choosing-alias-non-alias.html
Extract from above page is as follows
When Route 53 receives a DNS query for an alias record, Route 53 responds with the applicable value for that resource:
An Amazon API Gateway custom regional API or edge-optimized API –
Route 53 responds with one or more IP addresses for your API.
An Amazon VPC interface endpoint – Route 53 responds with one or more IP addresses for your interface endpoint.
A CloudFront distribution – Route 53 responds with one or more IP addresses for CloudFront edge servers that can serve your content.
An Elastic Beanstalk environment – Route 53 responds with one or more IP addresses for the environment.
An ELB load balancer – Route 53 responds with one or more IP addresses for the load balancer.
An Amazon S3 bucket that is configured as a static website – Route 53 responds with one IP address for the Amazon S3 bucket.
Another Route 53 record in the same hosted zone – Route 53 responds as if the query is for the record that is referenced by the alias record.

AWS Route53 to external DNS service A record

I have brought example.com from one of address sellers.
On AWS I have Application Load Balancer.
I have created Route53 hosted zone and added this load balancer as A record alias:
How should I receive this records constant IP address to link my external DNS A record to this Route53?
I can't put CNAME to example.com, only sub-domain. When adding IP from Test Record Set IP list, they are changing from time to time.
You want to switch to using a Network Load balancer to get a consistent IP address.
Static IP support
Network Load Balancer automatically provides a static IP per Availability Zone (subnet) that can be used by applications as the front-end IP of the load balancer.
https://aws.amazon.com/elasticloadbalancing/details/#details
Also you'll want to switch to an ALIAS instead of an A record.
Queries to Alias records that are mapped to Elastic Load Balancers,
Amazon CloudFront distributions, AWS Elastic Beanstalk environments,
and Amazon S3 website buckets are free
https://aws.amazon.com/route53/pricing/

how do I connect to an AWS "Application Load Balancer" with SSL

I have just set up my first "Application Load Balancer" and I chose the SSL option to connect allowing AWS to generate the certificate for me based on my domain (www.example.com).
I have set the target to my EC2 instance and now I want to connect to the Load Balancer but not sure how. If I just connect to the DNS name of the load balancer I get an invalid certificate error.
I have read that I need to set a record for my domain but because the IP of an application load balancer may change, not sure if that is a good idea.
The documentation mentions the following:
Clients can use the Server Name Identification (SNI) protocol
extension to specify the hostname they are trying to reach.
But I couldn't figure out how to do that. I'm very new to Load Balancers and not quite sure how to proceed.
The following problem is easy to solve with AWS Route 53:
Create a hosted zone in Route 53
Choose the name of the hosted zone that has the domain name that you want to use to route traffic to your load balancer
Choose Create Record Set.
Specify the following values:
Name:
Type the domain name that you want to use to route traffic to your ELB load balancer. The default value is the name of the hosted zone.
For example, if the name of the hosted zone is example.com and you want to use acme.example.com to route traffic to your load balancer, type acme.
Type:
Choose A – IPv4 address.
Alias:
Choose Yes.
Alias Target
Find the applicable category in the list (ELB Application Load Balancers, ELB Classic Load Balancers, or ELB Network Load Balancers), and then choose the name that you assigned to the load balancer when you created it.
Routing Policy:
Accept the default value of Simple.
Evaluate Target Health:
If you want Route 53 to route traffic based on the health of your resources, choose Yes
Choose Create.
Also If you don't want to use Route 53 and if it's not at the apex, you use a CNAME to the ELB.
Refer to this Guide
Something like :
my.web.thingy.org CNAME my-loadbalancer-1234567890.us-west-2.elb.amazonaws.com.
And yes you are correct the IP of ELB Changes Frequently and thus it is not recommended to use A Record in DNS.
Hope this Helps

Getting root to point to AWS ELB without using AWS nameservers

I've set up my application on AWS Elastic Beanstalk. I added a load balancer and pointed a CNAME for 'www' to it. But now I need to get root pointed there too. I can't use Route53 and use AWS nameservers because the client wants to use theirs. How can I get root to my app? Can I redirect the traffic? The tech lead I'm working with suggested setting up a server to do the redirect?
Since AWS ELB's only offer DNS Record (Instead of IPs) you need to use a CNAME mapping. However with DNS, CNAMEs do not allow root domain to point to it. To overcome this AWS has provided Alias Records (Custom implementation to AWS) to point root domain to ELBs.
If your client want to use their nameservers still you can use, AWS Route53 in between to solve this with following steps.
First create a Public Hosted Zone in Route53 for your domain.
Then create a record set inside the Hosted Zone for the root domain to point to the ELB with Type = A - IPv4 Address, Alias = Yes with ELB CNAME as for the Alias value.
In the external domain management service, create a NS record to point the root domain to Route53 nameservers.
Then when the DNS resolution happens, the root DNS query will first go to external nameservers(Managed outside of Route53) and then it will be forwarded to route53 where it will resolve the ELBs IP address and sent back.
You can set up a machine with a single static IP address that does nothing but redirect requests to the www host. Then you can put an A record on the bare domain at the apex of the DNS zone pointing to that machine.
There is at least one service, http://wwwizer.com/naked-domain-redirect, that will do this for you. (I'm not affiliated with this service, but it appears to do what it claims and will serve your purpose. There are probably others like it.)
Ideally, though, you'd persuade your client to change the authoritative nameservers to point to a Route 53 hosted zone that you create for them. They are still the registrant and "owner" of their domain, and can take control back from you by simply changing the nameservers to something else.
I generally persuade clients with the explanation that our load balancer infrastructure is integrated with the DNS servers so that if a balancer node fails, or we need to add or scale up capacity, or experience a traffic surge or DDoS event, the load balancer system will automatically update the DNS records for their domain to try to mitigate the issue and keep the site up. To do otherwise is to do things in such a way that removes those layers of redundancy.
Ideally, you can set up a apache server with a static IP, and install a free SSL certificate on that web server at first.
Second you need to redirect your root domain name request to AWS ELB.
Then go to your DNS management and set up your apex point to the server you created.
It is now possible to setup a Network Load Balancer and allocate one or more Elastic IP Addresses to it (one per Availability Zone). The Network Load Balancer can have an Application Load Balancer as a target. The Application Load Balancer would target the Elastic Beanstalk. An A record can then be created in the external DNS for each Elastic IP Address of the Network Load Balancer.
If you don't need the functionality that the Application Load Balancer provides, you may be able to target Elastic Beanstalk or whatever application directly from the Network Load Balancer.
Since AWS ELB's only offer DNS Record (Instead of IPs) you need to use a CNAME mapping. However with DNS, CNAMEs do not allow root domain to point to it. To overcome this AWS has provided Alias Records (Custom implementation to AWS) to point root domain to ELBs.
If your client want to use their nameservers still you can use, AWS Route53 in between to solve this with following steps.
First create a Public Hosted Zone in Route53 for your domain.
Then create a record set inside the Hosted Zone for the root domain to point to the ELB with Type = A - IPv4 Address, Alias = Yes with ELB CNAME as for the Alias value.

Domain name setup without A Records

I am hosting content on AWS and want to configure my DNS settings so that both my # record and www record point at my Elastic Load Balancer.
example.com (# record)
www.example.com (www record)
AWS recommends setting up domains using CNAMEs as the IP addresses can change.
All the documentation I have seen on the CNAME is that they deal with subdomains but not the primary domain itself (http://example.com
). The primary domain requires an A record and therefore must require an IP address.
I do not want to use an A Record to point the traffic to my Elastic Load Balancer as the IP address may change.
Any idea how I can get around this issue?
I am using Linode to manage my DNS.
You can use a special record type in Route 53 called "Alias".
Q. Can I point my zone apex (example.com versus www.example.com) at my
Elastic Load Balancer?
Yes. Amazon Route 53 offers a special type of record called an ‘Alias’
record that lets you map your zone apex (example.com) DNS name to your
ELB DNS name (i.e. elb1234.elb.amazonaws.com). IP addresses associated
with Amazon Elastic Load Balancers can change at any time due to
scaling up, scaling down, or software updates. Route 53 responds to
each request for an Alias record with one or more IP addresses for the
load balancer. Queries to Alias records that are mapped to ELB load
balancers are free. These queries are listed as
“Intra-AWS-DNS-Queries” on the Amazon Route 53 usage report.
Source: https://aws.amazon.com/route53/faqs/
Just set the Alias to Yes and you will be able to choose your load balancer from the dropdown menu: