The provided transcript focuses on adding subnets to a Virtual Private Cloud (VPC) within AWS, distinguishing between public and private subnets, and understanding the reservation of IP addresses within each subnet. Here's a summary and key points organized for clarity:
Adding Subnets to a VPC
- Objective: Create two subnets within a single availability zone of a VPC, one public and one private.
Understanding Subnets
- Definition: A subnet is a sub-range of IPv4 addresses within your VPC.
- Subnets within the same VPC are logically separated but not physically separated. All subnets within a VPC share the same underlying network infrastructure. Instances within different subnets of a VPC can communicate privately with each other through their private IP addresses.
- Subnets that are in different Availability Zones within the same region can communicate with each other without additional configuration. Instances within different subnets of a VPC can communicate privately using private IP addresses as long as the appropriate route tables are configured correctly.
- A security group acts as a virtual firewall for your instance to control inbound and outbound traffic.
- Reserved IP Addresses: AWS reserves the first four and the last IP addresses in each subnet range, making them unavailable for EC2 instances.
- Network address [10.0.0.0]
- VPC router address [10.0.0.1]
- Amazon-provided DNS mapping address [10.0.0.2]
- Reserved for future use [10.0.0.3]
- Network broadcast address (unused due to AWS's non-support for broadcast within a VPC) [10.0.0.255]
Planning for IP Address Requirements
- Reserved IP Addresses Impact: When planning the number of IP addresses needed for EC2 instances within a subnet, account for AWS's reservation of five IP addresses.
- Example Calculation:
- For 29 IP addresses, a /27 subnet won't suffice (32 total - 5 reserved = 27 available < 29 needed).
- Opt for a /26 subnet instead (64 total - 5 reserved = 59 available > 29 needed).
Key Takeaways
- Subnet Types: The distinction between public and private subnets primarily involves their access and routing configurations.
- IP Address Planning: Accurately planning the required size of subnets is crucial to accommodate the desired number of EC2 instances, factoring in AWS's reservation of specific IP addresses.
Exam Tip
- When calculating the required subnet size to meet EC2 instance IP address needs, always subtract the five reserved IP addresses from the total available in a given subnet CIDR block to determine the actual number of usable IP addresses.
The next step in the process will involve creating these subnets and further configuring them for their roles within the VPC.
Even if public IP addresses are assigned to instances, as long as the instances are within the same VPC and region, traffic between them is confined within the highly reliable AWS network and does not traverse the public internet.