Many developers use AWS as a virtual data center to deploy various services like EC2 instances, RDS instances, etc. These instances or machines need to be stored somewhere in the data center and also need to be connected to the internet. This is where VPC comes into the picture.
Instances can also be referred to as the deployment of service and can also be called a machine throughout this blog. VPC is an isolated network in a region that spans all the availability zones in that region. So, when you create an AWS account, it provides you with default VPC. Default VPC provides you with few things, these are:
- IP address ranges/CIDR block
- Subnets in availability zones
- Routers to route out to the internet
- Security groups and network access control lists (NACL’s) for security
I will provide you with a brief idea about:
- IP addressing
- Creating Subnets
The IP address stands for Internet Protocol address. It is a numerical label assigned to each device that is connected to a computer network either via the internet or via the intranet. It is basically used for communication. The functions of an IP address are:
- Host or Network Interface Identification
- Local Addressing
AWS provides some range of IP addresses with its default VPC so that anything that will be deployed in that VPC will get a specific IP address from that range of IP addresses. IP address ranges are denoted with the CIDR block.
Most IP addresses fall under some RFC ranges. RFC ranges are reserved IP address ranges for private networks hence they don’t exist publicly on the Internet and if you create something in a VPC, it will not show up on the internet.
So, when you create a VPC in AWS, you specify a CIDR block saying that all the machines that are connected to the network will be deployed in this VPC and will receive an IP address from some RFC. This is the fundamental concept for developers.
What is Subnet?
Another thing that developers must be aware of is our subnets. Subnets or subnet masking is a logical division of an IP Network. We call the practice of dividing a network into two or more networks subnetting. IPv4 addresses on the network may be categorized by its Subnet Mask or Netmask, which is also the bitmask that, when applied by a bitwise AND operator to any IP address on the network, yields the routing prefix.
We also express subnet masks in dotted-decimal notation, like an address. Each deployment scenario in an existing network varies the benefits of subnetting. In the address location architecture of the internet using CIDR blocks and in large enterprises, it is necessary to allocate address spaces efficiently and subnetting may also enhance the routing efficiency.
We know VPC’s are specific to a region and subnets specific to availability zones. Subnets are subnetworks inside a VPC. Since machines are launched in a specific subnet, they receive IP addresses from the address range of Subnets and subnets receive address ranges from the address range of the VPC.
Hence, each subnet belongs to a VPC. By default, IPv4 addresses assigned and developers can also configure the machines to receive IPv6 addresses.