How do you run servers, networks, logins and files on AWS?
This page covers the AWS building blocks that show up in almost every design interview: where AWS runs, servers (EC2), scaling, load balancers, containers, Lambda, private networks (VPC), DNS, a CDN, logins and permissions (IAM), and file storage (S3). Every number was checked on docs.aws.amazon.com on 2026-10-25.
TL;DR
AWS is a set of rented building blocks: you spread servers across Availability Zones, put them in a private network, give them roles instead of passwords, and keep files in S3.
A Region is one city-area. It holds several Availability Zones (AZs): separate data centers with their own power. Spread across AZs to survive one failing.
Compute goes from most control to least: EC2 servers → containers (ECS, EKS, Fargate) → Lambda functions (max 15 min per run, up to 10,240 MB memory).
A VPC is your private network. Public subnets route to an internet gateway. Private subnets reach out through a NAT gateway, which charges per GB.
IAM: give code a role, which hands out short-lived keys. Never bake long-lived keys into servers.
S3 is designed for 99.999999999% durability and has had strong read-after-write consistency since December 2020.
34
Regions in the docs table for a normal AWS account
11nines
S3 designed durability, 99.999999999% a year
900s
Lambda max timeout for normal functions
5
IP addresses AWS keeps in every subnet
—Words you need
Each jargon word once, in plain words glossary
Region
A geographic area, like Mumbai, with several separate data centers.
Availability Zone (AZ)
One or more data centers in a Region, with separate power.
Edge location
A small AWS site near users that caches content.
EC2 instance
A virtual server you rent by the second.
AMI
A saved disk image you start servers from.
EBS
A network disk that lives on after the server stops.
Auto Scaling group
A fleet that adds or removes servers to match load.
Load balancer
A front door that spreads requests over healthy servers.
Cold start
Extra delay when Lambda must build a fresh environment first.
VPC
Your own private, isolated network inside AWS.
Subnet
A slice of the VPC's addresses, inside one AZ.
CIDR
Address range notation; /16 means 65,536 addresses.
NAT gateway
Lets private servers call out; blocks calls coming in.
Security group
A firewall on each server that remembers replies (stateful).
IAM role
A set of permissions that code borrows with temporary keys.
STS
The AWS service that hands out those temporary keys.
Foundations
01Regions, Availability Zones, edge locations
Where AWS physically runs, and why you spread across AZs core
A Region is a place in the world, such as us-east-1 (N. Virginia). Inside it are Availability Zones. An AZ is one or more data centers with their own power, network and cooling. AZs in a Region are linked by fast private networks. So you can copy data between them with low delay.
Edge locations are much smaller sites in many more cities. CloudFront (the AWS CDN, a cache close to users) runs there. They do not run your servers.
Edge locations sit near users; Regions hold your servers, split into separate AZs.
In everyday words
A Region is a city. AZs are separate buildings in that city, each with its own power line. Edge locations are corner shops that keep copies of popular items.
Actually
The AWS docs define an AZ as "one or more discrete data centers, each with redundant power, networking, and connectivity, housed in separate facilities". The S3 docs add that AZs are "many kilometers" apart but "all are within 100 km (60 miles) of each other". The Regions docs page lists 34 Regions for a normal AWS account. Most show 3 AZs; us-east-1 shows 6. The marketing page counts differently: 39 geographic Regions, 124 AZs and 750+ CloudFront POPs. It includes Regions outside the standard account (for example China and GovCloud), so the two numbers do not clash. Checked 2026-10-25: AWS Regions, Global infrastructure.
Design for "one AZ dies": run at least two copies of everything in two AZs.
02Who secures what: the shared responsibility model
AWS secures the cloud; you secure what you put in it interview favourite
AWS calls this "security of the cloud" versus "security in the cloud". AWS guards buildings, hardware, and the virtualization layer (the software that splits one machine into many). You guard your data, your settings and your code. The line moves with the service. The more managed the service, the more AWS does.
Layer
EC2 (you rent a server)
Lambda / S3 / DynamoDB (managed)
Buildings, hardware, network
AWS
AWS
Host OS and virtualization
AWS
AWS
Guest OS patches
You
AWS
Your app code
You
You
Firewall rules, IAM permissions
You
You
Data and encryption choices
You
You
In everyday words
A landlord fixes the roof and the wiring. You lock your own door and decide who gets a key.
Actually
AWS's page says that for EC2 the customer manages "the guest operating system (including updates and security patches)", the apps and the security group setup. For S3 and DynamoDB, AWS runs the infrastructure and the platform; you manage data, encryption and IAM permissions. Source: AWS shared responsibility model.
"Is it AWS's fault?" Almost never for a leaked bucket or an open port: those settings are yours.
Instance families, ways to pay, and the two kinds of disk core
An EC2 instance is a virtual server. Its type name tells you its shape. In c7gn.xlarge, c is the family (compute-heavy), 7 the generation, gn extra options (Graviton CPU, more network), and xlarge the size.
Letter
Family
Good for
M
General purpose
Web apps, balanced work
C
Compute optimized
CPU-heavy work, encoding, game servers
R, X
Memory optimized / memory intensive
Caches, in-memory databases
T
Burstable performance
Low steady load with short spikes
I, D
Storage optimized / dense storage
Fast local disks, big data
P, G
GPU accelerated / graphics
Machine learning, rendering
You start an instance from an AMI (Amazon Machine Image: a saved disk image with the OS and your software). Baking your app into an AMI makes new servers start faster.
Ways to pay
Biggest discount off On-Demand, by way of paying
"Up to" numbers. Hover a bar for the source. Spot is a marketing-page claim, not a docs number.
Spot can be taken back
90%
Savings Plans / Reserved 1 or 3 yr
72%
On-Demand
0%
Show the full table
Option
How it works
Max discount
Catch
On-Demand
Pay by the second, no promise
0%
Most expensive per hour
Savings Plans
Promise a dollar amount per hour for 1 or 3 years
72%
You pay even if unused
Reserved Instances
Promise a specific instance type and Region for 1 or 3 years
72%
Less flexible; AWS now recommends Savings Plans
Spot
Spare capacity at a changing price
90%
AWS can take it back with a 2-minute warning
Two kinds of disk
Question
EBS volume
Instance store
Where is it?
A separate storage device you attach
Disks physically in the host computer
Survives stop or terminate?
Yes, it lives on independently
No, data is erased on stop, hibernate or terminate
Survives reboot?
Yes
Yes
AZ rule
Must be in the same AZ as the instance
Part of the instance
Use for
OS disk, databases
Caches, scratch files, buffers
In everyday words
On-Demand is a taxi. A Savings Plan is a monthly pass. Spot is a cheap standby seat you lose if a paying passenger shows up.
Actually
Docs (checked 2026-10-25): On-Demand is billed "by the second". Savings Plans and Reserved Instances are "a term of 1 or 3 years", with savings "up to 72%". A Spot interruption notice is "a warning that is issued two minutes before Amazon EC2 stops or terminates your Spot Instance". Instance store data "does not persist if the instance is stopped, hibernated, or terminated". EBS volumes "persist independently from the running life of an EC2 instance" and "the volume and instance must be in the same Availability Zone". EBS is copied across several servers inside one AZ; io2 Block Express is designed for 99.999% durability, other types 99.8–99.9%. Sources: purchasing options, Spot notices, instance store lifetime, EBS volumes.
Steady base load on Savings Plans, spikes on On-Demand, and retry-safe batch jobs on Spot.
Add servers when busy, remove them when quiet, and send traffic only to healthy ones core
An Auto Scaling group (ASG) keeps a fleet between a minimum and a maximum size. It starts servers from a launch template: a saved recipe with the AMI, instance type, key pair and security groups. A scaling policy decides when to change the size.
Two loops: load changes the size, and failed health checks replace servers.
Policy type
What it does
Use when
Target tracking
Keeps a metric near a target, like a thermostat (for example average CPU at 50%)
Default choice; AWS "strongly recommends" it
Step scaling
Adds more servers the bigger the alarm breach
You need different jumps for small and big spikes
Simple scaling
One fixed change, then a cooldown wait
Old setups; prefer the two above
Scheduled
Changes min, max or desired size at set times (cron)
Known peaks, like 9 a.m. on weekdays
Load balancers: three kinds
Type
OSI layer
Routes by
Best for
Application (ALB)
Layer 7 (HTTP)
Path, host, headers, method, query; can call Lambda
Web apps and microservices
Network (NLB)
Layer 4 (TCP, UDP, TLS, QUIC)
Flow hash; one TCP connection sticks to one target
Millions of requests per second, static IP per AZ
Gateway (GWLB)
Layer 3 (IP packets)
5-tuple flow hash, GENEVE on port 6081
Firewalls and traffic inspection boxes
A target group is the list of servers (or IPs, or Lambda functions) behind a load balancer rule. Health checks are set per target group.
Cross-zone load balancing decides if a load balancer node may send traffic to servers in other AZs. The docs example has 2 servers in AZ A and 8 in AZ B, with each AZ's node getting half the traffic:
Share of all traffic each single server gets
AWS docs example: 2 targets in AZ A, 8 in AZ B. Hover for details.
Cross-zone off, server in AZ A
25%
Cross-zone on, any server
10%
Cross-zone off, server in AZ B
6.25%
Show the full table
Setting
Per server in AZ A
Per server in AZ B
Cross-zone on
10%
10%
Cross-zone off
25%
6.25%
In everyday words
A shop manager watches the queue. When it gets long, she opens more tills from the same template. The door greeter sends shoppers only to tills that are open.
Actually
Docs (checked 2026-10-25): with ALB, cross-zone is "always enabled at the load balancer level" (you can turn it off per target group). For NLB and GWLB it is "disabled by default". An ALB needs at least two AZs. The load balancer DNS name has a TTL of 60 seconds so IPs can change quickly. The ASG health check grace period defaults to 300 seconds in the console but 0 from the CLI or SDK. When a scaling policy runs, the ASG never goes outside its min and max. Sources: How ELB works, grace period, dynamic scaling.
Put an ALB in front of an ASG spread over 2+ AZs, with ELB health checks turned on, so dead servers get replaced.
Less server work as you go right: EC2 → containers → functions core
A container packs your app with everything it needs, so it runs the same anywhere. AWS gives two ways to run many containers, and two places to run them.
Service
What it is
Pick it when
ECS
AWS's own container scheduler. You write a task definition (the blueprint); it runs tasks and services
You want simple, AWS-native containers
EKS
Managed Kubernetes. AWS runs the Kubernetes control plane
Your team already uses Kubernetes, or needs to move between clouds
Fargate
Serverless capacity for ECS or EKS: no servers to manage or patch
You do not want to manage the EC2 hosts under the containers
EC2 capacity
Containers on servers you choose and manage
You need special hardware (GPU) or the lowest price at large scale
Lambda: functions that run on events
Lambda runs your code when something happens: an HTTP call, a file landing in S3, a queue message. You pay only while it runs. Each running copy lives in an execution environment (a small isolated sandbox). Concurrency is how many copies run at the same moment.
Limit (checked 2026-10-25)
Value
Max run time per invocation
900 s (15 min)
Memory
128–10,240 MB
CPU
grows with memory; 1,769 MB = 1 vCPU
Default concurrency per Region
1,000
Sync request / response payload
6 MB each
/tmp disk
512–10,240 MB
Init phase limit (normal functions)
10 s
Scale-up rate per function
1,000 environments every 10 s
A cold start happens when no warm environment is free. Lambda must download your code, start the runtime and run your setup code first. After the call, Lambda freezes the environment and reuses it ("warm start").
In everyday words
EC2 is owning a car. Containers on Fargate are a rental car you just drive. Lambda is a taxi: it shows up per trip, but the first one of the morning takes longer to arrive.
Actually
Lambda docs: cold starts "typically occur in under 1% of invocations" and last "from under 100 ms to over 1 second". Concurrency = average requests per second × average duration in seconds (5,000 rps × 0.2 s = 1,000). Fixes: provisioned concurrency keeps environments pre-initialized (extra cost); SnapStart restores from a saved snapshot. Reserved concurrency is different: it caps a function and guarantees it a slice of the account pool. Lambda always keeps 100 units unreserved. Exceptions to the 15-minute cap exist: Lambda Managed Instances allow up to 90 min for async calls, and durable functions can run for up to a year. Sources: Lambda quotas, execution environment lifecycle, Lambda concurrency.
Short, spiky, event-driven work → Lambda. Long-running or steady services → containers on Fargate or EC2.
CIDR ranges, public and private subnets, internet gateway, NAT gateway, route tables interview favourite
A VPC (virtual private cloud) is a network only you use. You give it an address range in CIDR notation, for example 10.0.0.0/16. The number after the slash says how many bits are fixed. /16 leaves 16 free bits, so 65,536 addresses.
You cut the VPC into subnets. Each subnet lives in exactly one AZ. A route table on each subnet says where traffic may go. That route table, and nothing else, makes a subnet "public" or "private".
Requests come in through the gateway to the load balancer; private servers go out only through NAT.
Piece
What it does
Key fact
Internet gateway (IGW)
Connects the VPC to the internet
A subnet is public only if its route table has a route to an IGW
NAT gateway
Lets private servers start outbound connections
Outsiders cannot start a connection in. Charged per hour and per GB
Route table
Rules: "traffic for this range goes to that target"
Most specific match wins (longest prefix)
Subnet size
Between /28 and /16
AWS keeps 5 addresses per subnet
In everyday words
The VPC is a gated housing estate. The public subnet is the street with the front gate. The private subnet is the back lane with no gate: residents can post letters out through the NAT post office, but strangers cannot walk in.
Actually
Docs (checked 2026-10-25): in a 10.0.0.0/24 subnet AWS reserves .0 (network), .1 (VPC router), .2 (DNS), .3 (future use) and .255 (broadcast). A standard NAT gateway is "created in a specific Availability Zone". If its AZ goes down, "resources in the other Availability Zones lose internet access", so create one per AZ. It starts at 5 Gbps and scales to 100 Gbps. New: a regional NAT gateway spreads across AZs by itself and needs no public subnet. It can take up to 60 min to expand to a new AZ. Sources: subnet sizing, NAT gateway basics, regional NAT gateways, subnet types.
Only load balancers (and NAT) live in public subnets. Servers and databases live in private subnets.
Security groups vs NACLs, VPC endpoints, peering vs Transit Gateway interview favourite
Question
Security group
Network ACL
Works on
Each instance (its network card)
A whole subnet
Rule types
Allow only
Allow and deny
How rules are checked
All rules, then decide
In number order; first match wins
Reply traffic
Allowed automatically (stateful)
Must be allowed by its own rule (stateless)
Typical use
Main firewall
Extra guard rail, such as blocking one bad IP range
Stateful means the firewall remembers a conversation, so the reply gets in without a rule. Stateless means each packet is judged alone, so you must open the reply ports too.
VPC endpoints: reach AWS services without the internet
Endpoint type
Works with
How
Cost
Gateway endpoint
S3 and DynamoDB only
A route in your route table
No extra charge
Interface endpoint (PrivateLink)
Many AWS services and your own services
A network card with a private IP in your subnet
Billed
Joining VPCs
Peering is one-to-one. B to C needs its own link, or a hub.
Question
VPC peering
Transit Gateway
Shape
One-to-one links (a mesh)
A regional hub; every VPC attaches once
Transitive routing?
No
Yes, through its route tables
On-premises (VPN, Direct Connect)
Cannot share a peer's VPN or gateway
Attach VPN and Direct Connect gateways
Overlapping CIDRs
Not allowed
Plan non-overlapping ranges anyway
Cost
Pay for data across AZs or Regions
Per attachment per hour + per GB processed
Pick when
2–3 VPCs
Many VPCs, or VPCs plus an office network
In everyday words
Peering is a private footpath between two houses. Your neighbour's footpath does not let you into the third house. A Transit Gateway is a bus station every house connects to.
Actually
VPC docs: security groups are stateful and allow-only; network ACLs are stateless and evaluate rules "in ascending order until a match". Peering "does not support transitive peering relationships", and you "cannot create a VPC peering connection between VPCs that have matching or overlapping" CIDR blocks. A peer cannot use your IGW, NAT, VPN or gateway endpoint ("edge to edge routing"). Gateway endpoints: "There is no additional charge". Transit Gateway: "charged hourly for each attachment" plus traffic processed. Sources: SG vs NACL, peering basics, gateway endpoints, Transit Gateway.
Add an S3 gateway endpoint to every VPC: free, and S3 traffic stops paying NAT per-GB fees.
DNS that can route by health, weight, delay and place; a CDN at the edge core
Route 53 is AWS's DNS (the internet's phone book: name → IP). Each record has a routing policy that decides which answer to give.
Policy
Answer it gives
Example use
Simple
One fixed resource
A single web server
Weighted
Splits by the share you set
Send 10% to a new version (canary)
Latency
The Region with the lowest delay for this user
Same app in Mumbai and Frankfurt
Failover
Primary while healthy, else secondary
Active-passive disaster recovery
Geolocation
By the user's location
Country rules, local language
Geoproximity
By distance to your resources, with a bias you can shift
Move load between Regions
Multivalue answer
Up to 8 healthy records at random
Simple client-side spreading
IP-based
By the caller's IP range
Route an ISP's users to a set endpoint
CloudFront is the AWS CDN. A user's request goes to the edge location with the lowest delay. If the file is cached there, it is returned at once. If not, CloudFront fetches it from your origin (S3, a load balancer, any HTTP server).
In everyday words
Route 53 is a receptionist who can say "go to the nearest branch" or "that branch is closed, use this one". CloudFront is a chain of local warehouses stocked with copies of your goods.
Actually
CloudFront docs: by default a file stays in an edge cache for 24 hours; the minimum is 0 seconds and there is no maximum. Data from AWS origins (S3, ELB, API Gateway) to CloudFront "is always free"; you pay for data out to viewers and for requests. Route 53 docs list eight routing policies. Multivalue answers return "up to eight healthy records". Sources: What is CloudFront, Route 53 routing policies.
Latency or failover records in Route 53 plus CloudFront in front give you a fast, multi-Region front door.
Least privilege means giving only the actions a task needs, on only the resources it needs. The policy above is a good start: one bucket, not "Resource": "*".
Time runs downward. The keys expire, so a leaked copy stops working soon.
A role has two policies. The trust policy says who may assume it. The permissions policy says what it may do. On EC2 you never call STS yourself: the instance profile does it, and the SDK picks up the keys from instance metadata.
In everyday words
An IAM user is a staff ID card you carry forever. A role is a visitor badge from reception: you show who you are, get a badge for one floor, and it stops working at the end of the day.
Actually
STS AssumeRole returns "an access key ID, a secret access key, and a security token". DurationSeconds runs from 900 s (15 min) up to the role's max session, which can be set from 1 to 12 hours; the default is 3,600 s. Role chaining (a role assuming another role) caps the session at one hour. Policy evaluation: everything starts denied, an explicit Allow is needed, and "an explicit deny in either of these policies overrides the allow". An instance profile "can contain only one IAM role". IAM best practices say humans should use federation with temporary credentials, and workloads should use roles. Sources: AssumeRole API, policy evaluation logic, instance profiles, IAM best practices.
Code gets a role, never an access key in a config file. Explicit deny always wins.
S3 stores objects (a file plus metadata) in buckets. Each object has a key, its full name like photos/puppy.jpg. There are no real folders: photos/ is just a prefix of the key.
Storage classes
All classes in the docs table are designed for 99.999999999% durability, except the old Reduced Redundancy class. They differ in price, availability, retrieval time, and the minimum storage duration (you pay at least this many days even if you delete sooner).
Minimum days you pay for, by storage class
From the S3 storage class comparison table. Hover for availability and AZ count.
Glacier Deep Archive
180
Glacier Flexible Retrieval
90
Glacier Instant Retrieval
90
Standard-IA
30
One Zone-IA
30
Intelligent-Tiering
0
Standard
0
Show the full table
Class
For
Availability
AZs
Min days
Standard
Hot data, accessed often
99.99%
3+
0
Intelligent-Tiering
Unknown or changing access
99.9%
3+
0
Standard-IA
Read about once a month
99.9%
3+
30
One Zone-IA
Re-creatable, rarely read
99.5%
1
30
Express One Zone
Single-digit ms access
99.95%
1
0
Glacier Instant Retrieval
Archive, read once a quarter, ms access
99.9%
3+
90
Glacier Flexible Retrieval
Archive, minutes to hours to restore
99.99%
3+
90
Glacier Deep Archive
Archive, hours to restore
99.99%
3+
180
Features you will be asked about
Feature
What it does
Key fact (checked 2026-10-25)
Consistency
A read after a successful write sees the new data
Strong read-after-write for PUT and DELETE, all Regions, since Dec 2020. Bucket settings are still eventually consistent
Versioning
Keeps every version; a delete adds a "delete marker"
Once on, a bucket can be suspended but never returns to unversioned
Lifecycle rules
Transition to a cheaper class, or expire (delete)
Rules apply to existing objects too
Pre-signed URL
A link that lets anyone GET or PUT one object for a while
Up to 7 days with SigV4 and IAM user keys; never longer than the creating credentials
Encryption at rest
SSE-S3 (default), SSE-KMS, DSSE-KMS, SSE-C
SSE-S3 on all new uploads since 5 Jan 2023. SSE-C is off by default for new buckets since April 2026
Object size
Single PUT, or multipart upload
5 GB per PUT; multipart up to 50 TB
Request rate
Scales per key prefix
At least 3,500 writes and 5,500 reads per second per prefix
S3 as a static website, behind CloudFront
S3 can serve a static site (HTML, CSS, JS). But the S3 website endpoint is HTTP only. For HTTPS, put CloudFront in front. Keep the bucket private and let only CloudFront read it, using Origin Access Control (OAC).
In everyday words
S3 is a huge warehouse of labelled boxes. Storage classes are shelves: the front shelves cost more but are quick to reach; the back store is cheap but you must book a pickup. A pre-signed URL is a one-time pickup slip that expires.
Actually
S3 docs: Standard and most classes "redundantly store objects on multiple devices across a minimum of three Availability Zones" and are "designed to provide 99.999999999% durability and 99.99% availability of objects over a given year". Consistency: "Any read (GET or LIST request) that is initiated following the receipt of a successful PUT response will return the data written". Two writers to the same key at once: "the request with the latest timestamp wins", and there is no atomic update across keys. The launch post is dated December 2020. Website endpoints: "do not support HTTPS". CloudFront recommends OAC over the legacy OAI, because OAC supports SSE-KMS and all Regions. Sources: data protection, consistency model, Dec 2020 announcement, website endpoints, CloudFront OAC.
Upload directly from the browser with a pre-signed PUT URL, so big files never pass through your servers.
A 3-tier app splits into a front (web), a middle (app logic) and a back (database). On AWS the usual shape is below.
Static files go CloudFront → S3; dynamic calls go CloudFront → ALB → app → database.
Tier
AWS pieces
Why this way
Edge
Route 53 → CloudFront (with AWS WAF if needed)
HTTPS, caching near users, one domain for static and dynamic
Static
Private S3 bucket + OAC
Cheap, durable; bucket is never public
Web / app
ALB in public subnets → ASG in private subnets, 2+ AZs
Survives one AZ failing; scales with load
Data
RDS Multi-AZ (or Aurora) in private subnets; cache in ElastiCache
Standby in another AZ; see page 13
Outbound
NAT gateway per AZ (or regional NAT), S3 gateway endpoint
Patches and API calls go out; S3 traffic skips NAT fees
Identity
Instance profile role on the app servers
No keys on disk
In everyday words
A restaurant: the host at the door (CloudFront and the ALB), cooks in the kitchen (app servers), and the pantry in the back (database). Customers never walk into the kitchen.
Actually
Each piece above is backed by a docs fact on this page: ALB needs two or more AZs (section 04), a subnet is private when it has no route to an internet gateway (section 06), gateway endpoints for S3 have no extra charge (section 07), and CloudFront pulls from AWS origins for free (section 08). The Multi-AZ database details are on page 13. Source: How ELB works, subnet types.
In an interview, draw this first, then say how each box survives losing one AZ.
Same tools and manifests; AWS runs the control plane
Spiky event handler, each run under 15 min
Lambda
Pay per run; scales to zero
Job longer than 15 minutes
ECS/Fargate task or EC2
Lambda's normal cap is 900 s
Need a fixed IP or raw TCP/UDP
NLB
Static IP per AZ, Layer 4
Route /api and /images to different services
ALB
Path and host rules at Layer 7
Insert a third-party firewall in the path
GWLB
Built for inspection appliances
Batch work that can restart
Spot instances
Up to 90% cheaper (marketing page); 2-minute warning
Known 24/7 base load
Savings Plan
Up to 72% off for a 1 or 3 year promise
Private servers must call the internet
NAT gateway
Outbound only; no inbound
Private servers read S3 a lot
S3 gateway endpoint
Free; avoids NAT per-GB charges
Connect 2–3 VPCs
VPC peering
Simple, no hub to pay for
Connect many VPCs plus an office
Transit Gateway
Transitive hub; VPN and Direct Connect attach
Users in many countries
CloudFront + Route 53 latency records
Edge caching; nearest Region
Let a browser upload a 2 GB video
Pre-signed PUT URL (multipart)
Bypasses your servers
Logs you must keep 7 years
S3 lifecycle → Glacier Deep Archive
Cheapest; 180-day minimum fits
—Common traps
Mistakes that cost money or uptime traps
Trap
One NAT gateway for all AZs
If missed: its AZ fails and every private server loses the internet.
Fix: one NAT per AZ, or a regional NAT gateway.
Trap
S3 traffic going through NAT
If missed: you pay NAT per-GB charges on every S3 read.
Fix: add the free S3 gateway endpoint.
Trap
Access keys in code or AMIs
If missed: keys leak in git and never expire.
Fix: instance profile role, temporary STS keys.
Trap
Data on instance store
If missed: a stop or terminate erases it.
Fix: EBS, S3 or a database for anything you need later.
Trap
NACL blocks reply traffic
If missed: requests go out, replies never come back.
Fix: NACLs are stateless; allow the return port range too.
Trap
Expecting peering to be transitive
If missed: VPC B cannot reach C through A.
Fix: direct peering B–C, or a Transit Gateway.
Trap
Overlapping CIDR ranges
If missed: two VPCs can never be peered.
Fix: plan unique ranges per VPC from day one.
Trap
ASG with EC2 checks only
If missed: a server whose app is hung stays "healthy".
Fix: turn on ELB health checks for the group.
Trap
Lambda for long jobs
If missed: hard stop at 900 s, half-done work.
Fix: split into steps, or use Fargate.
Trap
Public S3 website for HTTPS
If missed: website endpoints are HTTP only.
Fix: private bucket + CloudFront + OAC.
—Interview questions
20 questions, easy to design-level. Try first, then open the answer practice
What is the difference between a Region and an Availability Zone? easy
Show answer
A Region is a geographic area, like ap-south-1 (Mumbai). An AZ is one or more data centers inside it, with separate power, networking and connectivity. AZs are many kilometers apart but within 100 km, so you can replicate synchronously between them with low delay. Why it matters: an AZ is the unit of failure you design for. You run at least two copies in two AZs. A whole-Region outage is rarer; you design for that with multi-Region setups only when the business needs it, because it adds cost and data-consistency work. Number: the docs list 34 Regions for a normal account, most with 3 AZs. Follow-up: what services are zonal vs regional? (EBS and a standard NAT gateway are zonal; S3 is regional.)
Explain the shared responsibility model with one example. easy
Show answer
AWS secures "of" the cloud: buildings, hardware, network, and the virtualization layer. The customer secures what is "in" the cloud: data, IAM, firewall rules, and on EC2 the guest OS patches. The line moves with the service: on Lambda or S3, AWS also runs the OS and platform, so you only own code, data and permissions. Example: an S3 bucket made public by mistake is the customer's problem, not AWS's. Another: an unpatched kernel on an EC2 instance is yours; an unpatched host under Lambda is AWS's.
On-Demand, Savings Plans, Reserved Instances, Spot: when do you use each? easy
Show answer
On-Demand: unpredictable or short-lived load; billed per second, no promise. Savings Plans: steady base load; you promise a dollar amount per hour for 1 or 3 years and save up to 72%. Reserved Instances save up to the same, but tie you to an instance type and Region; AWS now recommends Savings Plans. Spot: spare capacity, up to 90% off per AWS's marketing page, but AWS can take it back with a two-minute warning. So use Spot only for work that can stop and restart: batch, CI runners, stateless workers behind a queue. A good fleet mixes them: base on Savings Plans, peaks on On-Demand, retry-safe jobs on Spot.
EBS vs instance store: which one for a database? easy
Show answer
EBS. An EBS volume lives on independently of the instance, can be snapshotted, and is replicated across servers inside its AZ. Instance store is disks physically in the host; its data is erased when the instance stops, hibernates or terminates, and on disk failure. Instance store is faster and free with the instance, so it suits caches, scratch space and replicated data (for example a Cassandra node that has copies elsewhere). Watch out: an EBS volume must be in the same AZ as the instance, so it is not a cross-AZ failover by itself; use snapshots or database replication for that.
What makes a subnet public or private? easy
Show answer
Only its route table. A public subnet has a route (usually 0.0.0.0/0) to an internet gateway. A private subnet has no route to an internet gateway; it may route 0.0.0.0/0 to a NAT gateway to make outbound calls. An isolated subnet has no route out of the VPC at all. The name you give the subnet means nothing to AWS. Also needed for public access: the instance needs a public IP, and the security group must allow the traffic. Each subnet sits in exactly one AZ, and AWS reserves 5 addresses in each.
Security group vs network ACL? medium
Show answer
A security group is attached to each instance's network card, allows only, checks all rules, and is stateful: if a request is allowed in, the reply goes out automatically. A network ACL is attached to a subnet, has allow and deny rules, checks them in number order until the first match, and is stateless: you must allow return traffic, usually the ephemeral port range, yourself. Security groups are the main tool; they can also reference other security groups (for example "allow port 5432 from the app tier's SG"), which IPs cannot do neatly. Use NACLs as a coarse extra layer, such as denying a known bad CIDR.
How do private instances download patches? What does that cost? medium
Show answer
Through a NAT gateway in a public subnet (or a regional NAT gateway, which needs no public subnet). The NAT lets instances start outbound connections but blocks inbound ones. Cost: an hourly charge plus a per-GB processing charge on everything that passes through it. Two traps: a standard NAT gateway lives in one AZ, so if that AZ fails, instances in other AZs lose internet access; create one per AZ. And S3 or DynamoDB traffic should go through a free gateway endpoint instead of the NAT. Capacity: 5 Gbps, scaling to 100 Gbps per NAT gateway.
ALB vs NLB vs GWLB: how do you choose? medium
Show answer
ALB works at Layer 7: it reads HTTP, so it can route by path, host, header, method or query, terminate TLS, authenticate users, and call Lambda. Use it for web apps and microservices. NLB works at Layer 4 (TCP, UDP, TLS, QUIC): it handles millions of requests per second, gives a static IP per AZ (optionally an Elastic IP), and keeps each TCP connection on one target. Use it for non-HTTP protocols, fixed IPs, or extreme throughput. GWLB works at Layer 3 and sends packets over GENEVE (port 6081) to virtual appliances such as firewalls. Note the defaults: cross-zone is always on for ALB, off by default for NLB and GWLB.
Target tracking vs step vs scheduled scaling? medium
Show answer
Target tracking works like a thermostat: you pick a metric and a target (for example average CPU 50%, or requests per target), and the ASG adds or removes servers to stay near it. AWS strongly recommends it; pick a metric that drops when you add capacity. Step scaling adds different amounts depending on how far an alarm is breached: plus 1 at 60% CPU, plus 4 at 90%. Scheduled scaling changes min, max or desired size at fixed times with cron, for known peaks. You can combine them; when several policies fire, the ASG picks the one giving the largest capacity. Add a warm-up and an ELB health check grace period so new servers are not killed while booting.
What is a Lambda cold start, and how do you reduce it? medium
Show answer
When no warm execution environment is free, Lambda must download the code, start the runtime and run your init code before the handler. AWS says this happens in under 1% of invocations and takes from under 100 ms to over a second. Fixes: keep the package small and import only what you need; do heavy setup (DB connections, SDK clients) outside the handler so warm calls reuse it; use provisioned concurrency to keep N environments pre-initialized (costs money); or SnapStart, which restores from a snapshot. Concurrency math: 5,000 rps × 0.2 s = 1,000 environments, the default account limit.
Reserved concurrency vs provisioned concurrency? medium
Show answer
Reserved concurrency carves out a fixed slice of the account's pool for one function. It is both a floor (others cannot take it) and a ceiling (the function cannot exceed it). It is free and great for protecting a downstream database: cap the function at 50 and the DB never sees more than 50 parallel connections from it. Provisioned concurrency pre-initializes environments to remove cold starts; it costs extra and can spill into unreserved capacity when exceeded. The two can be combined. Lambda always keeps 100 units unreserved for other functions.
ECS vs EKS vs Fargate? medium
Show answer
ECS and EKS are schedulers (they decide where containers run). ECS is AWS's own, simpler, with task definitions, tasks and services. EKS is managed Kubernetes: AWS runs the control plane; you get the Kubernetes API and ecosystem, with more moving parts. Fargate is not a scheduler but a capacity type: serverless compute under ECS or EKS, so you do not manage or patch EC2 hosts. Choose ECS on Fargate for a small team on AWS only; EKS if the team already runs Kubernetes or needs portability; EC2 capacity if you need GPUs, special instance types, or the lowest unit cost at very large scale.
VPC peering vs Transit Gateway? medium
Show answer
Peering is a one-to-one private link between two VPCs. It is not transitive: if A peers with B and with C, B still cannot reach C through A. Peers also cannot share each other's internet gateway, NAT, VPN or gateway endpoints, and CIDRs must not overlap. With N VPCs a full mesh needs N×(N−1)/2 links: 10 VPCs means 45 peerings. Transit Gateway is a regional hub: each VPC, VPN or Direct Connect gateway attaches once, and route tables control who reaches whom. It costs per attachment-hour plus per GB processed. Use peering for 2–3 VPCs; a Transit Gateway beyond that or when an office network is involved.
How should an app on EC2 get permission to read S3? medium
Show answer
Attach an IAM role through an instance profile. The SDK then reads temporary credentials from the instance metadata service; they rotate automatically and expire, so a leak has a short life. Never put access keys in code, AMIs, or environment files. The role's permissions policy should be least privilege, for example s3:GetObject on arn:aws:s3:::my-bucket/* only, not s3:* on *. Policy evaluation: default deny, an explicit allow is needed, and an explicit deny anywhere wins. An instance profile holds exactly one role. Follow-up: cross-account? The other account's role trusts yours; you call sts:AssumeRole.
What does S3 strong consistency guarantee, and what does it not? hard
Show answer
Since December 2020, any GET or LIST that starts after a successful PUT or DELETE response sees that write, in all Regions, at no extra cost. Updates to a single key are atomic: a reader gets the old or the new object, never a mix. What it does not give: no locking between concurrent writers (the latest timestamp wins, so you need your own lock or conditional writes), no atomic update across several keys, and bucket configuration (for example enabling versioning) is still eventually consistent; AWS suggests waiting 15 minutes after enabling versioning before writing. So S3 is not a transactional database.
Design secure user uploads of large videos to S3. hard
Show answer
The client asks your API for an upload; the API checks the user, then returns a pre-signed URL (or a set of URLs for multipart) for one exact key such as uploads/{userId}/{uuid}.mp4. The browser uploads straight to S3, so big bytes never touch your servers. Multipart lets parts upload in parallel and retry alone; one PUT tops out at 5 GB, multipart reaches 50 TB. Keep the URL short-lived (minutes); with role credentials it cannot outlive the role session anyway. An S3 event then triggers processing (Lambda or a queue → transcoder). Serve results through CloudFront with OAC, bucket stays private. Add a lifecycle rule to abort incomplete multipart uploads.
Host a static website on S3 with HTTPS and a custom domain. medium
Show answer
S3 website endpoints are HTTP only and need public objects, so do not use them directly. Instead: keep a private bucket with Block Public Access on; create a CloudFront distribution with the bucket's REST endpoint as origin and Origin Access Control, plus a bucket policy that allows only that distribution's ARN to s3:GetObject; attach an ACM certificate for your domain; point a Route 53 alias record at the distribution. OAC (not the legacy OAI) is required if the bucket uses SSE-KMS. CloudFront caches files at edges (24 hours by default), and origin fetches from S3 to CloudFront are free. AWS docs also suggest Amplify Hosting for this.
What breaks if one AZ goes down in your 3-tier app, and how do you prevent it? hard
Show answer
Walk each tier. CloudFront and Route 53 are global, so fine. ALB: it spans at least two AZs and stops sending to unhealthy targets; fine if the ASG has servers in another AZ, and the ASG relaunches capacity there. App servers: fine if spread across 2+ AZs with enough headroom (for example run 3 AZs at 67% max so two can carry the load). Database: RDS Multi-AZ fails over to the standby, typically in 60–120 s (page 13). Hidden failures: a single NAT gateway in the dead AZ cuts outbound traffic for all; EBS volumes and instance store in that AZ are unreachable; sticky sessions on dead servers lose state. Fix: NAT per AZ or regional NAT, stateless servers, sessions in a shared store.
Your AWS bill shows huge NAT gateway charges. How do you investigate and fix it? hard
Show answer
NAT charges are hourly plus per GB processed, so the cause is almost always data volume. Step 1: VPC Flow Logs on the NAT's network interface, grouped by destination, to see who talks to what. Common causes: (1) S3 or DynamoDB traffic going through NAT; fix with free gateway endpoints. (2) Calls to other AWS APIs (ECR image pulls, CloudWatch, SQS); fix with interface endpoints if their hourly cost is lower than the NAT data cost. (3) Cross-AZ hops: instances in AZ B using the NAT in AZ A also pay inter-AZ transfer; route each AZ to its own NAT. (4) Chatty third-party APIs; cache responses. Re-check after one week.
Design a multi-Region active-passive setup for a web app. hard
Show answer
Run the full stack in a primary Region and a smaller copy in a secondary. Route 53 failover records point to the primary ALB while its health check passes, and to the secondary when it fails. Data: replicate the database across Regions (for example an Aurora global database or cross-Region read replica, page 13) and S3 with Cross-Region Replication. The secondary's ASG runs at low size and scales up on failover. Trade-offs: replication is asynchronous, so you may lose the last seconds of writes (your RPO); DNS failover takes health-check time plus TTL (your RTO). Practise the failover regularly. For lower RTO, run active-active with latency routing, at higher cost and with harder write conflicts.
—Cheat sheet
Numbers to memorise, all checked 2026-10-25 on the linked pages memorise