You've set up a VPC with a CIDR block of 10.0.0.0/16
You've set up a public and private subnet with CIDR blocks of 10.0.1.0/24 and 10.0.2.0/24 respectively.
You attached an Internet gateway to the VPC.
Which of the following changes have to be made to the custom route table for the public subnet to allow internet connectivity?
Click on the arrows to vote for the correct answer
A. B. C. D.Answer - D.
The AWS Documentation mentions what should be the entry in the route table for the Internet gateway which should have the destination of 0.0.0.0/0.
All other options are invalid since the right one is provided in the AWS Documentation.
For more information on VPC Route tables, please refer to the below URL-
https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.htmlIn order to allow internet connectivity to instances in the public subnet, we need to configure a route to the internet via the Internet Gateway. The correct answer is option D.
Explanation:
When an Internet Gateway is attached to a VPC, it becomes a gateway to the internet for instances within the VPC. To allow traffic to flow to and from the internet, we need to create a custom route table that has a route to the internet gateway.
In this scenario, we have two subnets - a public subnet and a private subnet. The public subnet is intended for resources that need to be publicly accessible, such as web servers, while the private subnet is intended for resources that should not be directly accessible from the internet, such as databases.
To enable internet connectivity for instances in the public subnet, we need to create a custom route table for the public subnet and add a route that sends all non-local traffic (0.0.0.0/0) to the Internet Gateway.
Option A is incorrect because it specifies the destination as the entire VPC CIDR block, which includes both the public and private subnets. This would result in all traffic, including traffic to the private subnet, being sent to the Internet Gateway, which is not desired.
Option B is incorrect because it specifies the destination as the entire CIDR block of the public subnet, which is too restrictive. Traffic to other subnets in the VPC, such as the private subnet, would not be able to reach the internet.
Option C is incorrect for the same reason as option B.
Therefore, the correct answer is option D, which specifies a route for all non-local traffic to be sent to the Internet Gateway.