简体   繁体   中英

understanding aws ELB and private ip on eth0

I am experiencing some odd behavior in setting up a VPC and would like some clarity on using R53, ELB and ec2. After reading the docs and a number of posts on aws and SO, I am reading conflicting information.

The basic question is, if I am using an ELB, do I need a EIP on an instance to see it from a url...

For testing I have opened up all the ports.

R53 = abc.domain.com -> (use as url for ssh into EC2)
   type  = A
   Alias = yes
   Alias = ELB DNS name (myElb-1111111.eu-west-1.elb.amazonaws.com)

ELB = myElb
Listeners = in:tcp:22  out:tcp:22
Security = in:all out:all
AZ = eu-west-1a
instance = i-xxxxxxxx (myEc2)
health = in service (only using private IP on eth0)

EC2 = MyEc2
AZ = eu-west-1a
subnet =  subnet-11111 (connects to igw-000000)
security : in:all out:all

now if I start with eth0 = private only, I can not connect using abc.domain.com. According to the docs the ELB connects on eth0 only.

If I add a 2nd NIC as eth1, and add an EIP, now I can connect with abc.domain.com.

Now I remove eth1 and I can still connect to the EC2 with a fresh session.

Is the correct behaviour?

If I change the setup slightly and point the ELB to an EC2 in a 2nd subnet that is not connected to the IGW, should I be able to reach YourEc2 with abc.domain.com ?

EC2 = YourEc2
AZ = eu-west-1a
subnet =  subnet-2222 (no IGW in route table)

Thanks Art.

There's a lot of stuff going on in your question that seems a bit irrelevant. If you want to use an Elastic Load Balancer, then your traffic would look something like this:

Browser -> ELB -> EC2 Server

By assigning an Elastic IP to the EC2 server and then trying to hit that IP, you are just bypassing the ELB completely and going directly to the server.

So to answer your question, no you shouldn't need to assign an Elastic IP to anything if you are using an ELB.

Also, how are you testing connecting to the private IP on eth0? Obviously you can't point your domain name to that, because it is a private IP. That IP is only accessible from within your VPC. You would have to test hitting that IP from a server running inside your VPC.

If your ELB says the instance is healthy, then you really should be able to hit the ELB and get a response. What happens if you try to hit the ELB directly at the DNS name for the ELB (not abc.domain.com but myElb-1111111.eu-west-1.elb.amazonaws.com)?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM