1
votes

I have a load balanced environment (min nodes 2, max nodes 4).

The DNS CNAME points to the AWS DNS name for the Elastic Beanstalk, e.g...

awseb-e-a-awsebloa-XXXXXXXX-YYYYYYY.eu-west-1.elb.amazonaws.com

My DNS A-record points to the static IP (elastic IP) of the first EC2 instance (I manually associated the EC2 IP address).

This means anyone referencing www.mydomain.com will go through the CNAME and therefore will be load-balanced.

Anyone accessing without the www prefix (mydomain.com) will go through the A-record and hit the first EC2 instance.

My question is, how can I make the A-Record point to the Elastic Beanstalk instead? I don't want to type its current IP address - because that could change, but I'm more than conscious that pointing to a single node isn't great either.

1

1 Answers

3
votes

Since the IP address of the ELB may change time by time, you should create an Alias record with Route53 instead.

https://aws.amazon.com/route53/faqs/#which_dns_records_are_supported

Additionally, Amazon Route 53 offers ‘Alias’ records (an Amazon Route 53-specific virtual record). Alias records are used to map resource record sets in your hosted zone to Amazon Elastic Load Balancing load balancers, Amazon CloudFront distributions, AWS Elastic Beanstalk environments, or Amazon S3 buckets that are configured as websites. Alias records work like a CNAME record in that you can map one DNS name (example.com) to another ‘target’ DNS name (elb1234.elb.amazonaws.com). They differ from a CNAME record in that they are not visible to resolvers. Resolvers only see the A record and the resulting IP address of the target record.