Create Subnet

AWS CLI with Subnet

  1. Create a subnet based on VPC ID:
aws ec2 create-subnet --vpc-id vpc-xxxxxxxxxxxxxxxxx --cidr-block 10.0.1.0/24

Ensure subnets do not have overlapping CIDR blocks to avoid network conflicts. Each subnet must have a unique IP address range within the VPC.

AWS CLI

  1. Create a second subnet with a different CIDR:
aws ec2 create-subnet --vpc-id vpc-xxxxxxxxxxxxxxxxx --cidr-block 10.0.2.0/24

Replace vpc-xxxxxxxxxxxxxxxxx with the actual VPC ID received from the VPC creation step. Use the --availability-zone parameter if you want to specify a particular AZ.

AWS CLI