Kayavak / Recaps / Cloud
Recaps · Volume 7
Cloud
The revision sheet of every chapter, on one page: the key ideas, the numbers worth knowing, the pitfalls and the words. Use it before an interview, after a chapter, or to find which chapter to reread. Each title opens its chapter; below each sheet are its exercises, companion and TiffinBox stage, and the misconceptions the companion corrects.
85
Key ideas
- Cloud: on-demand, self-service, elastic, measured, managed; IaaS, CaaS, PaaS, FaaS, SaaS; shared responsibility.
- Physical hierarchy: regions, availability zones, local zones and edge locations (CDN, DNS); fault domains and placement.
- Core primitives: compute, block/file/object storage, virtual networks, identity, managed data services, messaging, observability.
- Properties: availability (serial vs parallel composition), durability, elasticity, scalability, latency, consistency, multi-tenancy and noisy neighbours.
- Accounts, quotas and pricing: account/subscription/project structure, service quotas, on-demand vs commitments (savings plans, reserved, committed use) vs spot/preemptible, data transfer costs, budgets and tagging.
- Choosing a region: users' latency, data residency and regulation, service availability, price, sustainability, disaster-recovery pairing.
Numbers to remember
- 99.9% ≈ 44 min/month; 99.95% ≈ 22 min; 99.99% ≈ 4.4 min.
- EC2: 99.5% per instance, 99.99% across ≥2 AZs; RDS Multi-AZ 99.95%; S3 Standard 99.9% SLA, 11 nines durability design.
- Light in fibre ≈ 200 km per ms one way.
- Lab: a rare shared cause turned 0 to 51 min/year of two-zone downtime; scaling with load cut cost 70% (76% with spot); Mumbai–N. Virginia floor 129 ms round trip.
Pitfalls
- Single-instance or single-zone production deployments.
- Multiplying "independent" availabilities that share a cause.
- Treating SLA credits as insurance.
- Ignoring data transfer and NAT costs.
- Choosing regions by habit rather than users and regulation.
- No budgets or alerts on new accounts.
Glossary
- SLA / SLO: contractual commitment / internal target.
- Service credit: the refund paid when an SLA is missed.
- Static stability: continuing to operate without the control plane during failures.
- Spot / preemptible: discounted capacity that can be reclaimed.
- Data residency: requirements on where data is stored and processed.
- Quota: a per-account limit on resources or API rates.
86
Key ideas
- Spectrum: VMs → managed Kubernetes → serverless containers → functions → application platforms; control vs operations vs scaling speed.
- VMs: instance families (general, compute, memory, storage, accelerated), sizes, architectures (x86, Arm/Graviton/Cobalt/Axion), images (AMIs), user data, metadata service (IMDSv2), placement groups, burstable instances.
- Autoscaling groups: launch templates, health checks, target tracking, step and scheduled scaling, predictive scaling, warm pools, instance refresh, mixed instances and spot.
- Containers in the cloud: ECS, EKS, AKS, GKE (Autopilot, Auto Mode), Fargate, Cloud Run, Container Apps.
- Functions: event sources, execution environments, cold starts, concurrency and limits, provisioned concurrency, SnapStart, timeouts, idempotent handlers.
- Batch and HPC: AWS Batch, spot fleets, GPUs, job checkpointing.
- Pricing: on-demand, savings plans/reserved/committed use, spot/preemptible, per-second billing, Arm price-performance.
Numbers to remember
- Spot interruption notice: 2 minutes (AWS); Lambda default concurrency limit 1,000 per region; Lambda max timeout 15 minutes.
- Lab: cold starts 4 ms (Go), 320 ms (Python + SDK), ~2.5 s (Spring Boot); Lambda cost 14× Fargate at steady 300 req/s but 11× cheaper at 2 req/s; 5-minute warm-up caused 3 minutes of overload; checkpoints cut a spot job's p95 from 1,669 to 175 min.
Pitfalls
- Heavy initialisation in function handlers.
- Long-running or steady high-throughput work on functions without doing the maths.
- Reactive autoscaling with slow warm-up and no headroom.
- Spot for non-interruptible work, or a single spot instance type.
- IMDSv1 left enabled.
- Oversized instances never rightsized.
Glossary
- Cold start: initialising a new execution environment.
- Provisioned concurrency / minimum instances: pre-initialised capacity.
- Launch template: definition of how to launch instances.
- Target tracking: scaling to keep a metric near a target.
- Warm pool: pre-initialised stopped instances for faster scale-out.
- Savings plan: commitment to spend per hour in exchange for discounts.
87
Key ideas
- VPC/VNet: CIDR range, subnets per AZ and tier, reserved addresses, IPv4 and IPv6, default VPCs (avoid for production).
- Routing: route tables per subnet, local routes, internet gateway, NAT gateway, egress-only IGW, virtual private gateway, transit gateway.
- Firewalls: security groups (stateful, per interface, can reference groups), NACLs (stateless, per subnet, ordered rules), cloud firewalls and inspection VPCs.
- Load balancers: L7 (ALB, Application Gateway, HTTP(S) LB) vs L4 (NLB, Azure LB, network LB); health checks, TLS, cross-zone balancing, target types.
- Private endpoints: gateway endpoints (S3, DynamoDB), interface endpoints/PrivateLink, Private Service Connect, Azure Private Link.
- Connecting networks: peering (non-transitive), transit gateways/hub-and-spoke, VPN, Direct Connect/ExpressRoute/Interconnect, overlapping CIDR problems.
- DNS: private hosted zones, resolver endpoints, split-horizon, health-checked routing policies (failover, latency, weighted, geolocation).
- CDNs: edge caching, origin shielding, cache keys, TLS at the edge, signed URLs, WAF at the edge.
- Service-to-service: service discovery, meshes, VPC Lattice, mTLS.
- As code: Terraform/OpenTofu, CDK, Pulumi, Bicep modules for VPCs.
Numbers to remember
- AWS reserves 5 addresses per subnet; ephemeral ports to allow in NACLs: 1024–65535.
- NAT gateway: ~$0.045/hour + $0.045/GB (us-east-1); ~55,000 simultaneous connections per destination.
- Lab: stateless NACL broke both directions until ephemeral ports were allowed; three overlapping /16s couldn't be connected; NAT for 20 TB/month cost ~$1,000.
Pitfalls
- Overlapping CIDRs across VPCs, accounts and offices.
- NACLs without ephemeral-port rules.
- Databases in public subnets or with public IPs.
- A single NAT gateway for all zones.
- Large S3 or registry traffic through NAT instead of endpoints.
- Security groups open to 0.0.0.0/0 on admin ports.
Glossary
- CIDR: notation for an address block, e.g. 10.20.0.0/16.
- Internet gateway: VPC edge for public traffic with 1:1 NAT.
- NAT gateway: managed outbound-only address translation.
- VPC endpoint: private path to a cloud service without the internet.
- Transit gateway: a regional router connecting many VPCs and on-premises networks.
- Ephemeral port: the temporary client-side port of a connection.
88
Key ideas
- Object storage: buckets, keys and prefixes, metadata, strong consistency, versioning and delete markers, lifecycle rules, storage classes, multipart uploads, byte ranges, presigned URLs, event notifications, replication (same/cross-region), Object Lock, static website hosting behind a CDN.
- Encryption: SSE-S3, SSE-KMS (envelope encryption, key policies, bucket keys), client-side encryption, TLS in transit, default encryption.
- Block storage: volume types (gp3, io2, st1/sc1, Premium SSD v2, Hyperdisk), IOPS, throughput, latency, queue depth, snapshots, multi-attach limits, instance store (ephemeral, fast).
- File storage: EFS, FSx (Windows, Lustre, NetApp ONTAP, OpenZFS), Azure Files, Filestore; throughput modes; POSIX semantics.
- Durability vs availability: 11 nines durability, SLA availability, zonal vs regional services, backup and restore testing.
- Choosing: access pattern, sharing, latency, cost per GB vs per request, retention.
Numbers to remember
- S3 objects up to 50 TB (since December 2025), parts 5 MiB–5 GiB, 10,000 parts.
- gp3 baseline 3,000 IOPS and 125 MB/s; io2 up to 256,000 IOPS.
- Storage minimums: Standard-IA 30 days, Glacier IR 90, Deep Archive 180.
- Lab: a delete marker hid both versions until removed; lifecycle cut a 3-year log bill from $30,636 to $6,063; 1 M tiny objects cost $5 in PUTs vs $0.02/month storage; 4K random reads 128k IOPS vs 1M reads 2.3 GiB/s on the same disk.
Pitfalls
- Treating S3 like a filesystem (appends, renames of millions of keys, small files).
- No versioning or Object Lock on critical buckets; unlimited noncurrent versions.
- Incomplete multipart uploads never aborted.
- Comparing multipart ETags with MD5s.
- Default volume IOPS for busy databases.
- Public buckets (keep Block Public Access on).
Glossary
- Delete marker: placeholder version that hides an object in a versioned bucket.
- Lifecycle rule: automatic transition or expiry of objects.
- Envelope encryption: data keys encrypting data, wrapped by a master key.
- IOPS: input/output operations per second.
- Snapshot: point-in-time copy of a volume, stored in object storage.
- Object Lock: write-once-read-many retention.
89
Key ideas
- Identity as the perimeter: every cloud action is an authenticated, authorised API call; credential compromise is the main threat.
- Principals: root/account owner, users, groups, roles, service-linked roles, federated identities, workload identities; Azure (Entra ID users, service principals, managed identities, RBAC role assignments at scopes) and GCP (principals, service accounts, roles bound in IAM policies on the resource hierarchy).
- Policies: identity-based, resource-based, SCPs/RCPs, permissions boundaries, session policies, ACLs; conditions and global condition keys; ARNs and wildcards.
- Evaluation: default deny → explicit deny wins → allow needed from every applicable layer; cross-account needs both sides.
- Least privilege: start from zero, access analysis from logs, separate roles per job, break-glass access, regular reviews.
- Federation: SAML/OIDC SSO for people; OIDC for workloads outside the cloud; trust-policy conditions on
aud and sub.
- Short-lived credentials: STS sessions, instance metadata (IMDSv2), task/pod identities, managed identities; eliminate static keys.
Numbers to remember
- STS sessions: 15 minutes to 12 hours (role setting); GitHub OIDC tokens valid ~5 minutes.
- Lab: explicit deny beat allow; a boundary turned an allowed PutObject into a deny; an SCP denied the same GET in us-east-1;
Allow NotAction iam:* allowed deleting buckets; a pinned sub refused PRs and forks; leaked static keys live 45 days on average vs 30 minutes for 1-hour sessions.
Pitfalls
- IAM users with access keys for people or CI.
* actions or resources "for now".
Allow with NotAction or NotResource.
- OIDC trust policies without
sub conditions.
- Using the root user; no MFA on human sign-in.
- Forgetting the bucket ARN vs object ARN distinction.
Glossary
- ARN: Amazon Resource Name, the unique ID of a resource.
- Trust policy: who may assume a role.
- Permissions boundary: maximum permissions an identity policy can grant.
- SCP: organisation-level guard rail on accounts.
- STS: Security Token Service issuing temporary credentials.
- Workload identity: credentials issued to software from its platform identity.
90
Key ideas
- One cloud deeply: core compute, networking, storage, database, messaging, identity, observability and IaC services, with their limits, quotas and defaults.
- AWS in depth: accounts and Organizations, VPC, EC2/ASG, ECS/EKS/Fargate, Lambda, ALB/NLB, CloudFront, S3, EBS/EFS, RDS/Aurora, DynamoDB, SQS/SNS/EventBridge/Kinesis, IAM/KMS/Secrets Manager, CloudWatch/X-Ray/CloudTrail, CloudFormation/CDK.
- Azure and GCP equivalents and genuine differences: resource groups and subscriptions, Entra ID; projects and folders, global VPCs, Cloud Run.
- Reference architectures: three-tier web, event-driven, data pipelines, multi-region active-passive and active-active.
- Multi-cloud and portability: reasons (regulation, acquisitions, leverage, best-of-breed), costs (egress, duplicated skills and tooling, lowest-common-denominator designs), portable layers (Kubernetes, Terraform, OpenTelemetry, Postgres).
- IaC practice: high-level constructs/modules, grants, reviewing synthesised output, policy-as-code, drift detection.
Numbers to remember
- Lab: ~30 lines of CDK → 52 resources; grants produced resource-scoped policies; NAT per zone ≈ $33/month each before data; synthesised database defaults: not encrypted, no deletion protection, HTTP listener.
Pitfalls
- Trusting construct and module defaults without reading the output.
- Learning many clouds superficially.
- Multi-cloud for its own sake, paying egress and complexity.
- Hand-written
* policies instead of grants.
- Unencrypted storage and HTTP listeners in production.
Glossary
- CDK construct: a reusable component that generates cloud resources.
- Synthesis: turning IaC code into deployable templates.
- Landing zone: a pre-configured multi-account environment with guard rails.
- Isolated subnet: a subnet without any route to the internet.
- Policy-as-code: automated rules checking infrastructure definitions.
- Egress: data leaving a cloud or region, usually charged.
91
Key ideas
- Six pillars: operational excellence, security, reliability, performance efficiency, cost optimisation, sustainability; Azure WAF (five pillars) and Google Cloud's Architecture Framework ask similar questions.
- Operational excellence: IaC, CI/CD, small reversible changes, observability, runbooks, game days, post-incident reviews.
- Security: identity foundation, traceability (logs), defence in depth, data protection, automated detection and response.
- Reliability: SLOs and error budgets, fault isolation (zones, cells), automatic recovery, tested backups, DR strategies (RTO/RPO), quotas and limits.
- Performance efficiency: right resource types, caching, load testing, scaling, experimentation.
- Cost optimisation: visibility (tags, cost allocation), rightsizing, pricing models, lifecycle, architecture choices (serverless vs always-on), FinOps.
- Sustainability: utilisation, efficient hardware (Arm), region choice, data minimisation.
- Reviews: questions, evidence, high/medium risks, improvement plans; automated checks plus human judgement; documented suppressions.
Numbers to remember
- Error budgets for 30 days: 99% 432 min, 99.9% 43.2 min, 99.95% 21.6 min, 99.99% 4.3 min.
- Lab: cdk-nag found 15 issues in 42 checks; a 2% error rate burns a 99.9% budget in 1.5 days, a 50% outage in 86 minutes.
Pitfalls
- "Highly available" without an SLO.
- DR plans never tested.
- Suppressing findings without reasons, or fixing irrelevant ones.
- Reviews done once and never revisited.
- Optimising one pillar (cost) by silently sacrificing another (reliability).
Glossary
- SLO / SLI: objective / the measured indicator.
- Error budget: allowed unreliability under an SLO.
- Burn rate: how fast the error budget is being consumed.
- RTO / RPO: recovery time / recovery point objectives.
- Pilot light / warm standby: DR strategies with minimal or scaled-down running copies.
- Suppression: a documented, accepted exception to a rule.