AWS VPC Contd..
- All the subnets in the AWS VPC are private by default, they dont have internet access.
- The internet access can be enabled to the vpc by using internet gateway. Now the route table entry has to be added to forward the network packets to internet gateway.
- Create a vpc and verify for the existence of the default route table.
- This default route table allows all the traffic with in vpc.
- Lets create a internet gateway
- The ip address restrictions in cidr notation
10.10.0.0/16 => 10.10.x.x (specific network)
10.10.0.5/32 => 10.10.0.5 (specific ip)
0.0.0.0/0 => x.x.x.x (Any ip)
- Lets add a route between route table and igw for internet access
- Route table can be associated to the subnet. The default route table will act as a route table for all the subnets which are not associated to a specific route table.
- Public Subnet: A subnet which can access internet and can be accessed from internet
- Private Subnet: A subnet which cannot be accessed from internet.
- A subnet can be made public if it is associated with route table which has access to internet gateway and private if not.
-
Lets create a new route table in the vpc
- private rt
- public rt
- private rt
-
Subnets can be made public by associating with public route table
- Now lets create an ec2 instance in public subnet
- Try to login using ssh command => It should allow
- Create an ec2 instance in private subnet, enable public ip (for testing) & try to login using ssh command => connection is timed out.
-
Try to create the following from AWS CLI
- VPC
- 2 subnets
- create internet gateway and attach to vpc
- Create a public rt
- Create a private rt