I currently have one EC2 instance running with an Elastic IP. In my DNS settings, I have an A record pointing to the Elastic IP.
If I wanted to add a second instance, how would I go about doing that? I know how to launch them, and get the data transferred, but what do I do in my AWS console and DNS settings to have more than one instance pointing to the same website?
Thank you in advance!
Are you talking about having 2 EC2 instances serving the same website? If so, that means that you will need to setup a load balancer. AWS makes that pretty easy using Elastic Load Balancing.
The basic procedure is like this:
At this point you're pretty much done. ELBs do not allow you to assign them an elastic IP, as such, you need to change your dns record from an A
to a CNAME
and point your domain at the ELB dns name.
There are some more advanced settings you can mess with depending on the exact needs of your application. For instance, if your website relies on sessions that are stored on the individual instances you'll want to enable sticky sessions.