Virtual networks
Your own private address space in the cloud
A virtual network is a private range of addresses inside a region, divided into subnets.
Machines in the cloud need a network to live on, and you build it yourself. Pick a region. Inside it you create a virtual network and give it a range of private addresses. This one is ten dot zero dot zero dot zero, slash sixteen. Then you cut that range into subnets, here one in each zone, and place your machines in them. The slash sixteen gives the network sixty-five thousand addresses, and each slash twenty-four subnet has two hundred and fifty-six. Nothing outside can reach this network, and nothing inside can leave it, until you add a way through.
Virtual networks · Going deeper · 1 of 2
Reading 10.0.0.0/16: the slash counts fixed bits
CIDR notation gives a starting address and the number of fixed bits. A /16 has 65,536 addresses, a /24 has 256, and the provider reserves a few in every subnet.
Virtual networks · Going deeper · 2 of 2
VPC, VNet and VPC: what differs between providers
An AWS subnet lives in one zone; Azure and Google subnets cover a region; a Google VPC is global.
Public and private subnets
A route to the internet decides what can be reached from outside
A public subnet has a route to an internet gateway; a private subnet does not.
The most important decision in a cloud network is what the outside world can reach. Here is a virtual network. Attach an internet gateway to it, and give one subnet a route to that gateway. That subnet is now public. A web server in it has a private address, and a public one the world can call. The other subnet has no such route. It is private. The database inside has only a private address. The web server can reach it, because both are inside the network. Nobody on the internet can.
Public and private subnets · Going deeper · 1 of 2
Route tables: what makes a subnet public
A route table sends traffic by destination. A default route to an internet gateway is the only thing that makes a subnet public.
Public and private subnets · Going deeper · 2 of 2
A NAT gateway: out, but not in
A NAT gateway lets private machines start connections to the internet while refusing connections from it.
Security groups
Every port is closed until a rule opens it
A security group is a firewall around a machine. It blocks everything except what its rules allow.
A route makes a machine reachable. A firewall decides what may actually arrive. Each group of machines sits inside a security group. This one has a single rule: allow port four four three, the port for secure web traffic, from anywhere. Someone tries port twenty-two, the remote login port. No rule allows it, so it is dropped. The database has its own group, and its rule is stricter. Allow the database port, but only from machines in the web group. So a request from the internet straight to the database goes nowhere. Nothing was written to block it. Nothing allowed it.
Security groups · Going deeper · 1 of 2
Four firewalls compared: stateful and stateless
Security groups, Azure NSGs and Google firewall rules are stateful. The AWS network ACL guards a whole subnet and is stateless.
Security groups · Going deeper · 2 of 2
Before the firewall: DDoS protection and the web application firewall
DDoS protection absorbs floods at the edge and a WAF filters malicious web requests before the security group sees them.
Load balancers
One address in front of many servers
A load balancer spreads requests across servers in several zones and uses health checks to skip any that fail.
One server is one point of failure, so real systems run several. That raises a question: which one do users connect to? They connect to none of them. They connect to a load balancer, which has the one address everyone uses. Behind it sit four servers, two in each zone. The balancer hands each request to one of them in turn, so the work is shared. It also checks each server every few seconds. This one has stopped answering, so the balancer sends it nothing, and the other three take a third of the requests each. No user sees an error.
Load balancers · Going deeper
Layer 4 and layer 7: two kinds of load balancer
A network load balancer forwards connections by port; an application load balancer reads each web request and can route by its path.
DNS
The name decides where the user lands
Managed DNS answers a name with an address, and can pick the nearest or the healthiest region.
Before any of this, the user’s device has to find you. It asks the domain name system: where is shop dot example dot com? Your managed DNS service holds the answer, and a rule for choosing it. The application runs in two regions, and the service checks the health of both. From Paris, Ireland is eighteen milliseconds away and Virginia ninety-five. So it answers with the Irish address. And the user connects there. If Ireland failed its health check, the next person to ask would be given Virginia instead, with no one changing anything.
DNS · Going deeper · 1 of 2
Routing rules: weighted, latency, failover and geolocation
Routing rules let one name return different addresses: by percentage, by speed, by health or by country.
DNS · Going deeper · 2 of 2
Domains, zones and records
A managed DNS service does three jobs: it registers the domain, hosts its records and checks the health of what they point to.
A managed DNS service does three jobs: it registers the domain, hosts its records and checks the health of what they point to. The parts. Domain the name you register and renew each year, such as example.com. Route 53 and Google Cloud Domains can register it; Azure DNS hosts names registered elsewhere. Zone the container for all the records of one domain. On Route 53 it is called a hosted zone. A private zone answers only inside your virtual network. Record one line that maps a name to an answer. Records you will meet. Every record has a TTL, the number of seconds an answer may be remembered. A long TTL means fewer questions and slower changes; a short one the reverse. Lower it a day before a planned move.
The parts
- Domain the name you register and renew each year, such as example.com. Route 53 and Google Cloud Domains can register it; Azure DNS hosts names registered elsewhere.
- Zone the container for all the records of one domain. On Route 53 it is called a hosted zone. A private zone answers only inside your virtual network.
- Record one line that maps a name to an answer.
Records you will meet
Connecting your own building
Two ways in: a VPN over the internet, or a dedicated line
A VPN is an encrypted tunnel over the internet; a dedicated line is private fibre with steady, high capacity.
Most organisations do not move everything at once. For years, some systems stay in their own building and must talk to the ones in the cloud. So the two networks are joined, and machines on each side use private addresses as if they shared one network. There are two ways to do it. A VPN is an encrypted tunnel across the public internet. It can be working in hours, and carries a little over a gigabit a second, at whatever speed the internet allows that day. A dedicated line is a private fibre connection. It takes weeks to install and costs more, and in return gives up to a hundred gigabits a second, steadily.
Connecting your own building · Going deeper · 1 of 2
Joining networks to each other: peering and hubs
Peering links two virtual networks privately. A hub such as Transit Gateway or Virtual WAN replaces a mesh of peerings.
Connecting your own building · Going deeper · 2 of 2
Private endpoints: reaching a service without the internet
A private endpoint gives a provider’s service a private address in your subnet, so the traffic stays off the public internet.
The whole path
One request passes six steps, and only one faces the internet
DNS, the edge, a load balancer in a public subnet, then servers and a database in private subnets: the standard shape.
Put the pieces together and follow one request. A user types your name. DNS turns it into the address of the nearest healthy region. Images and other fixed files come straight from an edge location close by. Anything else arrives at the load balancer, the only part with a public address. It picks a healthy server. That web server, in a private subnet, runs your code. And it reads from a database that accepts one port, from the web servers only. Almost every web application in the cloud has this shape.
The whole path · Going deeper
What moving data costs
Data in is free. Data transfer out to the internet, and traffic between zones and regions, is billed per gigabyte.
Lesson complete
You finished “Networking”
Nicely done.