0% completed
Networking for Cloud Architects
On This Page
The Private Network and Its Addresses
Public and Private Subnets
Security Groups and Network ACLs
Connecting Networks
Private Endpoints
Hybrid Connectivity
DNS and Content Delivery
Using This in an Interview
Key Takeaways
Practice Questions
A customer pays at a checkout in one of the retailer's 140 stores. How does that sale reach the order database, which now runs in the cloud?
The sale crosses the store's network, a link to the cloud, a private network inside the cloud, and two sets of traffic rules. Each part is a design decision. A wrong decision either blocks the sale or exposes the database to the internet. This lesson follows the path one part at a time.
The Private Network and Its Addresses
A virtual private cloud (VPC) is a private network that a customer defines inside one cloud region, and no traffic enters or leaves it unless a route and a rule allow it. A region is a geographic area where the provider runs several availability zones, which are separate data centers.
A VPC's addresses are written as CIDR blocks: a starting address and the number of fixed leading bits. An address has 32 bits, so 10.20.0.0/16 fixes 16 bits and leaves 16 free. That gives 2 to the power of 16, or 65,536 addresses.
The VPC is divided into subnets, smaller blocks that each sit in one availability zone. A /24 subnet leaves 8 free bits, so it has 256 addresses. AWS reserves 5 addresses in every subnet, which leaves 251 for servers.
The retailer chose ranges that do not overlap because two networks with the same addresses cannot route to each other.
| Network | CIDR block | Addresses |
|---|---|---|
| Cloud VPC | 10.20.0.0/16 | 65,536 |
| Old data center | 10.0.0.0/16 | 65,536 |
| Stores, one /24 each | 10.100.0.0/16 | 256 blocks of 256 |
The stores' range holds 256/24 blocks, leaving room for 116 more stores beyond the current 140.
Public and Private Subnets
A public subnet has a route to the internet; a private subnet does not. A route table is the list of rules that decides where traffic for each address range goes, and the most specific matching range wins.
An internet gateway connects a VPC to the internet. Only the load balancers sit in public subnets, so customers can reach them. The store servers and the order database sit in private subnets, so nothing on the internet can start a connection to them.
Private servers still need to call out, for software updates and the payment provider. A NAT gateway in a public subnet sends their requests to the internet and returns the replies, but it accepts no connection that starts outside.
Route table for the private application subnets Destination Target 10.20.0.0/16 local (inside the VPC) 10.0.0.0/8 transit hub (stores and data center) 0.0.0.0/0 NAT gateway (everything else)
Traffic to 10.20.5.9 matches both 10.20.0.0/16 and 10.0.0.0/8. The /16 range is more specific, so the traffic stays inside the VPC.
Security Groups and Network ACLs
A security group is stateful, while a network ACL is stateless.
A security group is a set of allow rules attached to a server or a database. It is stateful: when it allows a request in, it allows the reply out automatically. The order database's group allows only the database port, such as 5432 for PostgreSQL, and only from the application servers' group.
A network ACL (access control list) is a set of allow and deny rules on a whole subnet. It is stateless: it checks each packet alone, so the reply needs its own rule. A missing reply rule is a common cause of connections that time out with no error message. Most designs use security groups as the main control and keep network ACLs simple.
Connecting Networks
Peering connects two networks directly, while a transit hub connects every network through one central router. Peering links exactly two VPCs, and traffic cannot pass through one peered VPC to reach a third. Connecting n networks in a full mesh, where every network links directly to every other, needs n times (n minus 1) divided by 2 links: 10 links for 5 networks, and 45 for 10.
A transit hub needs one attachment for each network, so 10 networks need 10 attachments. On AWS, the hub is Transit Gateway. The retailer attaches its VPC, the store VPN connections, and the data center link to one hub.
Private Endpoints
Managed services such as S3 and DynamoDB have public addresses. A private endpoint gives a VPC a private path to such a service, so the traffic stays off the internet and does not pass through the NAT gateway, which charges for each gigabyte it processes. On AWS, gateway endpoints serve S3 and DynamoDB, and interface endpoints (PrivateLink) serve most other services.
Hybrid Connectivity
A site-to-site VPN is fast to set up but crosses the internet, while a dedicated private link takes weeks to order but gives steadier latency.
A site-to-site VPN is an encrypted tunnel between a site's router and the cloud over the public internet. It can be ready in hours. A standard AWS tunnel carries up to 1.25 Gbps, and a large-bandwidth tunnel on a transit hub carries up to 5 Gbps. However, latency, the time that data takes to cross the network, varies with internet traffic along the path.
A dedicated private link is a physical connection from the customer's equipment to the provider at a partner location. On AWS, it is Direct Connect, with dedicated speeds of 1, 10, 100, or 400 Gbps, and hosted speeds from 50 Mbps to 25 Gbps through partners. Its latency is steadier, because the traffic does not share the public internet.
The retailer used both. Each store opens a VPN over its internet line, because one sale is a few kilobytes. The data center used a 1 Gbps Direct Connect link during the migration, with a VPN as backup. The 60 applications hold about 40 TB of data.
40 TB = 40,000 GB x 8 = 320,000 gigabits 320,000 gigabits / 1 Gbps = 320,000 seconds, about 89 hours or 3.7 days
Spread across three waves, 3.7 days of copying at full speed was acceptable, so a 10 Gbps link was not needed.
DNS and Content Delivery
DNS translates names into addresses. A private DNS zone lets servers find the order database by a name such as orders-db.internal. The time to live (TTL) of a DNS record is the number of seconds that clients may keep the old answer. During each wave, the team switched traffic by changing one DNS record with a 60-second TTL, so clients picked up the new address within about a minute. On AWS, DNS is Route 53.
A content delivery network (CDN) keeps copies of files on servers in many cities, so each customer downloads images from a nearby server. The retailer's 160 GB of product images are served through a CDN, and object storage receives only the requests that the CDN cannot answer. On AWS, the CDN is CloudFront.
Using This in an Interview
When you draw a network, follow one request from the user to the data, and name each control on the way.
"A checkout sends the sale over the store's VPN to a transit hub, and the hub routes it to the private application subnet. The database sits in its own private subnet, and its security group accepts only the application servers. The data center used a 1 Gbps Direct Connect link during migration, because 40 TB takes about 3.7 days at that speed."
A mid-level answer places the parts correctly. A senior answer also plans address ranges that do not overlap and explains the link choice with numbers.
Expect two follow-up questions:
- "Why not peer every VPC?" Peering needs n times (n minus 1) divided by 2 links and does not pass traffic through, so a hub is simpler beyond three or four networks.
- "What if the VPN is down?" Store checkouts should queue sales locally and send them when the tunnel returns.
Key Takeaways
- Plan CIDR blocks that do not overlap with any network you must connect.
- Keep servers and databases in private subnets; only load balancers face the internet.
- Security groups are stateful; network ACLs are stateless.
- A transit hub scales better than peering; a dedicated link gives steadier latency than a VPN.
The next lesson, Identity and Security Foundations, covers who and what is allowed to use these networks and the data inside them.
Practice Questions
1. How many server addresses does a /26 subnet provide on AWS?
<details><summary>Show answer</summary>59. A /26 leaves 6 free bits, so it has 2 to the power of 6, or 64 addresses. AWS reserves 5, which leaves 59.
</details>2. A network ACL allows inbound traffic to the database port, but every connection times out. What is the likely cause?
<details><summary>Show answer</summary>The ACL has no outbound rule for the replies. A network ACL is stateless, so replies need their own rule. A security group would allow them automatically.
</details>3. The retailer grows to 8 VPCs. How many peering links would a full mesh need?
<details><summary>Show answer</summary>28. 8 times 7 divided by 2 is 28. A transit hub would need only 8 attachments.
</details>Reading Progress
0%
On This Page
The Private Network and Its Addresses
Public and Private Subnets
Security Groups and Network ACLs
Connecting Networks
Private Endpoints
Hybrid Connectivity
DNS and Content Delivery
Using This in an Interview
Key Takeaways
Practice Questions