VPCs, subnets, traffic controls and private connectivity
What a VPC is made of: the one route-table line that makes a subnet public, the two firewalls and which of them can refuse a single address, the ways out to the internet and to AWS services, and the two ways in from your own building.
Lesson 6 of 11 in objective 3. Cloud technology and services, part of AWS Certified Cloud Practitioner (CLF-C02).
One line in a route table decides public from private
A VPC is your own network inside a Region, cut into subnets that each live in one Availability Zone. The entire public-versus-private distinction comes down to a single entry: a subnet is PUBLIC if its route table sends 0.0.0.0/0 to an internet gateway, and private if it does not. Nothing else about the subnet makes it one or the other, which is why "attach an internet gateway and route the private subnets to it" is a contradiction in terms rather than a design.
A route table chooses a next hop by DESTINATION address, and that is worth stating because a question will offer a route as a way to block an attacker. There is no source-based routing here, so you cannot route one client away; the tool that expresses "everyone except this address" belongs to the firewalls below.
The guest list and the blacklist
A security group is attached to an instance's network interface, contains allow rules only, and is stateful: traffic you permitted in is permitted back out without a matching rule. Every rule is evaluated together and anything not allowed is denied by default. That last property is the most common misconception on this objective in either direction — there is no deny rule to add, so you cannot subtract one address from a rule that allows the world.
A network ACL sits on the SUBNET, is stateless, and holds both allow and deny rules evaluated in number order until one matches. It is therefore the only one of the two that can express "keep the site public but refuse this one address", and it applies to everything in the subnet at once. Removing the rule that allows port 443 from the world would also work, in the sense that it stops the attacker and every genuine visitor together. For a flood at real scale the purpose-built tools are AWS WAF and AWS Shield.
Getting out, and staying on the AWS network
Instances in a private subnet that must fetch operating system patches need a way out that is not also a way in, and that is a NAT gateway: it translates connections the private instances START and returns the replies, while offering nothing an outside party can connect to. It lives in a public subnet, is scoped to one Availability Zone — so a resilient design has one per zone — and is billed per hour plus per gigabyte processed. Giving each server a public address instead satisfies the outbound half of the requirement and breaks the inbound half completely.
VPC endpoints give private access to AWS services without an internet gateway, a NAT gateway or a public address, and there are two kinds whose difference shows up on the bill. GATEWAY endpoints exist for Amazon S3 and DynamoDB, are entries in a route table, and carry no charge — which is why several terabytes a month of S3 traffic currently leaving through a NAT gateway is both a security answer and a cost answer. INTERFACE endpoints, powered by AWS PrivateLink, put a network interface with a private address in your subnet for most other services and are billed per hour and per gigabyte.
Reaching a VPC from your own building
A stem that mentions terabytes a day, performance that must not vary, traffic that never touches the public internet, and an accepted lead time of several weeks is describing AWS Direct Connect in four separate clauses. A stem that wants encryption, cheaply, this afternoon is describing an AWS Site-to-Site VPN. A common production arrangement is both, with the VPN standing by as the backup for the dedicated circuit.
Two neighbours are offered against these and neither reaches outside AWS. VPC peering connects one VPC to another, including across accounts and Regions, and has no concept of a data centre. AWS Transit Gateway is a hub that simplifies connecting many VPCs and on-premises links together, and it still needs a Direct Connect or a VPN underneath it to reach the building at all.
DNS is a layer above the load balancer
Amazon Route 53 is the authoritative DNS service, and it answers one question: which address does this name resolve to. Its routing policies — simple, weighted, latency-based, failover, geolocation, geoproximity and multivalue — are how you express a global answer, and its health checks are what stop it handing out an endpoint that has stopped responding. It also registers domains.
Elastic Load Balancing answers a different question one level down: which of my healthy targets gets this request, inside one Region. Sending visitors to whichever of two Regional deployments answers them fastest therefore takes BOTH — a latency-based policy with health checks to choose the Region, and a load balancer inside each Region to spread the requests across instances and zones. A question offering only one of the two is testing whether the layers are separate in your head.
Worth carrying in
- VPC
- Your own network in one Region, cut into subnets that each sit in one Availability Zone.
- Route table
- Chooses the next hop by DESTINATION.
0.0.0.0/0to an internet gateway is what makes a subnet public. - Internet gateway
- The VPC's door to the internet, in both directions.
- NAT gateway
- Outbound-only for private subnets. One per zone for resilience; per hour and per gigabyte.
- Security group
- Instance-level, stateful, allow rules only. No deny exists.
- Network ACL
- Subnet-level, stateless, allow and deny, read in number order.
- VPC endpoint
- Private path to AWS services. Gateway for S3 and DynamoDB and free; interface via PrivateLink and charged.
- AWS Direct Connect
- A dedicated circuit. Consistent bandwidth and latency, weeks of lead time.
- AWS Site-to-Site VPN
- Encrypted tunnel over the internet. Fast to set up, as steady as the internet is.
- Amazon Route 53
- Authoritative DNS, routing policies and health checks. Chooses a Region, not a server.
- AWS WAF
- Filters HTTP requests by rule. With AWS Shield, the purpose-built answer to a flood.
What the exam does with this
- Security groups have no deny rule. "Block this one address and leave the site public" can only be a network ACL, and the security-group option is written to be chosen.
- A subnet is public because its route table sends
0.0.0.0/0to an internet gateway. Nothing else in the question makes it public or private. - A NAT gateway lets private instances start connections out and lets nothing start one in. Public addresses on each instance meet the first half of that and break the second.
- Gateway endpoints exist for S3 and DynamoDB and cost nothing; interface endpoints cover most other services and are billed. A stem that mentions the NAT gateway bill is pointing at the gateway endpoint.
- Direct Connect for bandwidth and latency that do not vary, at weeks of lead time; Site-to-Site VPN for encryption within the hour. The lead time in the stem usually gives it away.
- Route 53 chooses which Region a visitor is sent to; a load balancer chooses which instance serves them. A global failover design needs both, and a question will offer one.
- Objective
- 3. Cloud technology and services
- Share of the exam
- 34% (the whole objective)
- Questions in this lesson
- 5
- Signed for by a person
- 0
Partly checked. None of the 5 questions here has been read against the cited source by a person. 5 questions have been checked against their cited clause by an automated pass — which is not the same thing, and is not a signature.
Only questions a person has signed for are used in mock exams here. That is the whole difference between the two kinds of checking above.
Questions in this lesson
- A single IP address is flooding a public web tier with junk requests. The security groups on the instances currently allow port 443 from anywhere, which is correct — the site is public. The team wants to block that one source address across every instance in the public subnets. What do they do? machine-checked
- Application servers sit in private subnets in a VPC. They must be able to download operating system patches from vendor repositories on the internet, but nothing on the internet may be able to open a connection to them. Which design does this? machine-checked
- A bank moves several terabytes a day between its own data centre and AWS. It needs bandwidth and latency that do not vary with internet conditions, and traffic that never traverses the public internet. It has accepted both the monthly cost and a lead time of several weeks. Which connectivity option is being described? machine-checked
- Instances in a private subnet write several terabytes a month to Amazon S3. That traffic currently leaves through a NAT gateway. Security wants it to stay on the AWS network, and finance has noticed the NAT gateway's data processing charges. What addresses both? machine-checked
- A company has deployed the same web application into two Regions and owns the domain example.com. Visitors should be sent to whichever Regional deployment answers them fastest, and away from one that has stopped responding. Which TWO components deliver that? machine-checked
Drill this lesson
A lesson is one sitting: the trainer draws a short run from these questions alone and spaces the ones you get wrong.
Practise VPCs, subnets, traffic controls and private connectivity
The rest of objective 3
- Ways in: console, CLI, SDKs and infrastructure as code
- Regions, Availability Zones and edge locations
- EC2 and choosing an instance type
- Containers, serverless, auto scaling and load balancing
- Relational, NoSQL and in-memory databases, and moving them
- VPCs, subnets, traffic controls and private connectivity — you are here
- Object storage and the S3 storage classes
- Block, file and hybrid storage, lifecycle rules and backup
- Machine learning and analytics services
- Messaging, integration and business applications
- Developer tools, end-user computing, front end and IoT