Skip to content

Cloud Fundamentals

What you’ll learn. What the cloud actually sells and the IaaS/PaaS/serverless spectrum; the shared-responsibility model; identity and access management (the most important cloud skill); VPC networking from first principles; the compute, storage, and database building blocks and their equivalents on AWS, GCP, and Azure; cost management (FinOps); and the basics of multi-region design. Pairs with Infrastructure as Code and Linux & Networking.

Cloud computing is on-demand, metered, API-driven access to shared infrastructure. The properties that matter operationally: you provision via API (so it is automatable, see IaC), you pay for what you provision (so waste is a bug), capacity is elastic but not infinite or free, and everything is someone else’s multi-tenant machine that fails regularly.

You manage more <------------------------------------> Provider manages more
On-prem | IaaS (VMs) | CaaS (containers) | PaaS (apps) | FaaS/Serverless | SaaS
Model You bring Examples Trade-off
IaaS OS and everything above EC2, Compute Engine, Azure VMs Maximum control, maximum toil
CaaS / managed K8s Containers/manifests EKS, GKE, AKS, ECS, Cloud Run, Container Apps Portability, orchestration learning curve
PaaS Application code Elastic Beanstalk, App Engine, App Service, Heroku-style Less ops, less control
Serverless (FaaS) Functions/events Lambda, Cloud Functions, Azure Functions Scale-to-zero, per-invocation billing, cold starts, time limits
SaaS Configuration Gmail, Salesforce, GitHub No ops at all

Climbing the stack reduces operational burden but increases coupling to the provider and constrains architecture. A sensible default for a new service: the highest-level abstraction that meets your requirements (managed containers or serverless), dropping to lower levels only when you need to.

The provider secures the cloud (facilities, hypervisors, managed-service internals); you secure what you put in it (IAM, configuration, data, application, OS patching on IaaS). Most real-world cloud breaches are customer misconfigurations (public buckets, over-broad IAM, leaked keys), not provider failures. See DevSecOps.

Production-grade setups use multiple accounts/projects/subscriptions as isolation and billing boundaries: AWS Organizations with accounts per environment and workload, GCP Folders and Projects, Azure Management Groups and Subscriptions. Separate accounts limit blast radius (a compromise or runaway bill in dev does not touch prod), simplify cost attribution, and enable guardrails (AWS Service Control Policies, GCP Organization Policies, Azure Policy). A landing zone (Control Tower, Azure Landing Zones, GCP Foundation blueprints) bootstraps this.

  • Region: a geographic area (e.g., eu-west-1) with multiple data centers.
  • Availability Zone (AZ): an isolated failure domain (separate power, cooling, network) within a region, linked by low-latency network (typically single-digit milliseconds). Spread across at least two, preferably three, AZs for high availability.
  • Edge locations / CDN points of presence cache content close to users.

Latency has a physics floor: light in fiber travels about 200,000 km/s, so a 10,000 km round trip costs at least roughly 100 ms. Place compute near users and near the data it needs.

IAM answers: who (principal) can do what (actions) on which resources, under what conditions. It is where cloud security is won or lost.

  • Principals: human users (prefer SSO via an identity provider, not long-lived IAM users), roles (assumable identities with temporary credentials; for workloads and for humans via SSO), and service identities.
  • Policies: JSON documents granting or denying actions.
  • Evaluation: default deny; an explicit allow is required; an explicit deny overrides any allow.

An example identity policy allowing read-only access to one bucket prefix:

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:GetObject"],
"Resource": "arn:aws:s3:::myapp-prod-assets/public/*"
},
{
"Effect": "Allow",
"Action": ["s3:ListBucket"],
"Resource": "arn:aws:s3:::myapp-prod-assets",
"Condition": {"StringLike": {"s3:prefix": ["public/*"]}}
}
]
}
Concept AWS GCP Azure
Workload identity IAM role (instance profile, IRSA/Pod Identity) Service account (Workload Identity) Managed identity
Human identity IAM Identity Center (SSO) Cloud Identity / Workspace Microsoft Entra ID
Permission grant Policies attached to identity/resource IAM role bindings at org/folder/project/resource RBAC role assignments at scope
Org-level guardrail SCPs Organization Policy Azure Policy
Short-lived keys STS AssumeRole Service account impersonation / tokens Managed identity tokens
  1. Least privilege: grant the minimum actions on the minimum resources. Start narrow; use access-analysis tools (IAM Access Analyzer, GCP Policy Recommender) to prune.
  2. No long-lived credentials: use roles, SSO, and workload identity (OIDC federation from CI, as in CI/CD; IRSA/Workload Identity from Kubernetes). A static access key in a repo is the most common breach vector.
  3. MFA and strong root protection: the root/owner account is locked away with hardware MFA and used for almost nothing.
  4. Separate human and machine identities; separate environments.
  5. Audit everything: CloudTrail, Cloud Audit Logs, Azure Activity Log, centralized and immutable.
  6. Condition keys and permission boundaries to constrain delegated administration.

