AWS has a service called as VPC (Virtual Private Cloud) for creating private networks.
VPC will be at a region level.
In AWS, we have infrastructure at AZ (Availability Zone), So we create subnets at az level
Subnet is at AZ level and one AZ can have multiple subnets. Subnet will be linked to only one AZ.(AZ => subnet can be classified as one to many)
Lets create our first vpc to run an ntier application. This ntier application has
- web servers
- app servers (business logic)
- db servers
- mgmt servers (administration)
Lets create vpc in oregon region
Oregon has 4 AZ’s and the region code is us-west-2
Now AZ’s will be
Lets create the subnets.
- web => us-west-2a
- app => us-west-2b
- db => us-west-2c
- mgmt => us-west-2d
Each subnet will have 200 devices 2^n ~= 200 n=8.
- VPC CIDR = 192.168.0.0/16
- web = 192.168.0.0/24
- app = 192.168.1.0/24
- db = 192.168.2.0/24
- mgmt = 192.168.3.0/24
Lets create vpc
Now lets add subnets
Create other 3 subnets
Lets delete this vpc
Now Lets create one more vpc as described in below image
Each subnet should be able to connect 200 devices
- AWS allows you to create subnet block between the sizes /28 (16 devices) to /16 (65536)
- In Each subnet you will not be able to use 5 ip addresses (x.x.x => subnet cidr)
- x.x.x.0 => Network Address
- x.x.x.1 => Reserved by AWS for VPC Router
- x.x.x.2 => Reserved by AWS for the ip address of DNS Server
- x.x.x.3 => Reserved by AWS for future usage
- x.x.x.255 => broadcast address
- Number of ip’addresses available in subnet is (2^n – 2), in the case of AWS it is (2^n-5)
- There is already a vpc in your region (default vpc)
- How to create networks from command line. Refer Here to install aws cli on your system.