RousselTMLEARNING

Cloud computing

AWS networking: VPC, subnets, routing and security

Design an AWS network: VPCs and CIDR ranges, public and private subnets, route tables, Internet and NAT gateways, security groups and NACLs, endpoints, peering, Transit Gateway, Route 53 and CloudFront.

1. VPC and subnets #

Your private network in AWS.

Principle #

A VPC is an isolated network within a region, defined by an address range (CIDR, for example 10.0.0.0/16). It is split into subnets, each in a single availability zone. A subnet is public if its route table sends 0.0.0.0/0 to an Internet Gateway, private otherwise.

Reference VPC architecture
Private instances reach the Internet (updates) through the NAT Gateway, without being reachable from outside.

The building blocks #

ElementRole
Internet GatewayInbound and outbound Internet access for public subnets
NAT GatewayOutbound access for private subnets (one per AZ for high availability)
Route tableWhere to send traffic based on the destination
VPC EndpointPrivate access to S3, DynamoDB or other services without going through the Internet
Peering / Transit GatewayConnecting VPCs (Transit Gateway for dozens of VPCs and the corporate network)

2. Filtering #

Security groups and NACLs.

Comparison #

Security groupNACL
Applies toA network interface (instance, database, load balancer)A subnet
StateStateful: the response is allowed automaticallyStateless: allow both directions
RulesAllows onlyAllows and denies, evaluated by number
Common useMain filtering, references between groupsGuardrail, blocking an address range

Example #

aws ec2 create-security-group --group-name app --description "Instances applicatives" --vpc-id vpc-0abc
# n'autoriser que le trafic venant du groupe de l'équilibreur
aws ec2 authorize-security-group-ingress --group-id sg-app --protocol tcp --port 8080 --source-group sg-alb
Good practice: Reference security groups rather than IP addresses: the rule automatically follows instances as they come and go.

3. Exposing and distributing #

DNS, load balancing and caching.

Services #

  • Elastic Load Balancing: ALB (HTTP, routing by path and host), NLB (TCP/UDP, very low latency).
  • Route 53: managed DNS, latency-based routing, geolocation, failover on health checks.
  • CloudFront: global CDN in front of S3 or a load balancer, with TLS and AWS WAF protection.
  • Site-to-site VPN or Direct Connect to connect the company's data center.

Checking #

aws ec2 describe-route-tables --filters Name=vpc-id,Values=vpc-0abc --output table
aws ec2 describe-security-groups --group-ids sg-app
aws ec2 create-flow-logs --resource-type VPC --resource-ids vpc-0abc --traffic-type REJECT \
  --log-destination-type cloud-watch-logs --log-group-name vpc-rejets --deliver-logs-permission-arn <role>

Related articles

Observability on AWS: CloudWatch, X-Ray, Application Signals, ADOT, Managed Prometheus and Grafana

A complete overview of observability on AWS: CloudWatch components (metrics, logs, alarms, Application Signal…

Understanding AWS: global infrastructure, accounts, tools and pricing

The essential basics for getting started with Amazon Web Services: regions, availability zones and points of …

IAM: identities, roles and policies on AWS

Secure access to AWS with IAM: users, groups, roles and JSON policies, permission evaluation, MFA, IAM Identi…

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!