A Virtual Private Cloud (VPC) (GCP: VPC network; Azure: Virtual Network, VNet) is your logically isolated private network in a region. Building blocks:

VPC 10.0.0.0/16 (region)
├─ Public subnet 10.0.0.0/24 (AZ a) -> route 0.0.0.0/0 to Internet Gateway
│ NAT Gateway, load balancers, bastion (if any)
├─ Private subnet 10.0.10.0/24 (AZ a) -> route 0.0.0.0/0 to NAT Gateway
│ app servers, containers
├─ Public subnet 10.0.1.0/24 (AZ b)
├─ Private subnet 10.0.11.0/24 (AZ b)
└─ Data subnet 10.0.20.0/24 (AZ a/b) -> no internet route; databases
  • Subnet: a CIDR slice tied to one AZ (AWS/Azure) or spanning a region (GCP subnets are regional). “Public” means its route table sends internet-bound traffic to an internet gateway and instances have public IPs; “private” subnets reach out via a NAT gateway (outbound only) or not at all.
  • Route tables decide where each destination CIDR goes.
  • Security groups (AWS; Azure NSGs; GCP firewall rules with tags/service accounts) are stateful allow rules at the instance/NIC level. AWS network ACLs are stateless, subnet-level, rarely needed.
  • Load balancers: L7 (ALB, Cloud HTTP(S) LB, Application Gateway) and L4 (NLB, Network LB, Azure LB).
  • Connectivity: VPC peering (non-transitive pairwise), Transit Gateway / hub-and-spoke (AWS TGW, Azure vWAN/hub VNets, GCP Network Connectivity Center), VPN, dedicated links (Direct Connect, Cloud Interconnect, ExpressRoute), and private endpoints (PrivateLink, Private Service Connect, Private Link) to reach managed services without traversing the internet.
  • DNS: Route 53, Cloud DNS, Azure DNS; private hosted zones for internal names.

A Terraform sketch of a minimal public/private layout:

resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
enable_dns_hostnames = true
}
resource "aws_subnet" "private" {
for_each = { a = "10.0.10.0/24", b = "10.0.11.0/24" }
vpc_id = aws_vpc.main.id
cidr_block = each.value
availability_zone = "eu-west-1${each.key}"
}
resource "aws_security_group" "app" {
vpc_id = aws_vpc.main.id
ingress {
from_port = 8080
to_port = 8080
protocol = "tcp"
security_groups = [aws_security_group.alb.id] # only the load balancer
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}

Practical rules: plan non-overlapping CIDRs across all VPCs and on-prem early (renumbering is painful; Kubernetes Pod CIDRs consume lots of space, see Kubernetes in Production); put only load balancers and NAT in public subnets; databases in isolated subnets; reference security groups by identity rather than CIDR; and remember egress costs: NAT gateway processing and cross-AZ/cross-region/internet transfer are significant billing line items, so use gateway/interface VPC endpoints for S3/DynamoDB and registries.

Need AWS GCP Azure
Virtual machines EC2 Compute Engine Virtual Machines
Autoscaling VM groups Auto Scaling Groups Managed Instance Groups VM Scale Sets
Managed Kubernetes EKS GKE AKS
Container runtime (no cluster) ECS/Fargate, App Runner Cloud Run Container Apps
Functions Lambda Cloud Functions / Cloud Run functions Azure Functions
Batch AWS Batch Cloud Batch Azure Batch

VM choice: instance families target workloads (general purpose, compute-optimized, memory-optimized, storage-optimized, accelerated/GPU; see MLOps). Pricing options: on-demand, reserved/savings plans/committed use (1-3 year commitments for steep discounts), spot/preemptible (large discounts, can be reclaimed on short notice; for stateless/batch). ARM-based instances (Graviton, Axion, Ampere/Cobalt) frequently offer better price-performance if your software supports arm64.

Serverless functions: event-driven, scale to zero, billed by invocation and duration. Limits to know: maximum duration, memory, payload size, cold starts, concurrency limits, and vendor-specific event models. Great for glue, event handlers, spiky workloads; costly and awkward for sustained high-throughput or long-running work.

Three fundamental kinds:

Kind Access AWS GCP Azure Use
Object HTTP API on objects in buckets S3 Cloud Storage Blob Storage Backups, static assets, data lakes, artifacts
Block Attached disk, one VM at a time EBS Persistent Disk / Hyperdisk Managed Disks Databases, boot volumes
File Shared POSIX/SMB filesystem EFS, FSx Filestore Azure Files Shared content, legacy apps

Object storage specifics: effectively unlimited, highly durable (providers advertise eleven nines of durability, which is about not losing data, not about being available), eventually-or-strongly consistent depending on provider (S3 is now strongly consistent for reads after writes), priced per GB-month plus requests plus egress, with storage classes/tiers (standard, infrequent access, archive/Glacier) and lifecycle rules to transition and expire data. Enable versioning, encryption (default on), block public access, and access logging. Objects are immutable blobs: no partial in-place update.

Terminal window
aws s3 sync ./dist s3://myapp-prod-assets/ --delete
gcloud storage cp -r ./dist gs://myapp-prod-assets/
az storage blob upload-batch -d '$web' -s ./dist --account-name myaccount
Type AWS GCP Azure Notes
Managed relational RDS, Aurora Cloud SQL, AlloyDB, Spanner (globally distributed) Azure SQL, Database for PostgreSQL/MySQL Backups, patching, failover handled
Key-value / wide-column DynamoDB Bigtable, Firestore Cosmos DB Horizontal scale, access by key
In-memory cache ElastiCache Memorystore Azure Cache for Redis Sub-ms reads, ephemeral
Document DocumentDB, DynamoDB Firestore Cosmos DB Flexible schema
Warehouse / analytics Redshift, Athena BigQuery Synapse, Fabric Columnar, separation of storage/compute
Streaming/queues SQS, SNS, Kinesis, MSK Pub/Sub, Managed Kafka Service Bus, Event Hubs Decoupling, async

Defaults: start with a managed relational database (PostgreSQL) unless you have a concrete reason otherwise. “Managed” removes patching, backups, and failover toil but not data modeling, indexing, capacity decisions, or the need to test restores (Incident & Reliability). Enable Multi-AZ for HA (synchronous standby, automatic failover), read replicas for read scaling (asynchronous, so lag exists), automated backups with point-in-time recovery, and encryption at rest and in transit.

The CAP/PACELC trade-offs show up here: globally distributed databases (Spanner, Cosmos DB, DynamoDB Global Tables, Aurora Global) offer different consistency/latency/cost trade-offs; read the guarantees closely.

Cloud bills are opaque by default and grow silently. FinOps is the practice of bringing financial accountability to variable cloud spend: Inform (visibility and allocation), Optimize (rates and usage), Operate (governance and continuous improvement), per the FinOps Foundation framework.

Compute (usually the largest), then data egress and inter-zone transfer, storage and snapshots, managed databases, load balancers and NAT gateways, and observability/log ingestion (often a surprise).

  1. Tag/label everything (team, service, env, cost-center) and enforce with policy; untagged spend cannot be attributed. Use separate accounts for hard boundaries.
  2. Set budgets and anomaly alerts (AWS Budgets/Cost Anomaly Detection, GCP Budgets, Azure Cost Management) with notifications to owners. A forgotten GPU instance or runaway loop can cost thousands per day.
  3. Right-size: use utilization metrics; typical VMs are heavily over-provisioned. Autoscale to demand; shut down non-prod outside working hours.
  4. Pricing models: commit to the stable baseline (savings plans/CUDs/reservations), use spot for fault-tolerant work, keep on-demand for the variable remainder. Commit conservatively; unused commitments are waste.
  5. Storage lifecycle: tier cold data, delete old snapshots and orphaned volumes/IPs/load balancers.
  6. Network: avoid cross-AZ/region chatter, use VPC endpoints, put a CDN in front of egress-heavy content, and be wary of data leaving the provider entirely.
  7. Architecture choices are cost choices: serverless cost scales with use (cheap when idle, pricey at constant high load); an always-on VM is the reverse. Compare at your real utilization.
  8. Unit economics: track cost per customer/request/transaction, not just the total; a rising bill with a falling unit cost is healthy.

A back-of-envelope example. A service needs 8 vCPU baseline at a hypothetical on-demand USD 0.04 per vCPU-hour: 8 × 0.04 × 730 ≈ USD 234 per month. A one-year commitment at a 35% discount saves about USD 82 per month for this one workload; across 200 workloads it is material. Always run your own numbers with current prices; the structure of the calculation is what to keep.

provider "aws" {
region = "eu-west-1"
default_tags {
tags = {
Team = "payments"
Environment = "prod"
CostCenter = "cc-1042"
}
}
}

Why go multi-region: latency to distributed users, disaster recovery from a regional outage, data residency laws, and availability beyond what a single region offers. Why not: it is expensive and hard. Most outages are fixed by multi-AZ design and good operations; many teams are better served by a tested single-region (multi-AZ) setup plus a backup/restore or warm-standby DR plan. Provider-wide incidents do happen, but design for the failure modes you can actually afford to handle (Incident & Reliability).

Strategies, in increasing cost and recovery speed:

Strategy Description RTO Relative cost
Backup and restore Backups copied to a second region; rebuild via IaC on demand Hours Lowest
Pilot light Core data replicated; minimal infrastructure kept ready, scaled up on failover Tens of minutes Low
Warm standby Scaled-down full stack running in the second region Minutes Medium
Active-active Both regions serve traffic Near zero Highest

Hard problems:

  • Data: replication is asynchronous across regions (a failover can lose recent writes, your RPO), or synchronous at the cost of write latency. Active-active writes require conflict resolution or a globally consistent database. Decide what data truly needs multi-region.
  • Traffic routing: DNS-based (latency, geolocation, or failover routing with health checks) with TTLs that bound failover time; anycast/global load balancers (CloudFront, Global Accelerator, Cloud Load Balancing, Azure Front Door) fail over faster.
  • Control-plane dependencies: failover must not depend on the failed region (static stability: pre-provision capacity rather than needing to launch it during an outage).
  • Configuration and secrets replicated; IaC parameterized by region so the second region is a variable change, not a rewrite.
  • Practice: untested failover does not work. Run game days (Incident & Reliability).

Total portability is a myth that costs real velocity. Reasonable hedges: containers and Kubernetes for compute, open formats and standard databases (PostgreSQL), IaC modules isolating provider specifics, OpenTelemetry for telemetry (Observability), and awareness of exit costs (especially egress fees and proprietary databases). Use managed services where they add value, and be explicit when you accept coupling.

  • The service models (IaaS, CaaS, PaaS, serverless, SaaS) trade control against operational burden; pick the highest abstraction that meets your needs.
  • IAM is the core security surface: default deny, least privilege, roles and federation over static keys, MFA, separate accounts per environment, and audit logs.
  • A VPC is subnets, route tables, gateways, and stateful security groups; plan CIDRs early, keep databases private, and mind egress and NAT costs.
  • Know the three storage kinds (object, block, file) and default to managed relational databases; managed does not mean you can skip restore tests.
  • Providers offer near-equivalent primitives under different names; learn the concept first.
  • FinOps: tag, budget, right-size, commit to baselines, use spot for tolerant work, and track unit costs.
  • Multi-region is a cost/complexity decision: choose a DR tier (backup, pilot light, warm standby, active-active) by required RTO and RPO and rehearse it.
  1. Hands-on. In a free-tier or sandbox account, use IaC to create a VPC with two public and two private subnets across two AZs and a bucket with versioning and public access blocked. Tear it down and record the cost.
  2. Security. Write an IAM policy for a CI role that may only push images to one ECR/Artifact Registry repository and nothing else. Explain how you would verify it with a policy simulator.
  3. Conceptual. A teammate says “put the database in a public subnet so I can connect from my laptop.” Offer three safer alternatives.
  4. Calculation. A baseline of 40 vCPUs runs 24/7 at an on-demand rate rr; a 3-year commitment gives a 50% discount but the real baseline later drops to 24 vCPUs. When does the commitment still beat on-demand?
  5. Design. Choose a multi-region strategy and an RTO/RPO for a B2B SaaS app with a 99.9% SLO. Justify.
Solutions (3, 4)
  1. A bastion/jump host or SSM Session Manager / IAP / Bastion service in front of a private subnet; a VPN or identity-aware proxy; port-forwarding through the cluster; or a private endpoint with a client VPN. None require exposing the database to the internet.
  2. The commitment pays for 40 vCPUs at 0.5r regardless of use, costing 20r20r per hour. On-demand for the 24 actually used would cost 24r24r. The commitment still wins unless usage falls below 20 vCPUs. Reasoning: commit only to the floor you are confident about; cover the rest on-demand.
  • Amazon Web Services, “Well-Architected Framework” (and the GCP Architecture Framework and Azure Well-Architected Framework).
  • J.R. Storment and Mike Fuller, Cloud FinOps (2nd ed., 2023).
  • Andreas and Michael Wittig, Amazon Web Services in Action (3rd ed., 2023).
  • Provider documentation on IAM policy evaluation logic and VPC design.
  • Betsy Beyer et al., Site Reliability Engineering (2016), chapters on load balancing and distributed systems.