DoorDash Cloud Engineer (Junior Level) Interview Preparation Guide
DoorDash's Cloud Engineer interview process typically involves an initial recruiter screening, followed by one technical phone screen assessing cloud fundamentals and problem-solving ability. The onsite interview loop (typically 4-5 rounds for junior level) evaluates hands-on cloud infrastructure skills, architectural thinking, operational readiness, system troubleshooting, and cultural alignment. The process emphasizes practical cloud management, infrastructure design, and collaboration with development teams.
Interview Rounds
Recruiter Screening
What to Expect
Initial screening call with a recruiter to assess basic qualifications, career goals, and cultural fit. This includes validation of background, discussion of the role and team, and confirmation of your interest in cloud infrastructure and DoorDash's logistics platform challenges. The recruiter may ask about your experience with cloud platforms, reasons for applying, and salary expectations. This round also covers logistical details about the interview process and timeline.
Tips & Advice
Be concise and enthusiastic about cloud technologies and infrastructure challenges. Highlight any relevant cloud certifications (AWS Solutions Architect Associate, AZ-900) or hands-on projects. Show genuine interest in DoorDash's logistics and delivery platform. Ask thoughtful questions about the team structure and on-call requirements. Have your resume reviewed and ready to discuss specific projects. Be honest about your experience level as a junior candidate—recruiters expect and respect transparency.
Focus Topics
Cloud Certifications & Continuous Learning
Any relevant certifications (AWS Associate, AZ-900), online courses completed, or self-study in cloud platforms
Practice Interview
Study Questions
Career Motivation & Role Understanding
Why you're interested in cloud engineering, understanding of DoorDash's infrastructure needs, and how this role aligns with your career goals
Practice Interview
Study Questions
Your Cloud Experience & Background
Summary of your hands-on cloud experience, platforms used (AWS/GCP/Azure), types of infrastructure managed (compute, databases, networking), and relevant projects
Practice Interview
Study Questions
Technical Phone Screen
What to Expect
A 60-minute technical conversation with a senior engineer or cloud architect from the team. This round assesses your understanding of cloud fundamentals, ability to discuss infrastructure design decisions, and problem-solving approach. You'll be asked conceptual questions about cloud services (compute, storage, networking, databases), scenarios requiring you to recommend appropriate AWS/GCP/Azure services, and a practical troubleshooting scenario (e.g., 'Your web application is experiencing latency spikes—how would you diagnose and fix it?'). This is not a coding round but may involve whiteboarding architectural diagrams or writing pseudocode for automation scripts.
Tips & Advice
Think out loud and ask clarifying questions before diving into answers. Draw diagrams or write pseudocode when discussing infrastructure design. Use specific service names (e.g., 'EC2', 'RDS', 'ELB') rather than generic terms. When faced with a troubleshooting scenario, demonstrate a methodical approach: gather metrics, isolate the problem, hypothesize, test, and implement. Mention monitoring tools and logging practices. For junior level, showing a solid understanding of fundamentals and willingness to learn is more important than deep expertise. If you don't know something, say so and explain how you'd investigate it. Ask clarifying questions about DoorDash's infrastructure (scale, regions, deployment frequency) to contextualize your answers.
Focus Topics
Containers & Orchestration Fundamentals
Basic Docker concepts (images, containers, registries), Kubernetes basics (pods, deployments, services), and why containerization matters for cloud-native applications
Practice Interview
Study Questions
Infrastructure Troubleshooting & Diagnostics
Systematic approach to diagnosing infrastructure issues: gathering metrics, analyzing logs, identifying root causes, implementing fixes. Tools: CloudWatch, VPC Flow Logs, application performance monitoring
Practice Interview
Study Questions
Cloud Migration Concepts
Understanding of migration strategies (lift-and-shift, re-platform, re-architect), challenges in moving workloads to cloud, and DoorDash context (migrating delivery coordination systems, payment processing)
Practice Interview
Study Questions
Cloud Networking & Security
VPC design, subnets, routing, load balancing, security groups, NACLs, VPN, and basic security best practices (least privilege access, encryption, network isolation)
Practice Interview
Study Questions
AWS Core Services (EC2, S3, RDS, VPC, IAM)
Deep understanding of compute (EC2 instance types, Auto Scaling), storage (S3 buckets, lifecycle policies), relational databases (RDS multi-AZ, read replicas), networking (VPC subnets, security groups, NAT gateways), and identity management (IAM roles, policies)
Practice Interview
Study Questions
Onsite Round 1: Technical Interview - Hands-On Cloud Infrastructure
What to Expect
A 90-minute technical interview focused on practical cloud engineering skills. You'll be given real-world scenarios and asked to design or troubleshoot cloud infrastructure. Scenario examples: 'Design a VPC architecture for a microservices application that needs multi-AZ resilience', 'Troubleshoot why an RDS database is experiencing connection timeouts', or 'Write Terraform code to provision an Auto Scaling group'. The interview may involve live whiteboarding or writing pseudocode/Infrastructure as Code snippets. The interviewer assesses your ability to apply cloud knowledge to concrete problems, consider trade-offs, and explain your reasoning.
Tips & Advice
Ask clarifying questions about requirements, scale, and constraints before proposing a solution. Draw architecture diagrams clearly, labeling all components and data flows. Discuss trade-offs (cost vs. performance, complexity vs. resilience). For Infrastructure as Code questions, write clean, readable code with meaningful variable names; you don't need to write production-ready code but should demonstrate understanding of the tool (Terraform, CloudFormation). Mention monitoring, alerting, and logging as part of your solution. For troubleshooting scenarios, walk through your diagnostic process step-by-step. Don't rush to implement a fix—demonstrate that you understand the root cause first. Acknowledge assumptions and limitations of your design. For junior level, showing systematic thinking and ability to apply fundamentals is more important than designing highly complex systems.
Focus Topics
Cloud Cost Optimization
Understanding cost implications of infrastructure decisions (instance types, data transfer, reserved instances), monitoring costs, and recommending optimizations
Practice Interview
Study Questions
Monitoring, Logging & Alerting
Using CloudWatch, application logging, distributed tracing, and setting up alerts for infrastructure issues; understanding observability as a design principle
Practice Interview
Study Questions
Infrastructure as Code (Terraform/CloudFormation)
Writing and reasoning about IaC templates to provision cloud resources, managing state, and understanding the benefits of infrastructure automation
Practice Interview
Study Questions
Database Architecture & Optimization
Choosing between RDS (multi-AZ, read replicas), DynamoDB, or managed databases; connection pooling, query optimization, and backup strategies
Practice Interview
Study Questions
AWS Architecture Design for Scalability
Designing VPC architectures with multi-AZ deployment, load balancing, Auto Scaling, and ensuring high availability for DoorDash applications
Practice Interview
Study Questions
Onsite Round 2: Cloud Architecture & System Design
What to Expect
A 60-minute architectural thinking interview where you're asked to design a cloud-based system for a realistic DoorDash scenario (e.g., 'Design the cloud infrastructure for the order tracking system' or 'Design a system to handle real-time GPS tracking for delivery drivers'). This is less about coding and more about architectural reasoning: service selection, data flow, resilience patterns, and trade-offs. You'll whiteboard your solution and discuss design decisions. The interviewer probes your understanding of distributed systems concepts (eventual consistency, redundancy, failover), cloud service selection rationale, and operational considerations.
Tips & Advice
Start with requirements clarification (scale, availability targets, latency requirements, consistency needs). Draw a clear architecture diagram showing components, data flows, and interactions. Justify why you chose specific AWS services over alternatives. Discuss failure modes and how your design handles them. For a junior level interview, don't over-engineer—focus on simplicity with intentional trade-offs. Mention redundancy, failover mechanisms, and disaster recovery considerations. Discuss how you'd monitor and operate the system post-launch. Be prepared to pivot your design if the interviewer introduces constraints (e.g., 'Now imagine this needs to support 10x load'). Use DoorDash context (order latency is critical, high availability required, multi-region deployment) to inform your decisions.
Focus Topics
API Gateway & Load Balancing Design
Designing API endpoints for scalability, load balancing strategies (round-robin, least connections, geographic routing), rate limiting, and API versioning
Practice Interview
Study Questions
Disaster Recovery & Backup Strategy
RTO/RPO concepts, multi-region active-passive or active-active setups, automated failover, data replication, and backup automation
Practice Interview
Study Questions
Cloud Service Selection & Trade-offs
Evaluating AWS services (managed vs. self-managed), considering operational burden, cost, and fit for use case; making informed trade-off decisions
Practice Interview
Study Questions
Distributed Systems Concepts for Cloud
Eventual consistency, CAP theorem implications, asynchronous communication patterns, and designing for fault tolerance in distributed architectures
Practice Interview
Study Questions
Designing High-Availability Systems
Multi-AZ/multi-region architectures, failover mechanisms, redundancy strategies, and SLA planning for critical DoorDash services
Practice Interview
Study Questions
Onsite Round 3: Cloud Operations & Troubleshooting
What to Expect
A 60-minute interview focused on operational readiness and real-world troubleshooting. You'll be presented with infrastructure problems or on-call scenarios and asked to diagnose and resolve them. Examples: 'Your application's API latency suddenly increased—walk me through how you'd investigate', 'An EC2 instance is failing health checks—what could be wrong?', or 'You're getting paged for high CPU usage in production—how do you respond?'. The interviewer assesses your systematic troubleshooting approach, familiarity with observability tools, understanding of failure modes, and ability to communicate clearly during incidents.
Tips & Advice
Demonstrate a methodical troubleshooting process: (1) understand the symptoms and scope, (2) gather data from logs and metrics, (3) form hypotheses about root cause, (4) test hypotheses systematically, (5) implement and verify the fix. Mention specific tools (CloudWatch, CloudTrail, VPC Flow Logs, application logs). Show familiarity with AWS service-specific debugging (e.g., checking RDS performance insights, EC2 System Log). Be calm and methodical—the interviewer is evaluating your ability to stay focused during incidents. For junior level, demonstrating the correct investigative process is more important than immediately finding the solution. Ask clarifying questions (timeframe of issue, affected services, recent changes) before diving in. Discuss preventive measures and post-incident improvements.
Focus Topics
On-Call Best Practices & Incident Communication
Escalation procedures, communicating during incidents, post-incident reviews, and lessons learned documentation
Practice Interview
Study Questions
Application Performance & Optimization
Identifying performance bottlenecks (CPU, memory, I/O, network), analyzing query performance, and recommending optimizations at infrastructure level
Practice Interview
Study Questions
Common Infrastructure Failure Modes
Understanding typical causes of outages (resource exhaustion, misconfiguration, network issues, database connection limits, dependency failures) and how to identify them
Practice Interview
Study Questions
AWS Observability & Monitoring Tools
CloudWatch (metrics, logs, alarms), CloudTrail (audit logs), VPC Flow Logs, application performance monitoring, and interpreting dashboards for root cause analysis
Practice Interview
Study Questions
Infrastructure Incident Diagnosis & Resolution
Systematic approach to investigating infrastructure outages: collecting metrics, analyzing logs, isolating root causes, and implementing fixes safely
Practice Interview
Study Questions
Onsite Round 4: Behavioral & Culture Fit
What to Expect
A 45-60 minute conversation with a team member or manager from the infrastructure/platform team. This round focuses on behavioral competencies, communication skills, teamwork, and cultural alignment with DoorDash. You'll discuss past experiences, how you handle challenges, collaboration with development teams, dealing with on-call stress, and your approach to learning new technologies. Questions often follow the STAR format (Situation, Task, Action, Result). The interviewer assesses whether you're a good fit for the team, can communicate effectively across technical and non-technical audiences, and embody DoorDash values (e.g., bias for action, ownership, focus on user experience).
Tips & Advice
Prepare 5-7 concrete examples from your work experience that demonstrate relevant behaviors: (1) taking ownership of a project, (2) collaborating with teammates to solve a problem, (3) handling a mistake or learning experience, (4) adapting to a challenging situation, (5) simplifying a complex technical problem for non-technical stakeholders, (6) dealing with on-call pressure or incident stress. Use the STAR method to structure stories clearly. Show genuine enthusiasm for infrastructure work and DoorDash's mission (reliable, fast delivery). Be authentic about challenges you've faced and what you learned. Ask thoughtful questions about the team culture, how decisions are made, and what success looks like in the first 90 days. For junior level, emphasize learning agility, eagerness to take on new challenges, and ability to work independently with guidance. Highlight collaboration examples and how you ask for help when needed.
Focus Topics
DoorDash Mission & User Focus
Understanding DoorDash's mission (reliable, fast delivery for customers and restaurants), how infrastructure supports that mission, and user-centric thinking
Practice Interview
Study Questions
Handling Ambiguity & On-Call Stress
Dealing with unclear requirements, debugging production issues under pressure, and maintaining composure during incidents or high-stress situations
Practice Interview
Study Questions
Learning & Continuous Improvement
Demonstrating curiosity about new cloud technologies, willingness to upskill, and approach to staying current with cloud trends and best practices
Practice Interview
Study Questions
Ownership & Accountability
Taking responsibility for infrastructure projects or tasks, following through to completion, and proactively communicating progress and blockers
Practice Interview
Study Questions
Cross-Functional Collaboration
Working effectively with software engineers, DevOps teams, and other infrastructure engineers; communicating technical concepts to non-technical stakeholders
Practice Interview
Study Questions
Frequently Asked Cloud Engineer Interview Questions
Inside cluster pods, DNS lookups to internal services are failing while external names resolve. Describe a CoreDNS troubleshooting checklist: how to check CoreDNS pod health, configmap, logs for errors, resource limits, caching behavior, and potential network policies or node-local DNS impacts that could break service discovery.
Sample Answer
If external names resolve from inside a pod but internal service names do not, the failure is narrowed to the cluster's own DNS chain: the CoreDNS pods, the ConfigMap-driven configuration file CoreDNS loads (the "Corefile"), or the path between the pod and CoreDNS's Service, rather than anything about the pod's general network path to the internet.
Reproduce and scope first
From a debug pod:
kubectl exec -it debug -- nslookup kubernetes.default
kubectl exec -it debug -- nslookup google.com
kubectl exec -it debug -- cat /etc/resolv.conf
A typical healthy resolv.conf looks like:
nameserver 10.96.0.10
search myns.svc.cluster.local svc.cluster.local cluster.local
options ndots:5
ndots:5 means any name with fewer than 5 dots is tried against each search suffix, in order, before being tried as-is; this is why a pod resolving google.com (0 dots, tried as-is only after search-suffix attempts fail) can feel slower than an internal Service name (which matches early in the search list) even when both eventually succeed, and why a fully-qualified name (payments.myns.svc.cluster.local., trailing dot) skips the search list entirely and is useful for isolating a resolver bug from a naming mistake.
CoreDNS pod health
kubectl get pods -n kube-system -l k8s-app=kube-dns -o wide
kubectl describe pod <coredns-pod> -n kube-system
kubectl top pod <coredns-pod> -n kube-system
Look for CrashLoopBackOff, OOMKilled (a container killed because it exceeded its memory limit) in the describe output, or a node placement that concentrates all CoreDNS replicas on one node, which turns a single node failure into a total DNS outage.
Configuration (Corefile) and logs
kubectl get configmap coredns -n kube-system -o yaml
A typical Corefile fragment:
.:53 {
errors
health
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
}
forward . /etc/resolv.conf
cache 30
loop
reload
}
The kubernetes plugin block is what makes cluster.local names resolve at all; the forward line is what sends everything else (including external names) upstream to the node's own resolver. If someone edited this ConfigMap and narrowed the kubernetes zone or removed the plugin block, internal names would fail while external names, served entirely by forward, kept working, which matches the reported symptom exactly.
Logs distinguish the two failure classes:
kubectl logs -n kube-system <coredns-pod>
[ERROR] plugin/errors: 2 payments.myns.svc.cluster.local. A: read udp: i/o timeout
An i/o timeout on a forward upstream points at the node's external resolver or egress path, and would affect external names too. Compare against:
[ERROR] plugin/errors: 2 payments.myns.svc.cluster.local. A: dns: overflow packet, or NXDOMAIN from the kubernetes plugin
An NXDOMAIN from the kubernetes plugin specifically for a name that should exist means CoreDNS's own view of Services/Endpoints is stale or the API server watch it depends on has dropped, which is internal-only, matching the symptom.
Resource limits and caching
- Check CPU/memory requests and limits on the CoreDNS Deployment; a CoreDNS pod that is CPU-throttled under load will start silently dropping or delaying UDP queries rather than erroring cleanly.
- The
cache 30directive caches answers for up to 30 seconds; if a Service's ClusterIP changed and clients still get the old answer, that is expected cache behavior, not a bug, and resolves itself once the TTL expires, or immediately if the CoreDNS pods are restarted (a valid short-term mitigation, not a root-cause fix).
Network policies and node-local DNS
- If NetworkPolicies are in use, confirm nothing blocks UDP/TCP port 53 between application pods and the CoreDNS pods; a default-deny egress policy applied without an explicit DNS allow rule is a very common way to silently break only internal-plus-external-through-CoreDNS resolution while leaving direct external traffic (if a pod also has broader egress) unaffected.
- If NodeLocal DNSCache is deployed (a per-node caching DNS agent, run as a DaemonSet, that intercepts DNS queries locally before they reach CoreDNS to reduce load and cross-node hops), the debugging surface shifts: check the
node-local-dnsDaemonSet pods and logs on the affected node first, since a broken node-local cache can itself return stale or failed answers even when central CoreDNS is completely healthy.
Trade-offs and pitfalls
- Restarting CoreDNS "fixes" almost any transient symptom by flushing the cache and re-establishing API watches, which is exactly why it is tempting and exactly why it should not be treated as a root-cause fix; if the underlying cause (a bad ConfigMap edit, a NetworkPolicy, resource starvation) is not addressed, the symptom returns.
ndots:5(the Kubernetes default) is a frequent source of confusion mistaken for a CoreDNS bug: a workload issuing many external DNS lookups pays for several failed search-suffix attempts per lookup before the name resolves externally, which shows up as elevated CoreDNS query volume and latency for a problem that is actually a resolver configuration tuning question, not a CoreDNS defect.- NodeLocal DNSCache changes which component to check first; forgetting it is in play and debugging CoreDNS centrally while the actual stale/failing answer is coming from the node-local agent wastes an entire investigation cycle.
Design the network and DNS strategy for a migration that requires both low latency connectivity during cutover and the ability to rollback quickly. Cover options such as VPN vs Direct Connect/ExpressRoute, bandwidth planning, split-horizon DNS, TTL changes, weighted routing, and a sample DNS cutover sequence to ensure minimal packet loss and fast rollback.
Sample Answer
Direct answer: For a migration cutover needing both low-latency connectivity and fast rollback, favor a dedicated, low-latency link (Direct Connect/ExpressRoute-class) over a VPN for the connectivity itself, paired with a DNS/routing strategy (split-horizon DNS with a short TTL and weighted routing) designed so rollback is a routing change, not a re-provisioning event.
Structured elaboration. VPN vs Direct Connect/ExpressRoute: a VPN (over the public internet, IPsec-encrypted) is faster to provision and lower cost, but has less predictable latency and throughput (subject to internet path variability); Direct Connect/ExpressRoute (a dedicated, private connection to the cloud provider) gives predictable low latency and higher throughput, at higher cost and longer provisioning lead time, and is the better choice when "low latency connectivity during cutover" is a stated hard requirement, as here. Bandwidth planning: size the dedicated connection for peak cutover-window traffic (which may exceed steady-state, if the cutover window itself involves data-sync catch-up traffic on top of normal application traffic), not just average load. Split-horizon DNS: serve different DNS answers depending on whether the query originates from inside the migration's private network path versus the public internet, useful for testing the new environment via the private/internal path before it's exposed to public DNS at all, decoupling internal validation from the actual public cutover moment. TTL changes: lower TTL well ahead of the cutover so any previously-cached, higher-TTL answer has fully expired before the actual change, so the public DNS change itself propagates quickly once executed. Weighted routing: use weighted DNS or a load-balancer-level traffic split to shift traffic gradually rather than all-at-once, which directly serves the "ability to rollback quickly" requirement, since a weighted shift can be reversed by adjusting the weight back, faster and less disruptive than reversing a full DNS cutover. Sample DNS cutover sequence ensuring minimal packet loss and fast rollback: (1) validate the new environment over the private/dedicated link using split-horizon DNS, invisible to public traffic; (2) lower public TTL and wait for propagation; (3) begin a weighted public traffic shift (small percentage first); (4) monitor for packet loss/latency/error-rate regressions at each weight increment; (5) increase weight progressively to 100% only once each increment holds clean; (6) keep the old path's weight available (even at a small non-zero value, or simply not yet decommissioned) for fast reversal if a regression appears even late in the shift.
Worked example. A migration with a strict cutover-latency requirement: provision a dedicated low-latency link ahead of the migration window, validate the new environment fully over that private path (using split-horizon DNS so this validation traffic never touches public routing), then execute the public cutover as a weighted shift starting at 10%, holding 15 minutes at each step, watching packet loss and latency percentiles, reaching 100% over roughly an hour if all steps hold clean; rollback at any point is simply resetting the weight, typically effective within seconds to low minutes rather than requiring a full DNS re-propagation cycle.
Trade-offs & pitfalls. Relying on a VPN for a migration with an explicit low-latency requirement, purely because it's faster to provision, risks the connectivity itself becoming the latency bottleneck the migration was trying to avoid; the provisioning-lead-time cost of a dedicated connection needs to be planned into the migration timeline early enough that it isn't a forced compromise later.
Architect a secure multi-tenant SaaS platform in the cloud that must isolate tenant data and workloads while maximizing resource efficiency. Discuss tenant isolation models (separate accounts, VPC-per-tenant, namespace-level), encryption strategies (tenant-scoped keys), identity and authentication model, provisioning automation, and how you'd implement tenant-level observability and billing.
Sample Answer
Clarify goals & constraints
Isolate tenant data/workloads, meet compliance, minimize cost, support thousands of tenants, operational simplicity.
Tenant isolation models (trade-offs)
- Separate cloud accounts (AWS Organizations/GCP Folders): strongest blast-radius isolation, distinct networking/iam/billing — higher cost/management overhead. Use for high-risk/regulated tenants.
- VPC-per-tenant (single account): strong network isolation via dedicated VPCs, route tables, NGWs; simpler account footprint but IAM/network limits and cross-VPC scaling overhead.
- Namespace-level (K8s namespaces, DB schema, IAM roles): most efficient for many small tenants, lowest cost; relies on strict RBAC, NetworkPolicies, Pod Security Standards, resource quotas and service-mesh mTLS to enforce isolation. Use for low-trust tenants.
Recommend hybrid: onboarding policy routes high-risk tenants to separate accounts/VPCs; default to namespace-level with strict tenancy controls.
Encryption strategies
- Data at rest: tenant-scoped keys in KMS (Customer-Managed Keys per-tenant or per-tenant-key-wrapped-by-root-key). Use envelope encryption so S3/DB objects encrypted per-tenant.
- Data in transit: TLS everywhere; mTLS for service-to-service.
- Key lifecycle: rotate keys, automatic rewrap, key access audited. If tenant requests key control, support Bring-Your-Own-Key (BYOK).
Identity & authentication
- Tenant-auth: OIDC-backed (AuthN via centralized IdP or tenant IdP via federation). Support SCIM for provisioning.
- Service identities: short-lived credentials (STS, Workload Identity, IAM Roles for Service Accounts).
- Authorization: centralized policy engine (OPA/Gatekeeper) with fine-grained RBAC/ABAC. Use scoped roles per-tenant and attribute-based checks (tenant_id claim).
Provisioning automation
- IaC templates (Terraform modules, CloudFormation, ARM) with parameterized tenant profiles.
- Org-level Service Catalog / Landing zone to instantiate account/VPC/namespace with guardrails (SCPs, IAM baseline, Logging/Monitoring).
- CI/CD: automated tenant bootstrap pipeline that runs tests, deploys quotas, generates tenant keys, creates IAM roles, and publishes onboarding report.
Tenant-level observability & billing
- Observability: tag/label all resources and telemetry with tenant_id. In K8s use namespaces + label propagation; inject tenant_id into request traces at API gateway. Use multi-tenant-aware Prometheus (per-tenant metrics via tenant label) or isolated TSDBs for high-risk tenants. Centralized tracing (Jaeger/Tempo) with tenant filters and retention policies. Send logs to centralized ELK/Cloud Logging with indices per-tenant and role-based access. Integrate SIEM for cross-tenant alerts.
- Billing: enforce cost allocation tags, export cost & usage to data warehouse (e.g., Athena/BigQuery) and run per-tenant metering: API gateway usage, compute hours, storage bytes, DB queries. Build billing jobs that apply pricing rules; for high-accuracy, implement per-tenant usage collectors or sidecars that emit metering events to a billing service.
Operational controls & guardrails
- Enforce org policies (SCPs), IAM least privilege, automated compliance checks, automated backups, and tenant resource quotas.
- Incident response: tenant-scoped playbooks, isolation runbooks (quarantine account/VPC/namespace).
- Trade-offs: stronger isolation increases cost/operational complexity; choose hybrid model and automate heavily.
This design balances security and efficiency via a policy-driven hybrid isolation model, tenant-scoped encryption, centralized authz/authn, automated provisioning, and telemetry+metering tied to tenant identifiers.
Your team provisions infrastructure with Terraform and configures the software on it with Ansible. Walk through how you'd sequence the two, how you'd treat resources that get replaced versus updated in place, and how you'd avoid race conditions when both tools touch the same host during a rollout.
Sample Answer
Direct answer
Sequence Terraform first to create the immutable infrastructure primitives, then Ansible to configure the software on top, coordinated through an explicit handoff (Terraform outputs written somewhere Ansible reads) rather than a provisioner embedded inside the Terraform run. Resources Terraform replaces (not updates in place) need Ansible's inventory to be dynamic, so a new instance is picked up automatically instead of Ansible converging against a host that no longer exists.
Sequencing
flowchart TD
A[Terraform apply] --> B[Outputs: IPs, tags, ASG membership]
B --> C[Written to SSM Parameter Store or Consul]
C --> D[Ansible dynamic inventory pull]
D --> E[Ansible playbook: configure and smoke test]
E --> F[Health check passes]
F --> G[Traffic shifted to new hosts]
OS packages vs. cloud resources: which tool owns what
The split is by what the resource actually is, not by convenience:
- Terraform owns: cloud resources (VPCs, subnets, load balancers, ASGs, disks, managed databases) and anything the cloud provider tracks as a first-class object with its own lifecycle.
- Ansible owns: OS-level state on a running host (installed packages, config files, running services, secrets placement, feature flags) that changes more often than the infrastructure underneath it and does not require a new instance to change.
A common mistake is letting this blur: using Terraform's local-exec/remote-exec provisioners to do Ansible's job loses the idempotency and retry behavior Ansible already gives for free, and using Ansible to try to create cloud resources it was never meant to own long-term leaves no clean plan/apply audit trail for that resource.
Replace vs. update in place
- In-place update (a security group rule change, a tag change, resizing a volume): Terraform updates the resource, the host keeps its identity, and Ansible does not need to re-run against it unless the change also implies new software state.
- Replace (a new AMI, meaning Amazon Machine Image, the VM image an instance boots from; or a launch-template change behind an ASG, an Auto Scaling Group that adds and removes instances automatically): Terraform destroys and recreates, or an ASG rolling-replace cycles instances. The new host has a new IP and instance ID, so Ansible's inventory must be dynamic, pulled from Terraform state, cloud tags, or the ASG itself at run time, never a static inventory file, or the playbook silently targets hosts that no longer exist and skips the ones that do.
Avoiding race conditions
- Never run Ansible against a host before Terraform (or the ASG) reports it healthy; gate on a readiness signal (instance status checks, an ASG lifecycle hook), not a fixed sleep.
- Make every Ansible task idempotent with retries and backoff, since a host can be reachable over SSH before all of its cloud-side dependencies (an attached volume, a DNS record) have finished propagating.
- Centralize Terraform state with locking (S3+DynamoDB or Terraform Cloud) so two pipeline runs cannot apply concurrently and hand Ansible two different, half-applied views of the same infrastructure.
- Keep a Terraform change and its matching Ansible change in the same pipeline run, with Terraform plan and an Ansible dry-run (
--check) both gating merge, so the two never drift out of sync between separate deploys.
Worked example
Rolling out a new AMI behind an autoscaling group: Terraform updates the launch template and triggers an instance refresh. Each new instance registers with the ASG, which Ansible's dynamic inventory (pulled from the ASG at run time) picks up. Ansible configures the new AMI's bootstrap state and runs a smoke test. Only after the smoke test and the ASG's own health check pass does the load balancer start sending it production traffic, and only then does the old instance get terminated.
Trade-offs & pitfalls
- Embedding Ansible calls as Terraform provisioners looks simpler but couples the two tools' failure and retry semantics: a transient SSH failure now fails the whole
terraform apply, not just a re-runnable playbook. - Static Ansible inventories are the single most common source of "it worked last time" bugs once autoscaling or blue/green replacement is in play. Treat a static inventory file as a code smell once resources can be replaced.
- A convergence loop that just re-runs Ansible on a schedule "until it works" can mask a real Terraform-side problem (a resource stuck in a bad state) behind an Ansible retry that never actually fixes the root cause. This convergence-at-scale discipline matters more the larger the fleet gets, since a masked root cause compounds across every host it touches.
Compare EC2 purchasing options: On-Demand, Reserved Instances (standard and convertible), Savings Plans, and Spot. For each, describe a workload it fits well and the main risk you take on.
Sample Answer
Match the purchasing option to two properties of the workload: how predictable its usage is, and how much interruption it can tolerate. On-Demand is the flexible, no-commitment baseline; Reserved Instances and Savings Plans trade commitment for discount on predictable usage; Spot trades interruption risk for the deepest discount on fault-tolerant work. Most real fleets blend two or three of these rather than picking one.
The options
| Option | Commitment | Discount vs. On-Demand | Fits well | Main risk you take on |
|---|---|---|---|---|
| On-Demand | None | None (baseline) | Dev/test, unpredictable bursts, first deployment of a new workload | Highest unit cost |
| Reserved Instances, Standard | 1 or 3 years | Highest RI discount | Stable, long-lived services you're confident will stay on the same instance family/region | Stranded commitment if the workload changes shape; can't exchange the instance family, only resize/modify within it |
| Reserved Instances, Convertible | 1 or 3 years | Lower than Standard RI | Stable steady-state you expect to re-platform (family/OS changes) during the term | Still a spend commitment; exchanging doesn't refund the worse rate already paid |
| Savings Plans (Compute or EC2 Instance) | 1 or 3 years, committed $/hour | Comparable to RI tiers depending on flexibility chosen | Predictable aggregate spend even if the instance mix shifts | Pay for the committed $/hour even if usage drops below it |
| Spot | None | Deepest discount (commonly cited up to ~90% off On-Demand, market-dependent) | Fault-tolerant, stateless, horizontally scaled, or checkpointable batch work | Reclaimed on short notice; unsuitable for single-instance stateful services |
A detail worth knowing on Savings Plans: Compute Savings Plans apply flexibly across instance family, region, and OS, and even to Fargate and Lambda usage, at a slightly lower discount; EC2 Instance Savings Plans lock to a specific instance family in a specific region for a higher discount. The choice mirrors RI Standard vs. Convertible: more flexibility costs you some discount.
Spot interruption handling
Spot capacity can be reclaimed with a two-minute interruption notice, delivered via the instance metadata service and (optionally) an EventBridge (AWS's event-bus, used for routing events between services) event, giving the workload a short window to checkpoint or drain. Standard mitigations:
- Diversify across multiple instance types, sizes, and AZs using an Auto Scaling Group's mixed-instances policy or Spot Fleet with the capacity-optimized allocation strategy, so a single pool's interruption doesn't take out the whole fleet.
- Design the workload to checkpoint progress (batch jobs) or to be stateless behind a load balancer (services), so losing an individual instance costs at most a few seconds of in-flight work.
- Keep a base layer of On-Demand or committed capacity for the portion of the fleet that can't tolerate interruption, and let Spot absorb the elastic/overflow portion.
Worked example: a mixed steady-plus-batch fleet
Say a service runs a steady web tier of 10 instances 24/7, plus a nightly batch job that needs up to 40 additional instances for 4 hours a night, over a 30-day month.
Steady-tier instance-hours=10×24×30=7,200 Batch instance-hours=40×4×30=4,800The steady 7,200 instance-hours is exactly the shape a commitment wants: constant, predictable, easy to size a 1-year Compute Savings Plan against. The 4,800 batch instance-hours is short, spiky, and only runs 4 hours a night, so committing to it wastes money on the other 20 hours; it's a better fit for Spot (or On-Demand fallback via a mixed-instances policy if Spot capacity is thin in that pool), since the batch job is exactly the fault-tolerant, checkpointable kind of work Spot interruption risk is acceptable for.
Trade-offs and pitfalls
- Buying RIs or Savings Plans before rightsizing locks in the wrong instance shape for the term.
- Committed spend is a finance risk, not just a technical one: if the org's usage shrinks, the commitment doesn't shrink with it.
- Putting a single-instance stateful database on Spot is a classic anti-pattern; interruption there means an outage, not graceful degradation.
- Concentrating an entire Spot fleet in one instance-type/AZ pool defeats the point of diversification: correlated interruptions can reclaim most of the fleet at once.
- Savings Plans and RIs don't apply to Spot usage, so a team that shifts workload onto Spot to save money can end up under-utilizing a commitment they already bought for On-Demand capacity.
Explain the difference between horizontal scaling and vertical scaling for a server-side component. Give one concrete example of each, and describe the benefits and limits of both.
Sample Answer
Direct answer
Vertical scaling means giving one machine more resources, more vCPU, more RAM; horizontal scaling means adding more machines and spreading load across them. Vertical scaling is simpler because the application doesn't have to change at all, but it has a hard ceiling, the biggest machine available, and concentrates failure in one box. Horizontal scaling has effectively no ceiling and shrinks the blast radius of any single machine failing, but it requires the application to tolerate running as multiple, coordinated instances rather than one.
Structured elaboration
Concrete examples
- Vertical: moving a relational database from a 4-vCPU/16 GB box to a 16-vCPU/128 GB box, with no code change required.
- Horizontal: adding more stateless web server instances behind a load balancer, whose internal balancing algorithm is its own topic and not re-derived here.
Failure domain
Vertical scaling keeps a single point of failure regardless of how big the box gets. Horizontal scaling spreads risk, but only if the application is actually stateless or its state is externalized to a shared cache or session store; otherwise "horizontal" is cosmetic, since any one instance still holds state nothing else can serve.
Cost is not just a resilience argument
Cloud pricing for a single bigger machine is usually not linear with its capacity; the largest instance sizes often carry a premium. That is a computable, not just intuitive, reason horizontal scaling is often cheaper at a given capacity level, not only more resilient (worked example below).
A practical default
Default to horizontal for anything stateless and customer-facing. Reach for vertical only for components that are genuinely hard to distribute, a single-writer relational database primary, some legacy single-threaded systems, and even then pair it with a replication and failover plan, since vertical scaling alone still leaves a single point of failure.
Worked example
Say a 4-vCPU instance costs $0.20/hour and a 32-vCPU instance, 8 times the vCPUs, costs $2.40/hour, 12 times the price, a common cloud pattern where the largest instance sizes carry a premium rather than a linear price-per-vCPU:
4 vCPU$0.20/hr=$0.05 per vCPU-hour (small instance),32 vCPU$2.40/hr=$0.075 per vCPU-hour (large instance)
To cover 100 vCPU-equivalents of load, the same figure from the instance-sizing question above:
⌈4100⌉=25 small instances×$0.20/hr=$5.00/hr (horizontal)
⌈32100⌉=4 large instances×$2.40/hr=$9.60/hr (vertical, chunkier boxes)
Scaling out with many small instances here is essentially half the cost of the same capacity in a few large boxes, purely from the assumed per-vCPU pricing premium at the top end, and it spreads that 100 vCPU-equivalents of load across 25 failure domains instead of 4. This is illustrative pricing, not any specific vendor's current rate, but the shape, larger instances costing more per unit of capacity, is common enough to be worth checking for any real vendor before assuming vertical scaling is free of a cost penalty beyond its availability risk.
Trade-offs & pitfalls
- Assuming vertical scaling is always simpler and cheaper because it "requires no code changes"; it can cost more per unit of capacity and still leave a single point of failure.
- Scaling horizontally without externalizing state first, sessions or in-memory caches tied to one instance, producing a fleet of instances that isn't actually interchangeable and defeats the point.
- Not having a plan for vertical scaling's eventual ceiling; if a component structurally can't be distributed, that is a standing operational risk worth naming explicitly, not a decision to defer indefinitely.
- What separates a senior answer: bringing in the cost-per-unit-of-capacity angle alongside the resilience angle, since stakeholders outside engineering often hear only the failure-domain argument and miss that horizontal can also be the cheaper option.
Define and contrast strong (linearizable), sequential, causal, and eventual consistency. For each, give one practical system example and describe one anomaly that model does NOT rule out that a stronger model would.
Sample Answer
Linearizability, sequential, causal, and eventual consistency are four progressively weaker guarantees about the order in which operations on shared data appear to happen. Linearizability makes every operation look instantaneous and match real, wall-clock time. Sequential consistency drops the real-time requirement but still gives every observer the same single global order. Causal consistency only orders operations that are actually cause-and-effect related, letting unrelated operations be seen in different orders on different replicas. Eventual consistency drops ordering guarantees almost entirely and only promises that replicas converge once writes stop. Each weaker model permits more anomalies than the one above it.
| Model | What it guarantees | Real example | Anomaly it still permits |
|---|---|---|---|
| Linearizable | Every operation appears to take effect atomically at one point between its start and end, in real-time order | ZooKeeper's writes, coordinated through its Zab consensus protocol | Per-key recency alone doesn't buy multi-key transactional atomicity: a client can see one key updated and a related second key not yet updated if nothing wraps them in a transaction |
| Sequential | All observers agree on one global order of operations, and each process's own operations appear in its own program order, but that shared order need not match real time | A replicated log served by any in-sync follower, without a leader lease or read-index check on the read path | A client can read a value that is already stale in real time, even though every other client agrees on the same, slightly-behind, order |
| Causal | Operations that are causally related are seen in that order everywhere; unrelated, concurrent operations can be seen in different orders on different replicas | MongoDB's causally consistent sessions | Two unrelated writes, say two different users each editing their own unrelated profile field, can be applied in opposite orders on different replicas, and causal consistency permits that since there's no cause-effect link between them |
| Eventual | If writes stop, replicas eventually converge; no ordering guarantee during the window beforehand | DNS record propagation; classic Dynamo-style key-value stores with asynchronous replication | A reader can see a write appear then briefly seem to disappear if a stale replica answers a later read; a secondary index or materialized view built from an eventually-consistent base can lag behind, or reference rows the base table has already changed |
Worked example: why causal consistency prevents an anomaly eventual consistency allows
Consider a social feed. Two events happen, in this order, involving the same user's friend:
- Event P: a user publishes Post P.
- Event C: after reading Post P, the user's friend writes Comment C, which references Post P.
Because the friend read P before writing C, C causally depends on P: P happened-before C.
- Under causal consistency, any replica that delivers C to a reader must already have delivered P to that same reader. There is no way for a client to see Comment C replying to Post P without also being able to see Post P: the system enforces the happened-before relationship on delivery.
- Under eventual consistency alone, P and C might replicate along different paths (different shards, different network routes) with no ordering guarantee between them. A reader on a lagging replica could receive C's replication packet before P's, and briefly render a comment that references a post the reader's own client cannot find yet, an orphaned reply. That is exactly the anomaly eventual consistency does not rule out and causal consistency does.
Because eventual consistency only promises the base table converges, a secondary index or materialized view (for example, a 'comments by post' index used to render the feed) can lag the base write for an unbounded window: the index might still return zero comments for Post P for some time after Comment C has already durably landed on a majority of the base replicas, since building the index from the base table's write stream is itself an eventually-consistent process, not an atomic one.
Trade-offs & pitfalls
- Common wrong turn: treating eventual consistency as one well-defined guarantee. It is really the absence of a guarantee during the convergence window, so two systems both labeled eventually consistent can behave very differently depending on how long that window typically is, and what session-level guarantees (read-your-writes, monotonic reads) are layered on top.
- Sequential consistency is rarely offered as a named product feature; it mostly shows up as an accidental byproduct of serving reads from any replica of a system that internally agrees on a single write order, without adding a real-time freshness check on the read path.
- Causal consistency requires tracking dependencies, commonly via vector clocks or similar metadata, which costs storage and complicates garbage collection, the same trade-off logical clocks introduce elsewhere in this material.
- Senior answers name the actual anomaly each model still allows, not just that it is looser. An answer that only says eventual is looser than causal, without naming a concrete permitted anomaly, is incomplete.
Tell me about a time you worked with a cross-functional team. What was your role, and what made the collaboration succeed or struggle?
Sample Answer
Direct answer
Pick a project that genuinely needed more than one function, and be specific about two things: what YOU owned (not what 'the team' did), and the one concrete mechanism that determined whether the collaboration worked, such as a shared definition of done, a clear handoff point, or clarity on who decided what when opinions differed. Vague answers ('we communicated well') sound rehearsed; specific answers sound lived-in.
What the story needs to show
Your specific contribution. Interviewers are listening for what you personally decided or built, distinct from what your collaborators did. If every sentence is 'we', the interviewer cannot tell what you'd do differently on the next team.
A mechanism-level explanation. Organize the story around one of three lenses:
- Shared goal: did every function agree on what 'done' looked like and how success would be measured, or was each function quietly optimizing for its own definition?
- Interface or handoff: was there a clear point where work crossed from one function to another, and was that point actually defined, or did people guess?
- Decision rights: when functions disagreed, was it clear whose call it was, or did disagreement just stall until someone got tired of arguing?
Honesty if it's a struggle story. The question explicitly allows 'succeed or struggle'. A good struggle story ends on what you changed about the collaboration, not on who was at fault.
Worked example
Situation: [your team] needed to deliver [a feature or initiative] that required real work from [Team A, for example a design or research function] and [Team B, for example a data or infra function], against a fixed external date.
Task: your role was the one connecting the three groups, for example owning the shape of the interface between design and engineering, or owning how data requirements got translated into a schema.
Action: early on, each function had a different idea of what 'done' meant for their piece, which caused rework when the pieces met. You wrote a short one-page agreement naming the shared definition of done and who would sign off on each handoff, and used it to resolve the next two disagreements without a meeting.
Result: the project shipped on the revised date, and the agreement itself became something the group reused on the next cross-functional piece of work, which is the real marker of a story about redesigning the collaboration rather than just pushing through it.
To make that skeleton concrete rather than a fill-in-the-blank: picture a checkout redesign that needed real work from the design function and the payments engineering function, against a fixed external date tied to a promotional campaign launch. The specific disagreement was about what 'done' meant for the new payment-method selector: design considered the screen done once every state (loading, error, empty) matched the approved mockups pixel-for-pixel, while payments engineering considered it done once the integration correctly handled every payment-provider response code, even ones with no mockup drawn yet. That mismatch caused two rounds of rework when a payment-provider error state shipped without a design pass. The one-page agreement that resolved it included this line: 'A screen is done when it matches an approved mockup for every state the payments API can return, and any new state discovered after mockups are drawn triggers a joint 15-minute review before either side builds it.' That single sentence is what let the two functions stop re-litigating 'done' every time a new edge case appeared, and both sides signed off on it before the next round of work began.
Trade-offs and pitfalls
- A generic 'we all communicated well' answer with no mechanism is the single most common weak version of this story, avoid it.
- Over-crediting the team at the expense of your own specific contribution leaves the interviewer unable to evaluate you.
- If you pick a struggle story, resist framing it as the other function's fault. The senior version of this answer explains what you changed about how the groups worked together, not who dropped the ball.
- The strongest answers show you redesigning a structure (a handoff, a shared definition, a decision rule), not just working harder inside a broken one.
If you were choosing a logging backend for a team ingesting several terabytes of logs a day, how would you compare options like a self-hosted Elasticsearch/OpenSearch stack, Grafana Loki, and a commercial platform? What would you weigh in terms of expected scale, query latency, and cost model?
Sample Answer
Direct answer
At multi-terabyte-per-day scale, the deciding factor is less about UI polish and more about what each system actually indexes. Self-hosted Elasticsearch/OpenSearch inverts and indexes every field, giving fast queries at the cost of expensive storage and CPU at ingest; Grafana Loki indexes only labels and stores log content as compressed, unindexed chunks, giving cheap storage at the cost of slower ad-hoc full-text search; a commercial platform trades both problems away for a per-GB fee that, at this volume, becomes one of the largest line items in the infra budget.
Decision framework
| Backend | Indexing model | Query latency | Cost driver | Best fit at multi-TB/day scale |
|---|---|---|---|---|
| Elasticsearch / OpenSearch (self-hosted) | Full inverted index per field | Fast for structured queries and aggregations | CPU and memory at ingest (indexing every field), storage for indices plus replicas | Teams needing rich ad-hoc search and aggregation, willing to staff cluster ops (shard and index lifecycle management) |
| Grafana Loki | Labels indexed only; log lines stored as compressed chunks in object storage | Fast for label-filtered queries, slower for unindexed full-text search across chunks | Cheap object storage for chunks, minimal indexing cost, compute for query-time decompression | Teams already on Kubernetes and Grafana who want cost-efficient retention and can invest in good label design |
| Commercial platform | Vendor-managed indexing | Fast, vendor-optimized | Per-GB ingested and/or indexed, typically several times the raw infra cost of self-hosting the same volume | Teams that want near-zero ops burden, or need built-in compliance/SIEM features, and have budget for it |
Worked example
"Several terabytes a day" is a scale claim, so make it concrete before reasoning about it. Assume 5 TB/day of ingestion (a representative point inside "several terabytes") and an average structured JSON log line of 300 bytes (a reasonable size for a service log line with a handful of fields):
events/day=300 bytes/event5×1012 bytes/day≈1.67×1010 events/day avg events/sec=864001.67×1010≈1.93×105 EPSAt a sustained average of roughly 193K events/sec (and 2 to 3x that at a typical daytime peak), the practical implications diverge:
- Elasticsearch/OpenSearch: this ingest rate needs meaningful shard parallelism (dozens of primary shards across the hot tier) and continuous index lifecycle management (rollover, hot/warm/cold tiering), or the cluster falls behind and query latency degrades under load.
- Loki: the same volume is comfortable, since chunks are written append-only to object storage and indexing cost doesn't scale with log line count, only with label cardinality. The risk shifts to designing labels that don't create too many streams.
- Commercial: cost scales roughly linearly with the 5 TB/day regardless of query pattern, so this is the volume where per-GB pricing starts to dominate the infra budget conversation.
Trade-offs and pitfalls
- Elasticsearch/OpenSearch pitfall: dynamic field mapping on unstructured logs can silently explode cluster memory. Enforce explicit index templates rather than letting the mapping grow organically.
- Loki pitfall: over-labeling (putting a high-cardinality field like request_id into a label) turns Loki's cheap model into a cardinality problem just like a metrics backend. Keep labels to low-cardinality dimensions (service, environment, level) and put everything else in the log line body.
- Commercial pitfall: ingestion cost is usually billed on raw bytes before you've had a chance to filter or sample, so a noisy debug-level log from a misconfigured service can produce an unplanned bill spike. Sample or filter at the shipper before it leaves the host.
- Common wrong turn: benchmarking on a small dev-scale sample and assuming linear scaling. At multi-TB/day, tail behavior (GC pauses, shard rebalancing, chunk compaction) dominates far more than it does at low volume.
A stateful service runs on an autoscaling group where reserved instance commitments cover 60% of baseline capacity. How would you decide how much additional headroom to keep on top of that commitment for traffic spikes, versus minimizing cost? What metrics and historical data would inform that buffer?
Sample Answer
Direct answer
Because the reserved-instance (RI) commitment covers only 60% of steady-state baseline, the Auto Scaling group (ASG) already needs on-demand or spot capacity just to reach full baseline; the real question is how much additional headroom to add on top of that full baseline for spikes. Size that spike headroom from historical percentile demand (95th percentile as a default, adjusted for tail risk and instance warm-up time), cap it as a percentage of baseline to bound worst-case on-demand spend, and accept that a capped buffer will occasionally miss the rarest spikes, a gap you cover with spot capacity or graceful degradation rather than by paying to warm-provision for every possible peak.
Structured elaboration
1. Two different gaps, and they should not be conflated
- Baseline coverage gap: RIs cover only 60% of steady-state baseline, so the remaining 40% must run on-demand or spot every hour regardless of spikes. This is not headroom; it is an unavoidable always-on cost of the current commitment mix.
- Spike headroom: the additional capacity above full baseline needed to absorb traffic spikes without breaching your service-level objective (SLO).
2. Metrics and historical data to size the spike headroom
- Hourly (or finer) demand distribution over a trailing 90-365 day window; compute the 50th, 90th, 95th, and 99th percentiles (p50/p90/p95/p99), and note how often and for how long demand exceeds baseline.
- Instance warm-up time for this specific stateful service: if warm-up is slow, headroom has to be pre-provisioned and billed continuously rather than scaled on demand in real time.
- The blended cost of on-demand or spot capacity above the RI floor, so the headroom decision is priced, not just sized.
3. Picking the buffer: a percentile target with a cost cap
- Choose a target percentile based on SLO tolerance: the 95th percentile is a reasonable default for most stateful services, the 99th for anything where a miss is expensive.
- Cap the headroom as a percentage of baseline so a single anomalous spike does not blow up the budget, which deliberately accepts that the rarest spikes beyond the cap may not be fully covered by warm capacity.
- For the accepted residual risk above the cap, route to cheaper, slower-to-provision options: spot instances for any stateless portion of the workload, or graceful degradation, rather than paying to keep enough on-demand capacity warm for a spike seen only a few times a year.
- Recompute the percentiles monthly and after major releases; a buffer sized on last quarter's traffic silently drifts as the workload changes.
Worked example
Baseline steady-state need: 100 capacity units (instance-equivalents). The RI commitment covers 60% of baseline.
R=0.6B,baseline_gap=B−R
With B=100, that gives R=60 and a baseline coverage gap of 40 units that must run on-demand continuously, independent of any spike.
Trailing 90-day hourly demand, expressed as multiples of baseline:
| Percentile | Demand (x baseline) | Demand (units, B=100) |
|---|---|---|
| 50th | 1.00B | 100 |
| 90th | 1.25B | 125 |
| 95th | 1.40B | 140 |
| 99th | 1.65B | 165 |
Using a 95th-percentile target with a headroom cap of 10-40% of baseline:
spike_headroom=clamp(p95−B,0.10B,0.40B)
B=100,R=60,p95=140⇒spike_headroom=clamp(40,10,40)=40
ASG max capacity=R+(B−R)+spike_headroom=60+40+40=140
This exactly covers the 95th-percentile demand of 140. At the 99th percentile (165), the same capped headroom leaves a residual gap of 25 units for roughly the rarest 1% of hours, an explicit, accepted risk rather than an oversight.
Pricing the choice: assume an effective RI rate of $0.10/unit-hour and an on-demand rate of $0.16/unit-hour over a 730-hour month. The RI portion costs about $4,380/month; the 40-unit baseline gap costs about $4,672/month on-demand; the 40-unit spike headroom, kept warm around the clock (reasonable for a stateful service with slow cold-starts), costs roughly another $4,672/month, for about $13,724/month total. Extending coverage to also fully absorb the 99th-percentile spike (an extra 25 units warm at all times) would add about $2,920/month, roughly $35,000/year, to protect against demand that occurs in only about 1% of hours, which is the concrete number to put in front of the SLO owner rather than a decision made unilaterally by whoever owns the cloud bill.
Trade-offs and pitfalls
- Conflating the baseline coverage gap with true spike headroom: a heuristic that only measures "percentile minus RI capacity," without separately accounting for the RI shortfall against full baseline, can under-size the buffer so badly it cannot even serve steady-state demand.
- Sizing headroom purely on cost, choosing a lower percentile, without pricing the expected cost of a scaling miss (service-level agreement credits, lost revenue, incident time), can look cheaper on the infrastructure line while costing more overall.
- Ignoring warm-up time: if the stateful service cannot scale fast enough to react to a spike in real time, headroom has to be pre-provisioned and billed continuously, which changes the cost calculation materially.
- Treating the RI-to-on-demand mix as fixed forever: as baseline grows, revisiting whether to buy more reserved coverage is usually cheaper than permanently running a larger on-demand headroom.
Want to create your own tailored preparation guide using our deep research?
Get Started for FreeInterview-Ready Courses
Visual-first, interactive, structured learning paths