Reputation: 111
I am new to AWS and trying to map domain(registered in Godaddy) to AWS instance, here is what I have tried:
Both www.example.com and test.example.com redirects to EC2 instance public DNS(http://ec2-52-11-xxx-xxx.us-west-2.compute.amazonaws.com/) If I hit ELB url(test-elb-34243545.us-west-2.elb.amazonaws.com) directly that also redirects to EC2 instance public DNS(http://ec2-52-11-xxx-xxx.us-west-2.compute.amazonaws.com/)
With redirect I mean url changes in address bar and also Chrome console shows 302 redirect.
I don't want url to change in address bar. Not sure what I am doing wrong, any help would be appreciated.
Thanks in advance!
Upvotes: 3
Views: 2799
Reputation: 56987
If you want traffic to go via the ELBs (this is a good thing) and not direct to the EC2 instance underneath then you don't need your elastic IP.
Instead create a CNAME in your Route53 Hosted Zone for www.example.com
that points to the ELB name (which will look like ${load_balancer_name}-${account_id}.${region}.elb.amazonaws.com
).
Now when you go to www.example.com
you will hit the ELB which will then load balance traffic to any attached EC2 instances underneath it. You can also leave the EC2 instances with purely private IP addresses so it's impossible to hit the EC2 instance directly without going through the ELB.
Upvotes: 2