admin管理员组

文章数量:1333442

I have 3 EC2 instances (Amazon-Linux AMI) within same VPC (custom) and same AZ. All using the same security group and same ACL.

"A" & "B" are under public subnet whose route table has an entry for IGW and "C" under private subnet whose route table contains an entry for NAT Gateway. "A" has public IP but "B" & "C" don't have any public IP. "A" is used for SSH into "B" & "C". "sudo yum update" command works in "A" & "C" but getting timeout error in B.

Is this the expected behavior or am I doing something wrong.

Security Group:

                Type            Protocol    Port    Source/Destination
               ---------------------------------------------------------
Inbound rule:   All Traffic     All         All     Security Group itself
                SSH             TCP         22      Anywhere
Outbound rule:  All Traffic     All         All     Anywhere

ACL (both Inbound & Outbound)

Type         Protocol   Port    Source/Destination  Allow/Deny
-------------------------------------------------------------
All Traffic  All        All     Anywhere            Allow

I have 3 EC2 instances (Amazon-Linux AMI) within same VPC (custom) and same AZ. All using the same security group and same ACL.

"A" & "B" are under public subnet whose route table has an entry for IGW and "C" under private subnet whose route table contains an entry for NAT Gateway. "A" has public IP but "B" & "C" don't have any public IP. "A" is used for SSH into "B" & "C". "sudo yum update" command works in "A" & "C" but getting timeout error in B.

Is this the expected behavior or am I doing something wrong.

Security Group:

                Type            Protocol    Port    Source/Destination
               ---------------------------------------------------------
Inbound rule:   All Traffic     All         All     Security Group itself
                SSH             TCP         22      Anywhere
Outbound rule:  All Traffic     All         All     Anywhere

ACL (both Inbound & Outbound)

Type         Protocol   Port    Source/Destination  Allow/Deny
-------------------------------------------------------------
All Traffic  All        All     Anywhere            Allow
Share Improve this question asked Nov 20, 2024 at 15:08 Poulami RoyChowdhuryPoulami RoyChowdhury 134 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

Instance “B” resides in the public subnet but does not have a public IP address. Therefore, it cannot communicate directly with the internet for updates unless it uses an intermediary like Instance “A” as a NAT instance (not mentioned in your setup). To get rid of that error you need to assign a public IP to “B” if it needs direct internet access.

If Instance “B” lacks a public IP, it won’t be able to use the IGW, even though the route table is correct.

Or you can configure instance A as a proxy or NAT instance to allow B to access the internet without the need of a public IP.

and Ensure “A” has IP forwarding enabled and correct routing setup.

(even if instance in the public subnet, if it doesn't have a public IP you need to treat it the same way as an instance in the private subnet)

It works on instance A because it is in a subnet with a direct route to an Internet Gateway, and it has a public IP address.

It works on instance C because it is in a subnet with a route to a NAT Gateway or NAT Instance of some kind.

It does not work on instance B, because it is in a subnet with a direct route to an Internet Gateway, and it does not have a public IP address. A public IP address is required, in order to directly use an Internet Gateway.

本文标签: