Which of these will not be needed in this setup?
Launch the EC2 instances with only the public subnet.
Create routing rules which will route all inbound traffic from ELB to the EC2 instances.
Configure ELB and NAT as a part of the public subnet only.
Create routing rules which will route all outbound traffic from the EC2 instances through NAT.
Explanations:
The requirement states that all EC2 instances should haveprivateIPs. Launching instancesonlyin the public subnet would give them public IPs (and optionally private IPs), which is contrary to the requirement. Therefore, this action isnotneeded and is the correct answer to the question.
Routing rules are essential for directing traffic from the ELB to the EC2 instances. Without these rules, the ELB wouldn’t know where to send the incoming traffic.
The ELB needs to be in a public subnet to receive traffic from the internet. A NAT Gateway or NAT Instance (for outbound internet access from the private subnet instances) also needs to be in the public subnet. Therefore, configuring both in the public subnet is necessary.
Since the EC2 instances are in private subnets and need to access external resources (e.g., package repositories, AWS services), they need a way to reach the internet. Routing outbound traffic through a NAT Gateway or NAT Instance provides this connectivity without exposing the instances directly to the internet.