Bitzu

SAA-C03 ยท Network security in the VPC

Public and private subnets in a VPC

Internet gateway, route tables and what makes a subnet public or private, placing web, app and database tiers in the right subnets.

Key points

  • Public subnet: route table sends 0.0.0.0/0 (::/0 for IPv6) to an internet gateway attached to the VPC.
  • Private subnet: no such route.
  • Each subnet uses one route table: an associated custom table or, by default, the main route table.
  • Local route in every table: all subnets in the VPC reach each other.
  • Three-tier: internet-facing load balancer in public subnets; app servers and databases in private; each tier in at least two AZs.

Source: https://docs.aws.amazon.com/vpc/latest/userguide/subnet-route-tables.html

Practice questions

Single choice

What actually makes a subnet in a VPC a public subnet?

  1. Its route table has a route to an internet gateway
  2. Its security group allows inbound traffic from 0.0.0.0/0
  3. Its CIDR block is larger than the other subnets
  4. Its network ACL allows all inbound traffic
Show answer

Answer: A. Its route table has a route to an internet gateway

A subnet is public because the route table associated with it has a route to an internet gateway. Security groups, network ACLs and CIDR size filter or size traffic but never create a path to the internet.

Select all that apply

Apart from a security group that allows the traffic, which of these must be in place for clients on the internet to connect directly to an EC2 instance over IPv4?

  1. An internet gateway attached to the VPC
  2. A route to that internet gateway in the subnet's route table
  3. A public IPv4 or Elastic IP address on the instance
  4. A NAT gateway in the same subnet as the instance
  5. A VPC endpoint associated with the subnet
Show answer

Answer: A. An internet gateway attached to the VPC, B. A route to that internet gateway in the subnet's route table, C. A public IPv4 or Elastic IP address on the instance

Direct inbound reachability needs an internet gateway attached to the VPC, a route to it in the subnet's route table, and a public IPv4 or Elastic IP address on the instance. A NAT gateway only provides outbound connections, and a VPC endpoint is for private access to AWS services, not for inbound internet traffic.

True or false

A database placed in a private subnet cannot receive any traffic from other subnets in the same VPC.

Show answer

Answer: False

False. Every route table contains a local route for the VPC CIDR, so subnets inside the VPC can reach each other. "Private" only means there is no route to an internet gateway; access between tiers is controlled with security groups and network ACLs.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More SAA-C03 topics in this module