AWS Cloud Architecture & Security Lab
Deep dive into production-grade AWS Cloud Networking, IAM security policy simulation, S3 encryption compliance, EC2/ECS/EKS compute selection, and Serverless + CDN execution flows.
☁️ AWS VPC Subnetting & CIDR Block Planning
In Amazon Web Services, a Virtual Private Cloud (VPC) spans an entire AWS Region. Subnets are strictly bound to a single Availability Zone (AZ). AWS automatically reserves 5 IP addresses per subnet for network routing, DNS, and broadcast emulation.
🗺️ Multi-AZ Subnet Topology (9 Total Subnets)
| Subnet Name | Type & Isolation | Availability Zone | CIDR Block | Total IPs | Usable Host IPs | Target Egress Route |
|---|---|---|---|---|---|---|
| Public Subnet 1A | Public Subnet (IGW) | us-east-1a | 10.0.1.0/24 | 256 | 251 IPs | Internet Gateway (IGW) |
| Private App Subnet 1A | Private App (NAT) | us-east-1a | 10.0.20.0/24 | 256 | 251 IPs | NAT Gateway (us-east-1a) |
| Isolated DB Subnet 1A | Isolated DB (No Egress) | us-east-1a | 10.0.60.0/24 | 256 | 251 IPs | Isolated (No Egress) |
| Public Subnet 1B | Public Subnet (IGW) | us-east-1b | 10.0.4.0/24 | 256 | 251 IPs | Internet Gateway (IGW) |
| Private App Subnet 1B | Private App (NAT) | us-east-1b | 10.0.50.0/24 | 256 | 251 IPs | NAT Gateway (us-east-1b) |
| Isolated DB Subnet 1B | Isolated DB (No Egress) | us-east-1b | 10.0.120.0/24 | 256 | 251 IPs | Isolated (No Egress) |
| Public Subnet 1C | Public Subnet (IGW) | us-east-1c | 10.0.7.0/24 | 256 | 251 IPs | Internet Gateway (IGW) |
| Private App Subnet 1C | Private App (NAT) | us-east-1c | 10.0.80.0/24 | 256 | 251 IPs | NAT Gateway (us-east-1c) |
| Isolated DB Subnet 1C | Isolated DB (No Egress) | us-east-1c | 10.0.180.0/24 | 256 | 251 IPs | Isolated (No Egress) |
Generated Infrastructure as Code (IaC)
# Terraform VPC & Multi-AZ Subnets
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
enable_dns_hostnames = true
enable_dns_support = true
tags = { Name = "enterprise-production-vpc" }
}
resource "aws_internet_gateway" "igw" {
vpc_id = aws_vpc.main.id
}
resource "aws_subnet" "subnet_1" {
vpc_id = aws_vpc.main.id
cidr_block = "10.0.1.0/24"
availability_zone = "us-east-1a"
map_public_ip_on_launch = true
tags = { Name = "Public Subnet 1A" }
}
resource "aws_subnet" "subnet_2" {
vpc_id = aws_vpc.main.id
cidr_block = "10.0.20.0/24"
availability_zone = "us-east-1a"
map_public_ip_on_launch = false
tags = { Name = "Private App Subnet 1A" }
}
resource "aws_subnet" "subnet_3" {
vpc_id = aws_vpc.main.id
cidr_block = "10.0.60.0/24"
availability_zone = "us-east-1a"
map_public_ip_on_launch = false
tags = { Name = "Isolated DB Subnet 1A" }
}🔑 IAM Policy JSON Simulator & Access Control
AWS IAM evaluates policies using a strict hierarchy: Explicit Deny always overrides any Allow. By default, all requests are implicitly denied unless an explicit Allow matches the principal, action, resource, and context conditions.
⚡ Request Context Simulator
📦 Amazon S3 Security Controls & Default Encryption
Amazon S3 buckets store mission-critical data. Hardening S3 requires activating Block Public Access (BPA), enforcing Default Server-Side Encryption (SSE-KMS), and blocking unencrypted HTTP transport via bucket policies.
Blocks public bucket ACLs and policies enterprise-wide.
Encrypts all S3 objects at rest prior to storage.
Protects against unintended deletes and ransomware overwrites.
Denies unencrypted HTTP requests in transit.
Write Once Read Many compliance protection.
Hardened S3 Bucket Policy (JSON)
Enforces TLS & SSE Encryption{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "EnforceTLSRequestsOnly",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::my-secure-bucket",
"arn:aws:s3:::my-secure-bucket/*"
],
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
}
},
{
"Sid": "DenyUnencryptedObjectUploads",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::my-secure-bucket/*",
"Condition": {
"StringNotEquals": {
"s3:x-amz-server-side-encryption": "aws:kms"
}
}
}
]
}⚡ EC2 vs ECS vs EKS Container Infrastructure
AWS offers three primary compute paradigms: Amazon EC2 for raw virtual machines, Amazon ECS for AWS-native container management, and Amazon EKS for enterprise Kubernetes orchestration.
Amazon EC2
Elastic Compute Cloud
- • Full root SSH & OS kernel access
- • Security Groups per Instance
- • EBS block storage & AMI snapshots
- • High management overhead (OS patching)
Amazon ECS
Elastic Container Service
- • Lightweight Task Definitions & Services
- • Deep integration with ALB & IAM Roles
- • Runs on Fargate serverless or EC2
- • Low operational complexity
Amazon EKS
Elastic Kubernetes Service
- • Pure upstream Kubernetes API (kubectl)
- • AWS VPC CNI for Pod IP allocation
- • Helm, ArgoCD, & Istio Ecosystem
- • Requires K8s expertise & control plane fee
| Feature Metric | Amazon EC2 | Amazon ECS | Amazon EKS |
|---|---|---|---|
| Orchestration API | Auto Scaling Groups | ECS Task Definitions | Kubernetes Manifests (kubectl) |
| Networking Model | ENI per EC2 Instance | awsvpc mode (ENI per Task) | AWS VPC CNI (IP per Pod) |
| Serverless Capacity | No (Provisioned Instances) | Yes (AWS Fargate) | Yes (EKS Fargate Profiles) |
| Management Overhead | High (OS, Patches, Drivers) | Low (Fully AWS Managed) | Medium-High (K8s Addons) |
🚀 Lambda Serverless Execution Flow & CloudFront CDN
AWS CloudFront caches dynamic and static assets at 600+ Edge Points of Presence (PoPs) globally. When cache misses occur, traffic routes through API Gateway to trigger AWS Lambda functions. Cold starts occur when Lambda provisions a fresh execution container environment.
CloudWatch Logs Stream (/aws/lambda/api-handler)
Real-time TelemetryEC2 Pricing Calculator — On-Demand vs Reserved vs Spot
Slide the fleet size, pick a region and commitment, then watch the live monthly / annual cost comparison. Reserved Instances trade flexibility for up to 52% savings (3-yr All Upfront); Spot adds another discount layer but instances can be reclaimed at any time.
Fleet Configuration — m5.large (2 vCPU / 8 GiB)
All Upfront = 100% of term billed now · Partial Upfront = 40% now, 60% spread across the term · No Upfront = fully billed monthly.
Monthly Spend — 10 × m5.large @ us-east-1
1-Year Total Cost of Ownership — 10 × m5.large
| Model | Per-Instance Hourly | Per-Instance Monthly | 1-Year Total (Fleet) | Savings vs On-Demand |
|---|---|---|---|---|
| On-Demand | $0.096 | $70.080 | $8,410 | — |
| Reserved (1yr · All Upfront) | $0.063 | $46.253 | $5,550 | −34% |
| Spot | $0.029 | $21.024 | $2,523 | −70% |
Short-term spikes, dev/test environments, unknown or elastic workloads. Highest flexibility, highest price.
Predictable, always-on production fleets (24×7 baselines). Upfront payment = bigger discount; 3-yr beats 1-yr; savings continue across the entire term.
Batch jobs, CI runners, stateless web tiers that survive interruptions. AWS can reclaim capacity with 2-minute notice — never run your only database on Spot.
Prices approximate public m5.large rates for educational comparison; Spot factors are representative discounts, not live market bids. Regional On-Demand: us-east-1 $0.096/hr · us-west-2 $0.096/hr · eu-west-1 $0.108/hr.
Disaster Recovery & Multi-Region Architecture
Set your Recovery Time Objective (RTO) and Recovery Point Objective (RPO), then see which of the four canonical AWS strategies can hit them — what the recovery timeline looks like and what it actually costs. The business asks for numbers; this planner turns RPO/RTO into a strategy.
RTO & RPO Sliders
RTO (Recovery Time Objective) is the maximum downtime you can tolerate — how fast service must be back. RPO (Recovery Point Objective) is the maximum acceptable data loss, i.e. how far back in time your last good copy may be. Together they set the severity of the disaster: Total Downtime = RPO + RTO
Best fit for your targets: Warm Standby ($$$/mo) — the cheapest viable strategy given RTO 15m / RPO 3m.
Pick a DR Strategy
Warm StandbyWarm model
Target: RTO 15m / RPO 3m — this strategy fitsA complete copy of the production environment runs in the DR region at reduced scale. Aurora Global Database and DynamoDB Global Tables keep data nearly synchronous across regions. Recovery is a scale-up plus DNS flip — RTO in minutes, RPO near zero.
Scale up the DR Auto Scaling group, promote the Aurora global secondary, and switch Route 53 failover routing.
Aurora Global Database and DynamoDB Global Tables replicate continuously; catch-up lag is seconds, so no restore step is needed.
Recovery Timeline
Detect
Route 53 health checks and CloudWatch alarms detect the impaired region and trigger the runbook.
Failover
Scale up the DR Auto Scaling group, promote the Aurora global secondary, and switch Route 53 failover routing.
Recover data
Aurora Global Database and DynamoDB Global Tables replicate continuously; catch-up lag is seconds, so no restore step is needed.
Verify & reroute
App endpoints pass health checks, routing flips, and the warm standby is confirmed serving full traffic.
Cost vs Recovery Time Tradeoff
Estimated Monthly Cost — Warm Standby
$5,200Model: replication cost scales with freshness (typical RPO 3m ÷ your RPO 3m, clamped 0.5–4×) and compute cost +15% when your RTO target 15m is below the strategy's typical 15m. Faster recovery is always the expensive direction — the slope steepens hard below the 1-hour mark.
Strategy Comparison Matrix
| Strategy | Best-case RTO | Best-case RPO | Cost tier | Data replication approach |
|---|---|---|---|---|
| Backup & Restore | 12h – 24h | 12h – 24h | $/mo · 0.8k | Back up data to another region; rebuild and restore on demand. |
| Pilot Light | 30m – 4h | 15m – 1h | $$/mo · 2.4k | A pilot light stays lit: core data + tiny fleet always run. |
| Warm StandbySELECTED | 5m – 30m | 1m – 5m | $$$/mo · 5.2k | Full environment, scaled down, ready to absorb traffic. |
| Multi-Site Active-Active | 0m – 5m | 0m – 1m | $$$$/mo · 9.8k | Both regions serve production traffic with seamless failover. |
AWS Security Hub & Compliance Framework
Toggle regulatory frameworks in scope, audit each control, and watch the compliance score and domain radar update in real time.
Trust Services Criteria covering security, availability, and confidentiality of customer data.
Security & Privacy Rule safeguards for protected health information (PHI) stored or processed in AWS.
Payment Card Industry Data Security Standard for cardholder data environments (CDE).
Center for Internet Security foundational checks enforced via Security Hub controls.
National Institute of Standards control families mapped to AWS security services.
📡 Security Domain Coverage
Share of passed controls per domain across in-scope frameworks.
🧮 Compliance Score Calculator
Passed controls ÷ total controls across in-scope frameworks.
Tip: toggle frameworks out of scope or flip controls to PASS/FAIL — score, radar, and breakdowns recompute instantly.
SOC 2 — Requirement Checklist
AICPA TSC · click any control to toggle PASS/FAIL
HIPAA — Requirement Checklist
45 CFR §164 · click any control to toggle PASS/FAIL
PCI-DSS — Requirement Checklist
v4.0 · click any control to toggle PASS/FAIL
CIS Benchmark — Requirement Checklist
AWS Foundations v2.0 · click any control to toggle PASS/FAIL
NIST 800-53 — Requirement Checklist
Rev 5 / CSF · click any control to toggle PASS/FAIL
🧩 Step Functions & Event-Driven Orchestration
Amazon Step Functions builds state machines in the Amazon States Language (ASL) to orchestrate Lambda functions and AWS services. States transition via Next pointers, fan out with Parallel, branch on data with Choice, and recover from failures with Retry / Catch — build a workflow below, read the generated ASL JSON, then watch it execute step by step.
A directed graph of states defined in ASL. Every state declares a Next transition or ends the machine.
Standard: up to 1 year, exactly-once, auditable. Express: up to 5 minutes, at-least-once, high throughput.
Retry applies backoff policies for transient errors. Catch routes failures to a fallback state instead of failing.
Start executions from EventBridge rules, API Gateway, S3 events, SQS, or the StartExecution SDK call.
🧱 Step Palette
📋 Workflow EditorNext/End transitions mirror ASL
🗺️ Workflow Diagram
Live view — arrows follow each state's Next transition
▶ Execution Simulator
Tip: set a Task's simulator toggle to inject a failure, then re-run to watch Retry backoff and Catch routing. Set $.itemType to poster in the Image Thumbnail template to see a Choice loop back.
API Gateway & Microservices Patterns
Design production-grade serverless APIs: choose between REST and HTTP APIs, build routes with method-level authorizers, tune throttling and caching, and export a deploy-ready OpenAPI specification.
⚖️ REST API vs HTTP API — Choosing Your Gateway
Both API types sit in front of your backend and share the same Lambda/HTTP/private integrations — but REST APIs carry the full feature set (usage plans, caching, models, canary deployments) while HTTP APIs trade those features for lower cost and lower latency. The right choice depends on which capabilities your API actually needs.
| Capability | REST API | HTTP API |
|---|---|---|
| Pricing | $3.50 per 1M requests | $1.00 per 1M requests |
| Latency | Higher (payload transforms, validation) | ~10–30% lower (minimal processing) |
| WebSocket support | ✅ Yes (chat, streaming) | ❌ No |
| Usage plans & API keys | ✅ Yes | ❌ No |
| Per-route throttling & quotas | ✅ Yes | ❌ Account-level throttling only |
| Stage-level caching | ✅ Yes (0.5–237 GB) | ❌ No native cache (use CloudFront) |
| Request validation (models) | ✅ Yes (JSON schemas) | ⚠️ Basic only |
| Authorizers | IAM, Lambda, Cognito, JWT | IAM, Lambda, JWT / OIDC |
| Canary releases / traffic shifting | ✅ Yes | ❌ No |
| Custom domains | ✅ Yes | ✅ Yes (free ACM certs) |
| WAF integration | ✅ Yes | ✅ Yes |
| Private endpoints (VPC) | ✅ Yes | ✅ Yes (VPC Link) |
| Endpoint types | Edge-optimized · Regional · Private | Regional only |
| OpenAPI import / export | ✅ Full (swagger + OpenAPI 3) | ✅ OpenAPI 3 subset |
| Service integrations (SQS, Kinesis, Step Functions) | ✅ Yes | ✅ Yes |
🎯 Use-Case Recommender
Pick a workload — the recommender highlights which API flavor fits and why.
HTTP APIs are cheaper and faster for straightforward Lambda/DynamoDB proxy integrations, with native JWT/OIDC authorizers when you need them.
💰 Cost Snapshot (monthly)
Request pricing is region-dependent (us-east-1 reference) · Cache adds $70.08/mo when enabled (1.6 GB × ~$0.06/GB/hr × 730h).
🛣️ Interactive Route Builder
Compose your API surface route by route. Each route pairs an HTTP method and path (with {pathParams}) with an integration target, an authorizer, and optional caching and request validation. The generated OpenAPI spec in Module 05 mirrors exactly what you build here.
🗂️ Deployed Routes (3) — 3 protected · 1 cached · 2 validated
| Method | Path | Integration | Authorizer | Flags | |
|---|---|---|---|---|---|
| GET | /pets | Lambda (AWS_PROXY) | IAM (SigV4) | CACHEVALIDATE | |
| POST | /pets | Lambda (AWS_PROXY) | Cognito User Pools | VALIDATE | |
| DELETE | /pets/{petId} | Lambda (AWS_PROXY) | Lambda Token |
🚦 Throttling, Caching & Validation
⏱️ Throttling (Account + Route Level)
REST APIs also support per-route usage-plan throttling; HTTP APIs are limited to account-level throttling. Burst capacity is a token bucket: short spikes up to 5,000 requests are absorbed before 429s.
⚡ Stage-Level Cache (REST APIs)
🧾 Request Validation
REST API request validators reject malformed requests before they reach your backend — a cheap first line of defense. Two modes:
Routes marked VALIDATE in Module 02 are exported with a "full" validator — 2/3 currently.
📜 OpenAPI Spec Generator
The spec below is generated live from your routes, authorizers, and throttling/cache settings. It can be imported directly into API Gateway (REST or HTTP API) or shared with clients via aws apigateway import-rest-api.
openapi: "3.0.1"
info:
title: "PetStore Microservices API"
version: "1.0.0"
description: "Designed with SubnetLab API Designer. 3/3 routes protected · throttling 10,000 rps / burst 5,000 · cache TTL 300s (encrypted)."
servers:
- url: "https://agmtgqi9me.execute-api.us-east-1.amazonaws.com/prod"
paths:
/pets:
get:
summary: "GET /pets"
operationId: "getPets"
responses:
200:
description: "Successful GET response"
400:
description: "Invalid request parameters or body"
500:
description: "Internal server error"
x-amazon-apigateway-integration:
type: "aws_proxy"
httpMethod: "GET"
timeoutInMillis: 29000
uri: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:123456789012:function:fnpetsHandler/invocations"
cacheKeyParameters:
- "method.request.querystring.version"
security:
- sigv4_auth: []
x-amazon-apigateway-request-validator: "full"
post:
summary: "POST /pets"
operationId: "postPets"
responses:
200:
description: "Successful POST response"
400:
description: "Invalid request parameters or body"
500:
description: "Internal server error"
x-amazon-apigateway-integration:
type: "aws_proxy"
httpMethod: "POST"
timeoutInMillis: 29000
uri: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:123456789012:function:fnpetsHandler/invocations"
security:
- cognito_user_pools: []
x-amazon-apigateway-request-validator: "full"
/pets/{petId}:
delete:
summary: "DELETE /pets/{petId}"
operationId: "deletePetspetId"
responses:
200:
description: "Successful DELETE response"
400:
description: "Invalid request parameters or body"
500:
description: "Internal server error"
x-amazon-apigateway-integration:
type: "aws_proxy"
httpMethod: "DELETE"
timeoutInMillis: 29000
uri: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:123456789012:function:fnpetspetIdHandler/invocations"
security:
- lambda_authorizer: []
components:
securitySchemes:
sigv4_auth:
type: "apiKey"
name: "Authorization"
in: "header"
x-amazon-apigateway-authtype: "awsSigv4"
lambda_authorizer:
type: "apiKey"
name: "Authorization"
in: "header"
x-amazon-apigateway-authtype: "custom"
cognito_user_pools:
type: "apiKey"
name: "Authorization"
in: "header"
x-amazon-apigateway-authtype: "cognito_user_pools"
x-amazon-apigateway-request-validators:
full:
validateRequestBody: true
validateRequestParameters: true
x-apigateway-throttling:
rateLimit: 10000
burstLimit: 5000
x-apigateway-cache:
enabled: true
ttlSeconds: 300
capacityGb: 1.6
encrypted: trueLive score across your whole API design
100% of routes protected (3/3) · 2 routes validated · caching on (encrypted) · throttling 10,000 req/s
Authorizer coverage (40) · Validation (20) · Cache enabled (10) · Cache encryption (10) · Throttle sane (10) · All routes protected (10)
CloudWatch & Full Observability Stack
Operate the complete AWS observability loop — simulated metric streams powering CloudWatch alarms and dashboards, log group inspection with live tails, and X-Ray distributed tracing service maps with waterfall trace analysis.
Simulated Metric Streams & Animated Line Charts
- sampling: 1 point / 1.3s
- window: last 48 points
- storage: CloudWatch Metrics → unified namespace
Alarm Threshold Configuration & Severity Levels
{
"OrdersAPICpuAlarm": {
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"AlarmName": "prod-cpu-SEV2",
"Namespace": "AWS/EC2",
"MetricName": "EC2 CPUUtilization",
"Statistic": "Average",
"Period": 60,
"EvaluationPeriods": 3,
"DatapointsToAlarm": 2,
"Threshold": 80,
"ComparisonOperator": "GreaterThanThreshold",
"TreatMissingData": "notBreaching",
"AlarmActions": [
"arn:aws:sns:us-east-1:123456789012:ops-oncall"
],
"Tags": [
{
"Key": "severity",
"Value": "SEV2"
}
]
}
}
}CloudWatch Log Groups & Stream Viewer
X-Ray Service Map & Trace Waterfall
- Avg latency
- 61 ms
- Error rate
- 1.8 %
- Instances
- 5 concurrent
Core checkout path. Emits custom subsegments for validation + persistence.
CloudWatch Dashboard Widget Layout Builder
Observability Loop Cheat Sheet
Collect → aggregate (avg/p95/sum) → store with retention. Agent-based + managed service integrations.
Threshold + operator over N evaluation periods → OK / ALARM / INSUFFICIENT_DATA → SNS, Auto Scaling, Lambda actions.
Log groups per service, retention policies, Insights queries, and log-metric filters driving alarms.
Trace IDs flow through segments; service maps show latency/errors per edge; sampling keeps overhead low.
🔐 Secrets Manager & Parameter Store — Secure Secret Lifecycle
Hierarchical parameters, KMS envelope encryption, automated rotation scheduling, cross-account trust policies, IAM evaluation, and versioned rollback with staging labels.
Secrets Hierarchy Visualizer
Path hierarchy with per-type encryption semantics — SecureString is envelope-encrypted with KMS, String / StringList are plaintext.
•••••••••••••••••
$ aws ssm get-parameter --name /prod/api/db/password --with-decryption
Rotation Schedule Configurator
Compose a rotation cadence, pick an execution window, and preview the exact schedule EventBridge will fire.
- 1Lambda creates a new secret version staged as AWSPENDING
- 2Database credentials are updated with the AWSPENDING value
- 3New version is tested against the live application
- 4AWSPENDING is promoted to AWSCURRENT
- 5Previous AWSCURRENT is relabeled AWSPREVIOUS for instant rollback
- 6AWSPENDING label is removed and the Lambda function completes
$ aws secretsmanager rotate-secret --secret-id prod/db/credentials \
--rotation-rules "AutomaticallyAfterDays=30,ScheduleExpression=\"cron(0 3 1 * ? *)\""{
"ScheduleExpression": "cron(0 3 1 * ? *)",
"State": "ENABLED",
"Targets": [
{
"Arn": "arn:aws:lambda:us-east-1:123456789012:function:rotate-prod-db",
"Id": "rotate-prod-db"
}
]
}Cross-Account Trust Policy Builder
Attach a resource-based policy to the secret so a role in another account can read it — the secret “trusts” the foreign principal.
Binds the grant to the exact role ARN — the strictest form of cross-account trust.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowCrossAccountSecretAccess",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::210987654321:role/app-prod-role"
},
"Action": [
"secretsmanager:GetSecretValue",
"secretsmanager:DescribeSecret"
],
"Resource": "arn:aws:secretsmanager:us-east-1:123456789012:secret:prod/db/credentials-AbC12d",
"Condition": {
"StringEquals": {
"aws:PrincipalArn": "arn:aws:iam::210987654321:role/app-prod-role"
}
}
}
]
}IAM Policy Evaluator for Secrets Access
Simulate an API request against an attachable identity policy — explicit Deny always wins, a matching Allow grants access, and everything else is implicitly denied.
Version History Viewer
Staging labels route clients: AWSCURRENT is the live value, AWSPREVIOUS enables instant rollback. arn:aws:secretsmanager:us-east-1:123456789012:secret:prod/db/credentials-AbC12d
{
"username": "db_admin",
"password": "••••••••••",
"host": "db-1.prod.internal",
"port": 5432,
"engine": "postgres"
}🌐 AWS Transit Gateway & the Hybrid Network
A Transit Gateway lets you connect VPCs, VPN tunnels, and Direct Connect virtual interfaces through one centrally-managed hub — replacing the non-transitive mesh of VPC peering connections. This module builds a live multi-VPC topology, detects CIDR overlaps, configures redundant IPsec tunnels, inspects route tables, and maps the Direct Connect path into the cloud.
VPC Peering
Two VPCs, simple needs
Non-transitive · no transitive routing
Transit Gateway
Many VPCs, cross-account, hybrid
Costs per attachment + GB processed
VPN (IPsec)
Quick hybrid link, encrypted
~100 Mbps per tunnel, internet-dependent
Direct Connect
Stable, low-latency, high-bandwidth
Weeks of physical provisioning
Feature Comparison — TGW vs Peering vs VPN vs Direct Connect
| Capability | VPC Peering | Transit Gateway | Site‑to‑Site VPN | Direct Connect |
|---|---|---|---|---|
| Transitive routing | ✗ no | ✓ central hub | – per tunnel | – per VIF |
| Cross-account / cross-region | ✓ accounts (peer role) | ✓ via Resource Access Manager, optional cross-region | ✓ to CGW anywhere | ✓ DX Gateway |
| Max scale (practical) | 125 peering conx / VPC | hundreds of attachments | ~50 Mbps/Gbps tunneled | 1–100 Gbps ports |
| Latency | low (direct VPC path) | adds 1–2 ms hop | internet fabric + ~30 ms | single-digit ms private |
| Bandwidth | up to ~1.4 Gbps / peer | aggregated over SD-WAN 100 Gbps | bandwidth of each tunnel | up to 100 Gbps / 10 × VIFs |
| Cost model | per GB for implicitly grouped | $0.02/GW-hr per attachment + per-GB | per-hour per-tunnel | port-hour + $0.02/GB egress |
| Propagates routes | no (manual route tables) | ✓ BGP-style propagation | ✓ BGP session per tunnel | ✓ BGP over VLAN (transit VIF) |
🕸️ Drag-to-Connect Topology Builder
Pick a connection type, then drag from a colored handle on one network to another to build peering, TGW, VPN and Direct Connect links. All nodes are draggable; overlapping CIDRs on linked networks are flagged in red.
Connection type
Links (7)
VPC CIDR assignments
Overlapping CIDRs on networks that share a path (directly or via the hub) light up red on the canvas — the TGW would Blackhole those routes.
📐 Overlap & Collision Detector
Networks that overlap cause ambiguous-routing / Blackhole behavior in both VPC route tables and on-prem routers. Add your network plan and this tool computes the exact collision range for every pair.
Network inventory
Pairwise overlap results1 COLLISION
Tools to renumber instead of colliding: supernet the shared range, or split with more specific prefixes so the longest-prefix-match decides deterministically.
🔐 AWS Site-to-Site VPN Builder
Generate a production-shaped dual-tunnel VPN (tunnel A + tunnel B) with IKE/IPSec phase settings and optional BGP failover. Wrong crypto values produce a classic "Phase 1 mismatch" — so build carefully.
Customer Gateway (on-prem side)
IKE & IPsec policies (both tunnels inherit)
Tunnel endpoints
=== AWS Site-to-Site VPN · Generated Device Configuration === Customer Gateway (CGW) Public IP : 203.0.113.10 BGP ASN : 65000 On-prem CIDR : 172.16.0.0/16 Tunnel A (primary) Inside CIDR : 169.254.10.0/30 AWS side IP : 169.254.10.1 CGW side IP : 169.254.10.2 Phase 1 (IKE) : AES256-SHA256, DH group 14, lifetime 28800s Phase 2 (IPsec): AES256-SHA256, DH group 14 (PFS), lifetime 3600s DPD : enabled (restart) BGP over VPN : enabled PSK (demo only): TgM_…cret Tunnel B (redundant) Inside CIDR : 169.254.11.0/30 AWS side IP : 169.254.11.1 CGW side IP : 169.254.11.2 Same IKE/IPsec profile; independent endpoint (203.0.113.10 secondary) Route propagation: 172.16.0.0/16 → TGW route table via VPN attachment Status : Tunnel A ACTIVE · Tunnel B STANDBY
AWS terminates the tunnel on two endpoints for HA. BGP (multi-VPN) detects the down path and rewrites routes within seconds — avoid pure static routing for production.
🧭 Route Table & Propagation Viewer
Inspect how routes flow through VPC main tables, the TGW hub, and VPN attachments. Toggle propagation and add static routes — conflicting prefixes with mismatched targets turn BLACKHOLE.
VPC Main Route Table
Production VPC · region us-east-1
The local VPC route is always present. Static + propagated routes decide how traffic leaves the VPC.
| Destination | Target | Type | Status |
|---|---|---|---|
| 10.0.0.0/16 | Local | LOCAL | BLACKHOLE |
| 10.1.0.0/16 | Transit Gateway Attach — vpc-dev | PROPAGATED | ACTIVE |
| 10.2.0.0/16 | Transit Gateway Attach — shared-vpc | PROPAGATED | ACTIVE |
| 10.0.1.0/24 | Transit Gateway Attach — partner-vpc | PROPAGATED | BLACKHOLE |
| 172.16.0.0/16 | VPN Attachment (TGW) | PROPAGATED | ACTIVE |
Add static route (this table)
Table stats
TGW route tables also learn cross-account prefixes from RAM-shared attachments — the partner VPC route above is one example.
⚡ Direct Connect Network Diagram
A dedicated private path bypasses the internet on the way into AWS. Configure the port, the virtual interface (VIF), and watch the BGP session light up.
AWS recommends MACsec on dedicated connections for link-layer encryption, and always transport the VIF over a VPN or private network when regulatory requirements demand it — DX itself is not encrypted at L2 by default.
For mission-critical, keep a second DX connection at a different location — BGP multipath + failover keeps the route table healthy.
Auto Scaling & Load Balancer Deep Dive
Production-grade elasticity: configure ALB path-based routing, compare ALB vs NLB, simulate target group health checks, build target-tracking / step / predictive scaling policies, and watch a live Auto Scaling group react to traffic in real time.
🔀 ALB Path-Based Routing Configurator
An Application Load Balancer evaluates incoming requests against listener rules from lowest priority number upward. The first rule whose condition matches wins and routes the request to its target group — no fall-through. Path patterns support a single trailing wildcard (/api/*).
➕ Add Listener Rule
| Priority | Condition (Path Pattern) | Action → Target Group | Port / Proto | |
|---|---|---|---|---|
| 1 | /api/* | API-TG | HTTP :8080 | |
| 2 | /admin/* | ADMIN-TG | HTTP :3000 | |
| 3 | /static/* | STATIC-TG | HTTPS :443 | |
| 4 | / (default) | WEB-TG | HTTP :80 |
🧪 Live Route Tester
4 rules evaluated in priority order
Request /api/users/42 matched pattern /api/*
⚖️ NLB vs ALB — Which One Do You Need?
ALB · Layer 7
Application- • HTTP / HTTPS / HTTP/2 / gRPC / WebSocket
- • Routes on path, host, header, query string
- • TLS termination with ACM certificates
- • Targets: EC2, IP, Lambda, ECS, EKS
- • Deep HTTP health checks + WAF integration
- • Cookie sticky sessions, redirects, auth
NLB · Layer 4
Transport- • TCP, UDP, TLS passthrough (no content inspection)
- • Static IP per AZ — ideal for allow-listing
- • Extreme throughput, sub-millisecond latency
- • Preserves client source IP end to end
- • Scales with millions of connections (long-lived)
- • Source-IP stickiness for UDP / WebSocket
| Feature | Application Load Balancer (L7) | Network Load Balancer (L4) |
|---|---|---|
| OSI Layer | Layer 7 (Application) | Layer 4 (Transport) |
| Protocols | HTTP, HTTPS, HTTP/2, gRPC, WebSocket | TCP, UDP, TLS passthrough |
| Static IPs | No — DNS name only | Yes — one static IP per AZ |
| TLS termination | Yes — ACM certificates | No — passthrough (offload on targets) |
| Content-based routing | Path, host, header, query, method | None — flow based on IP + port |
| Sticky sessions | Yes — cookie-based | Yes — source IP based |
| Health checks | Deep HTTP/HTTPS (path, status codes) | TCP or simple HTTP probe |
| Target types | Instances, IPs, Lambda, containers | Instances, IPs |
| Best for | Microservices, K8s ingress, serverless, canaries | UDP gaming, legacy TCP, extreme throughput, VPC endpoints |
🧭 Workload Advisor — what would you deploy?
Web storefront: HTTPS + WAF, path-based routing to microservices, cookie sticky sessions, canary deploys.
Content-based routing (path / host / query), TLS termination with ACM, cookie stickiness and WAF integration are all Layer-7 features. ALB is the right call.
💚 Target Group Health Check Simulator
The load balancer probes each registered target at the configured interval. A target is marked unhealthy only after unhealthy threshold consecutive failures — it then enters draining, finishes in-flight requests and is deregistered. A deregistered target can return to service after healthy threshold consecutive successes.
| Instance | AZ | Behavior | Consecutive Fails | Consecutive OKs | Status |
|---|---|---|---|---|---|
| i-0a1f2b | us-east-1a | 0 | 0 | InService | |
| i-0b3c4d | us-east-1b | 0 | 0 | InService | |
| i-0c5e6f | us-east-1c | 0 | 0 | InService | |
| i-0d7a8b | us-east-1a | 0 | 0 | InService |
📈 Scaling Policy Builder
required = ⌈ 62% ÷ 50% ⌉ = 2 instances
desired capacity: 3 · range [1 – 10]
Target tracking works like a thermostat: CloudWatch polls the metric, computes the capacity needed to bring it back to the target, and adjusts the desired count — with a warm-up window after each scale-out so new instances can finish booting before the next evaluation.
🖥️ Live Instance Count Visualization
Watch an Auto Scaling group react to a synthetic load. The group scales out when load crosses 78%, scales in below 28%, and respects a 2-tick cooldown between actions. New instances boot (Launching → InService); removed instances drain before termination.
Well-Architected Review & Maturity Radar
Self-assess your architecture against the six AWS Well-Architected pillars. Answer each question honestly — Yes, Partial, or No — and get a weighted maturity score, a radar chart of your posture, and prioritized improvement recommendations.
📊 Weighted Pillar Scores & Radar Chart
Scoring: Yes = 100% · Partial = 50% · No = 0% · unanswered questions count as 0. Each question carries a weight; each pillar carries a weight.
📋 Six Pillar Assessment
Operational Excellencew=1.0
Run and monitor systems to deliver business value and continually improve supporting processes and procedures.
Is all infrastructure provisioned through Infrastructure as Code (CloudFormation / CDK / Terraform) across every environment?
w=3Are deployments automated through CI/CD pipelines with automated tests, staged rollouts, and rollback strategies?
w=3Do you have centralized observability — structured logs, metrics, and distributed tracing — with actionable alerts?
w=2Are operational runbooks documented, and do you regularly run game days or incident response drills?
w=2Securityw=1.2
Protect data, systems, and assets while delivering business value through risk assessments and mitigation strategies.
Is IAM least privilege enforced — role-based access, no long-lived human access keys, and no root account usage?
w=3Is MFA required for all human users and are credentials rotated automatically?
w=2Is data encrypted at rest (KMS / SSE) and in transit (TLS 1.2+), with S3 Block Public Access enabled?
w=3Are detective controls active — CloudTrail, GuardDuty, Security Hub — with automated response to findings?
w=2Reliabilityw=1.2
Recover from failures quickly and scale seamlessly, so workloads meet agreed availability and durability targets.
Is the workload deployed across multiple Availability Zones with no single point of failure?
w=3Are backups automated (RDS snapshots, EBS snapshots, S3 versioning) and are restores tested regularly?
w=3Does capacity scale automatically to handle demand and replace failed instances without manual intervention?
w=2Are health checks and automated failover (Route 53, ALB, RDS Multi-AZ) configured for your critical paths?
w=2Performance Efficiencyw=1.0
Use computing resources efficiently to meet system requirements while maintaining efficiency as demand changes.
Are resources right-sized based on actual utilization data (CloudWatch metrics, Compute Optimizer)?
w=3Is the compute model matched to each workload — serverless (Lambda/Fargate), containers, or EC2 — including Graviton where beneficial?
w=2Do you use caching (CloudFront, ElastiCache, DAX) and async processing (SQS/SNS) to reduce load on hot paths?
w=3Do data stores scale horizontally — partitions, read replicas, managed services — rather than scaling up a single node?
w=2Cost Optimizationw=1.0
Run systems to deliver business value at the lowest price point while meeting functional and performance requirements.
Do you monitor spend with budgets, anomaly detection, and regular Cost Explorer reviews?
w=3Are Savings Plans / Reserved Instances used for stable baselines and Spot for interruptible workloads?
w=2Are idle or oversized resources — stopped EC2, unattached EBS, unused Elastic IPs — decommissioned regularly?
w=3Is storage tiered and governed by lifecycle policies (S3 Intelligent-Tiering, transitions, expiration)?
w=2Sustainabilityw=0.8
Minimize the environmental impact of running cloud workloads and maximize the efficiency of every unit of energy consumed.
Do you use the most efficient compute — Graviton, serverless, and right-sized instances — to minimize energy use?
w=3Is data storage minimized — lifecycle policies, deletion of stale data, and compression — to reduce storage footprint?
w=2Are non-production workloads (dev, test, staging) scaled down or shut down outside business hours?
w=2Do you consider carbon footprint in architecture choices — using the AWS Customer Carbon Footprint Tool and energy-efficient regions/services?
w=1🚀 Prioritized Recommendations
OUTSTANDING — NO IMPROVEMENT ITEMS DETECTED
Every question was answered Yes. Re-run the review with honest, real-world answers to uncover gaps — no architecture is perfect.