I. Introduction to Amazon VPC
Amazon Virtual Private Cloud (VPC) allows you to provision a logically isolated section of the AWS cloud. A VPC works similarly to a traditional network but offers the flexibility and scalability of the cloud.
A VPC exists within an AWS Account, a specific Region, and spans multiple Availability Zones (AZs).
AWS services like EC2, RDS, and ELB exist inside a VPC, while S3, DynamoDB, Route53, and IAM reside outside the VPC.
II. Key Concepts:
- AWS Account: Each AWS account can contain multiple VPCs.
- Region: A VPC is created in a specific AWS Region, and resources within the VPC can only communicate with each other within the same Region.
- Availability Zone (AZ): Each AWS Region consists of multiple Availability Zones, each a physically isolated location. A VPC can span multiple Availability Zones for fault tolerance.
- CIDR (Classless Inter-Domain Routing): A VPC is defined by an IPv4 CIDR block (e.g., 10.0.0.0/16) and an IPv6 CIDR block (/56). CIDR determines the range of IP addresses available within the VPC.
- Subnet: Subnets are created within a VPC and are associated with a specific AZ. Each subnet is assigned a CIDR block that is a subset of the VPC CIDR block. Subnets can be Public (internet-accessible) or Private (isolated from the internet).
- Route Table: A route table determines how traffic flows from a subnet. Each subnet is associated with a route table. Route tables contain entries that define destinations and targets (e.g., Internet Gateway, NAT Gateway, VPC Peering).
- Internet Gateway (IGW): An Internet Gateway is a gateway that connects your VPC to the public internet.
- Security Group: A Security Group acts as a virtual firewall at the instance level, controlling traffic to and from an instance.
- Network ACL (NACL): A Network Access Control List acts as a firewall at the subnet level, controlling traffic to and from a subnet.
- Domain Name Server (DNS): Amazon provides a managed DNS service called Route 53 Resolver, which resolves domain names for instances in your VPC.
III. Additional VPC Features
- NAT Gateway: A NAT Gateway allows instances in a Private subnet to connect to the internet without requiring public IP addresses.
- VPC Peering: VPC Peering connections allow you to connect two VPCs, enabling communication between instances in different VPCs.
- VPC Endpoint: A VPC Endpoint allows you to privately connect to AWS services like S3 and DynamoDB without going over the public internet. There are two types of VPC Endpoints:
- Gateway Endpoint: used for S3 and DynamoDB.
- Interface Endpoint: used for many other AWS services.
- Transit Gateway (TGW): A TGW acts as a central hub for connecting multiple VPCs and on-premises networks. TGW simplifies routing and connectivity management between networks.