Infrastructure Cheat Sheet

Need X → use Y, with the reason and the price. Every row carries a cost column on purpose: this domain does not recommend anything without saying what it costs you to run.

Compute

NeedUseWhyCost
Long-running service, ordinary OS needsManaged containers, or plain VMs behind a load balancerLeast machinery that still gives you replacement and rolloutYou own the image and the deploy path
Short, event-driven, bursty workServerless functionsScales to zero and per-use billing suits spiky workCold starts, runtime limits, and a connection problem against a pooled database
Custom kernel, custom drivers, strong isolationVirtual machinesContainers share the host kernel; a VM does notYou own patching, images and the lifecycle
Many containers across many machinesConsider orchestration — then check whether a managed platform sufficesPlacement, restarts, rollout and discovery stop being manualA control plane is a distributed system you now operate
Two engineers, one API, modest trafficNot KubernetesThe cluster costs more attention than the workload doesYou may outgrow it — migrating later is a known, bounded project

Networking

NeedUseWhyCost
Backend must call an external API but accept nothing inboundPrivate subnet plus a NAT gatewayOutbound-only by construction: no inbound entry to translatePer-gigabyte processing charges and a per-zone resource to make redundant
Reading a lot from provider object storageA private endpoint, not the NAT pathKeeps the traffic off the metered gateway and out of the public pathOne more network construct to declare and understand
Database must never be reachable from the internetPrivate subnet, no public address, security group scoped to the appRemoves the entire class of direct external attacksNot a substitute for authentication and authorization
Global static and media deliveryCDN in front of object storageServes from the edge and shields the originCache invalidation becomes your problem; egress still bills
Route by health, geography or latencyDNS-level routing with health checksFailover and locality without touching the applicationDNS caching makes failover slower than the TTL suggests

Storage

NeedUseWhyCost
Images, video, backups, documents, static filesObject storageCheap, effectively unbounded, built for whole-object accessNo transactions, no joins, per-request cost, listing is not a query
Large user uploadsSigned direct upload to object storageThe bytes never traverse your applicationSigned-URL scope and expiry become part of your security model
A disk for a VM or a databaseBlock storageThe only shape that gives you a filesystem and durable random writesAttached to one machine; you own snapshots and growth
Several machines sharing one filesystemFile storagePOSIX semantics across hosts without inventing your own syncPer-operation latency, and a tempting anti-pattern as a queue
Relational data with real queriesManaged databaseBackups, patching, replication and failover stop being your weekendSchema, queries, indexes, access control, capacity and cost stay yours
Old data nobody reads but nobody may deleteStorage lifecycle policy into an archive tierStorage cost falls by an order of magnitudeRetrieval from archive is slow and costs money

Identity

NeedUseWhyCost
An application needs cloud permissionsA workload identity assuming a role for short-lived credentialsNothing long-lived to leak, and the audit log names the workloadA role, a trust policy and a credential refresh path to get right
A worker only reads one bucketA policy granting exactly those read actions on exactly that resourceBlast radius on compromise is one bucket, read-onlyNarrow policies break when the workload changes; that is the point
A database password an application needsA secret manager, fetched at runtime by workload identityRotation, revocation and an audit trail become possibleA runtime dependency on the secret store, and a cache to design
Kubernetes Secret objects feel like secret managementTreat them as configuration until you have added encryption and access controlBy default they are encoded, not encrypted, and broadly readableA real secret store is another component to run

Delivery

NeedUseWhyCost
The same build must reach staging and productionBuild one artifact, promote it unchangedStaging tested exactly what production runsConfiguration must live outside the artifact
Deploy without an outage windowRolling deploymentCapacity stays up while instances are replacedBoth versions run at once, so every change must be backward compatible
Rollback must be instantBlue/greenRollback is a traffic switch, not a redeployDouble capacity during the switch, and the database does not switch with it
A risky release with real usersCanary with metric gatesA bad release reaches a small share before you stop itOnly works if the metrics are good enough to decide on
Deploys drop in-flight requestsGraceful shutdown on the termination signalStop accepting, drain, close, exit — in that orderA termination grace period long enough for your slowest request
Infrastructure changes should be reviewableInfrastructure as code with remote, locked stateChanges become diffs a colleague can read before they happenState is sensitive and concurrent applies must be prevented

Reliability

NeedUseWhyCost
One instance failing must not be an outageSeveral instances across zones behind a load balancerHealth checks remove the failed one and traffic reroutesCross-zone data transfer and more capacity than one instance
Three replicas that all die togetherCheck the failure domain, not the replica countThree replicas in one zone is one failure domain in disguiseSpreading them costs latency and cross-zone transfer
A zone outage must be survivableMulti-zone, including the NAT and the databaseThe zone-redundant app is useless behind a single-zone egress pathOne NAT and one database standby per zone, billed per zone
A region outage must be survivableMulti-region — after you have answered the data questionRegional failure stops being an extinction eventConsistency, routing, operational complexity and a much larger bill
"How much data can we lose, how long can we be down?"Write down RPO and RTO first, then derive the architectureThe numbers pick the design; the design cannot pick the numbersTighter numbers cost more, continuously
You have backupsRestore one, on a schedule, and time itA backup you have never restored is not proven recoveryA recurring drill somebody has to actually run
Health checks cause outages during deploysSeparate liveness from readinessReadiness removes traffic; liveness restarts the processTwo probes to reason about instead of one

Scaling

NeedUseWhyCost
Traffic varies through the dayMetric-based autoscaling on the signal that represents pressureCapacity follows demand instead of the worst hourNew capacity is always minutes late; size the headroom for that
CPU is at 30% and the service is saturatedScale on concurrency, queue depth or pool saturation insteadCPU is the default signal and frequently the wrong oneA custom metric to publish and trust
Scaling reacts too lateCut startup time and raise the headroomMetric window plus provisioning plus image pull plus warm-up is minutesHeadroom is capacity you pay for and do not use

Security

NeedUseWhyCost
Is this public endpoint a problem?Ask what it serves and who it is for before calling it a findingA load balancer on 443 is the design; a database on 5432 is notContext takes judgement; a scanner alone will cry wolf
Who changed production infrastructure?Audit logs plus per-workload identitiesThe log is only meaningful if identities are not sharedLog retention and someone whose job is to read them
Production pulls a moving :latest tagPin an image digestTwo deploys of "the same" version can otherwise run different codeA promotion step that resolves and records the digest

Cost

NeedUseWhyCost
The bill tripled and compute did not changeLook at data movement before computeEgress, cross-region transfer and NAT processing are the usual answerAttribution needs tagging you have to maintain
32 GB allocated, 4 GB usedRight-size — but check peaks and failover firstAverage utilization alone will size you into an outageLess headroom for the traffic spike you have not seen yet
Idle capacity looks like wasteSeparate headroom from waste before cuttingSome idle capacity is the reliability budgetCutting to zero headroom fails at the next spike
Nobody knows what each service costsTag resources and attribute spend per serviceCost becomes a design input instead of a monthly surpriseA tagging discipline that decays without enforcement

Strategy

NeedUseWhyCost
"We should be multi-cloud to avoid lock-in"Name the business requirement firstWithout one, you buy every provider's complexity and none of their depthIf the requirement is real, budget for duplicated IAM, networking and expertise
Moving an existing estate to the cloudInventory and dependency map before choosing a strategyMigrations fail on the undocumented job nobody ownsThe inventory is slow, unglamorous work
The architecture feels too complicatedScore the operational complexity and ask what can be removedComplexity must be justified by workload and organizationRemoving something means admitting you did not need it