Troubleshooting Steps for Connecting to an EC2 Instance in AWS VPC

Set Up VPC, Subnet, and Internet Gateway for EC2 Instance

Question

You've set up a new VPC with a subnet.

You've created an Internet gateway and attached it to the VPC.

You ensured that the VPC is set to allow DNS Resolution and hostnames.

You launched an EC2 Instance and ensured that it has a public IP and set the security groups and NACLs for access.

But you still can't connect to the Instance.

Which one of the following additional step needs to be carried out?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - C.

The following diagrams show a VPC with a public subnet.

The question does not mention the change made to the route table which must also be done for the Internet access.

Option A is incorrect since the Internet gateway is attached to the VPC only.

Option B is incorrect since the Private IP is used for the Internal communication only.

Option D is incorrect since the NAT gateway is used for Instances in a private subnet to communicate with the Internet.

For more information on public subnets in a VPC, please refer to the below URL-

https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Scenario1.html
10.0.0.076

‘Avaliailty Zone B

10.0.0.0/16

Region

0.0.0.0/0

When launching an EC2 instance in a new VPC, there are several steps that need to be completed before it can be accessed from the internet.

Based on the scenario provided, it seems like most of the necessary steps have already been completed, but there is still an issue connecting to the instance.

The following additional step needs to be carried out:

C. Ensure the Route table is modified.

When a new VPC is created, it comes with a default route table that doesn't allow traffic from the internet to reach the instances in the subnet. The default route table is only set up to allow traffic within the VPC.

To enable traffic from the internet to reach the instances in the subnet, a new route table needs to be created, or the default route table needs to be modified.

To modify the route table:

  1. Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
  2. In the navigation pane, choose "Route Tables."
  3. Select the route table associated with the subnet that the EC2 instance is launched in.
  4. Choose "Edit routes."
  5. Choose "Add route" to add a new route, and then enter "0.0.0.0/0" as the destination and the internet gateway ID as the target.
  6. Choose "Save routes."

Once the route table is modified, traffic from the internet should be able to reach the instances in the subnet, and the EC2 instance should be accessible from the internet.

Therefore, the correct answer is C. Ensure the Route table is modified.