This lab will guide you through exploring the existing AWS networking infrastructure in your account. You’ll examine two VPCs with different configurations and understand key networking concepts like routing tables, subnets, and VPC endpoints.
Your group identifier for this lab is “groupXY” where XY is your assigned group number.
By the end of this lab, you will have:
Questions to consider:
Open your EC2 instance terminal (from the previous lab) and run:
# List all VPCs and find eks_vpc
aws ec2 describe-vpcs --query 'Vpcs[?Tags[?Key==`Name` && Value==`eks_vpc`]].[VpcId,CidrBlock,State]' --output table
# Get the VPC ID for eks_vpc (replace vpc-xxxxx with actual ID from above)
export EKS_VPC_ID=$(aws ec2 describe-vpcs --query 'Vpcs[?Tags[?Key==`Name` && Value==`eks_vpc`]].VpcId' --output text)
echo "EKS VPC ID: $EKS_VPC_ID"# List subnets in eks_vpc
aws ec2 describe-subnets --filters "Name=vpc-id,Values=$EKS_VPC_ID" --query 'Subnets[*].[SubnetId,CidrBlock,AvailabilityZone,Tags[?Key==`Name`].Value|[0]]' --output tableKey observation: Note the CIDR block (10.0.0.0/16) and how subnets are distributed.
# List ALL route tables in the VPC
aws ec2 describe-route-tables --filters "Name=vpc-id,Values=$EKS_VPC_ID" --query 'RouteTables[*].[RouteTableId,Tags[?Key==`Name`].Value|[0],Associations[?Main==`true`]|length(@)]' --output tableNow let’s examine route table associations:
# Show detailed route table associations
aws ec2 describe-route-tables --filters "Name=vpc-id,Values=$EKS_VPC_ID" --query 'RouteTables[*].[RouteTableId,Associations[*].SubnetId,Associations[?Main==`true`]]' --output jsonTrick Question Time:
Go back to the VPC Console and check:
The Answer: The default/main route table exists but has no subnet associations. All subnets are explicitly associated with custom route tables.
# Get nsrc-lab VPC details
export NSRC_VPC_ID=$(aws ec2 describe-vpcs --query 'Vpcs[?Tags[?Key==`Name` && Value==`nsrc-lab`]].VpcId' --output text)
echo "NSRC Lab VPC ID: $NSRC_VPC_ID"
# Compare CIDR blocks
aws ec2 describe-vpcs --vpc-ids $EKS_VPC_ID $NSRC_VPC_ID --query 'Vpcs[*].[Tags[?Key==`Name`].Value|[0],CidrBlock]' --output tableKey observation: Note the different CIDR block (10.30.0.0/16).
# Look for VPC endpoints in nsrc-lab
aws ec2 describe-vpc-endpoints --filters "Name=vpc-id,Values=$NSRC_VPC_ID" --query 'VpcEndpoints[*].[VpcEndpointId,ServiceName,VpcEndpointType,State]' --output tableExploration Challenge:
Let’s get more details:
# Get detailed endpoint information
aws ec2 describe-vpc-endpoints --filters "Name=vpc-id,Values=$NSRC_VPC_ID" --query 'VpcEndpoints[*].[VpcEndpointId,ServiceName,RouteTableIds,PolicyDocument]' --output jsonQuestions to consider:
Let’s analyze if these VPCs can be peered:
EKS VPC: 10.0.0.0/16
NSRC Lab VPC: 10.30.0.0/16Analysis Questions:
If you were to create a VPC peering connection between these VPCs, here are the steps you would follow:
Final Questions:
VPC Architecture Patterns:
Route Table Insights:
VPC Peering Requirements:
Cost Optimization: