AWS - VPC and networking
What is VPC?
- Virtual network dedicated for your AWS account
- Isolated from other networks in AWS
- Virtual network resembles a Traditional network
- Launch AWS resources, like EC2 instances into your VPC
What is Subnet?
- Subnet is a small network within a VPC
- Subnet is a Range of IP addresses in your VPC
- We can multiple Subnets within a Single VPC
- We can launch AWS resources into a Subnet that we select
- Use a Public Subnet for Resources that are connected to Internet
- Use a Private Subnet for Resources that are connected to Internet
What is Routing Table?
- A Route table contains a Set of Rules, called Routes
- Routes are used to determine where network traffic is directed
- Each Subnet comes with a default Routing table
- Each Subnet must be associated with a Route table - this table controls the routing for the Subnet
- A subnet can be associated with Only one Route table
- We can associate Multiple Subnets with the same Route table
What is Internet Gateway?
- Virtual router that connects a VPC to the Internet
- A IGW [router] is horizontally scalable, highly available VPN component
- VPC is a high broad network and public traffic will pass through IGW
- IGW allows communication between instances in your VPC and the Internet
- Provide a target in your VPC route tables for Internet-routable traffic
- Perform network address translation(NAT) for instances that have been assigned public IP addresses
Create VPC -> Subnets -> EC2
Attach an Internet gateway to a VPC to enable communication with the Internet. Now our VPC got the Internet connection.
Route Table = specifies how packets are forwarded between the Subnets within your VPC, the Internet and your VPN connection.
2 Routing Tables are attached to VPC
2 new Routing tables - one for Public Subnet and one for Private Subnet.
Public Subnet - own routing table
Private Subnet -own routing table
Decide which Subnet will be attached to Internet Gateway? Public Subnet
How to config Subnet and Route table
Edit the Route table - of the [Public] Subnet = Internet gateway
[ Private ] Subnet -> Route table -> Set new Route
[ Public ] Subnet -> Route table -> Set new Route ->
Save the New route of the Route table for the [Public] Subnet