Skip to content
RED SAGSkills

Cloud Engineer interview questions and answers

30 questions interviewers really ask, with what a strong answer covers. Read them, then test yourself in a timed mock interview.

Start a Cloud Engineer mock interview

Easy questions easy

1. Explain the difference between IaaS, PaaS and SaaS with an example of each.

A strong answer covers:

  • IaaS gives raw compute, storage and network; customer manages OS and up
  • PaaS manages the runtime and OS; customer deploys code and data
  • SaaS is a complete application used by end users
  • Responsibility shifts to the provider as you move from IaaS to SaaS
  • Gives a correct real example of each
Show model answer

These are service models that differ in how much the provider manages. IaaS, Infrastructure as a Service, gives you virtual machines, disks and networks, like Amazon EC2 or Azure Virtual Machines. You manage the operating system, patches, runtime and application. PaaS, Platform as a Service, also manages the OS and runtime, so you just deploy code, for example AWS Elastic Beanstalk, Google App Engine or Azure App Service. SaaS, Software as a Service, is a finished application you simply use, such as Gmail, Microsoft 365 or Salesforce. As you move from IaaS to SaaS you get less control but also less operational work, and the shared responsibility line moves toward the provider. In practice, many teams mix them, for example running containers on a managed Kubernetes service, which sits between IaaS and PaaS.

2. What is a VPC and what are its main building blocks?

A strong answer covers:

  • A logically isolated private network in the cloud
  • Defined by a CIDR range and divided into subnets per AZ
  • Route tables, internet gateway and NAT gateway control traffic flow
  • Security groups and NACLs filter traffic
  • Public vs private subnets
Show model answer

A VPC, or Virtual Private Cloud, is a logically isolated network inside a cloud provider where you launch your resources. You give it an IP range in CIDR notation, such as 10.0.0.0/16, and split that into subnets, each living in one availability zone. Route tables decide where traffic goes. A public subnet has a route to an internet gateway, while a private subnet usually sends outbound traffic through a NAT gateway so instances can download updates without being reachable from outside. Security groups act as stateful firewalls on each network interface, and network ACLs are stateless filters at the subnet level. You can also add VPC endpoints for private access to services like S3, and connect VPCs using peering or a transit gateway. A common pattern is load balancers in public subnets and apps and databases in private subnets across at least two AZs.

3. Explain IAM users, groups, roles and policies. When would you use a role instead of a user?

A strong answer covers:

  • Users are long-term identities for people or legacy apps
  • Groups collect users to share permissions
  • Roles are assumed and give temporary credentials
  • Policies are JSON documents defining allowed or denied actions on resources
  • Use roles for services, cross-account access and federated human access
Show model answer

IAM controls who can do what in a cloud account. A user is a long-term identity with a password or access keys. A group is a collection of users so you can attach permissions once, for example a Developers group. A policy is a JSON document listing allowed or denied actions on specific resources, with optional conditions. A role is an identity with permissions but no permanent credentials; a trusted principal assumes it and receives temporary credentials. I use roles almost everywhere: for EC2 instances and Lambda functions, for CI pipelines using OIDC federation, for cross-account access, and for engineers who log in through SSO with IAM Identity Center. Temporary credentials expire automatically, so there are no long-lived keys to leak. In all cases I follow least privilege and review unused permissions regularly.

4. How would you make a simple web application highly available in the cloud?

A strong answer covers:

  • Run multiple instances across at least two availability zones
  • Put a load balancer with health checks in front
  • Use an Auto Scaling group to replace failed instances
  • Use a managed database with Multi-AZ failover
  • Keep app servers stateless; store sessions and files externally
Show model answer

The goal is to remove single points of failure. I would run the web tier on at least two instances, or containers, spread across two or three availability zones. An Application Load Balancer sits in front, does health checks and only sends traffic to healthy targets. An Auto Scaling group keeps the desired count and replaces any instance that fails. The app servers must be stateless, so sessions go into something like Redis or DynamoDB and uploaded files go to S3. For the database I would use a managed service like RDS or Aurora with Multi-AZ, so a standby takes over automatically if the primary fails. DNS with Route 53 health checks can add another layer. Finally, I would add monitoring and alarms so the team knows when something degrades, and test failover regularly.

5. What pricing models do cloud providers offer for compute, and when would you use each?

A strong answer covers:

  • On-demand for flexible, short-term or unpredictable use
  • Savings Plans or Reserved Instances for steady baseline usage
  • Spot or preemptible for interruptible workloads
  • Serverless pay-per-use for spiky or low traffic
  • Mix models based on the workload pattern
Show model answer

The main compute pricing models are on-demand, commitment discounts, spot and serverless. On-demand means paying per second or hour with no commitment; it is the most flexible but the most expensive, so it suits new projects, short tests and unpredictable spikes. Savings Plans and Reserved Instances give large discounts, often 30 to 70 percent, in exchange for a one or three year commitment, so I use them for the steady baseline that always runs. Spot or preemptible VMs are spare capacity at up to 90 percent off, but they can be taken back, so they fit batch jobs, CI runners and stateless workers. Serverless services like Lambda or Cloud Run charge only when requests run, which is great for low or spiky traffic. A good strategy combines them: commitments for the baseline, on-demand for peaks and spot for fault-tolerant work.

6. What is the difference between containers and virtual machines, and when would you choose each?

A strong answer covers:

  • VMs virtualize hardware and run a full guest OS on a hypervisor
  • Containers share the host kernel and isolate processes with namespaces and cgroups
  • Containers start faster and are lighter, so density is higher
  • VMs give stronger isolation and can run different OS kernels
  • Common pattern: containers running on top of VMs in the cloud
Show model answer

A virtual machine runs a complete guest operating system on a hypervisor, so each VM has its own kernel, drivers and boot process. A container is just an isolated process on the host: it shares the host kernel and uses namespaces for isolation and cgroups for resource limits. Because of that, containers start in seconds, use less memory and pack more densely, and the same image runs the same way on a laptop and in production. VMs give stronger isolation, which matters for untrusted multi-tenant workloads, and they can run a different OS such as Windows next to Linux. In practice in the cloud we use both: Kubernetes nodes are VMs, and our services run as containers on them. I choose plain VMs for legacy apps, special kernels or licensed software, and containers for most modern stateless services.

7. What is Infrastructure as Code and why do teams use it instead of the cloud console?

A strong answer covers:

  • Infrastructure is defined in versioned files and created by a tool
  • Repeatable, consistent environments for dev, staging and prod
  • Changes are reviewed through pull requests and plans
  • Easier recovery and audit history from version control
  • Declarative tools like Terraform or OpenTofu track state
Show model answer

Infrastructure as Code means describing networks, servers, databases and permissions in text files, then letting a tool such as Terraform, OpenTofu or CloudFormation create and update them. The files live in version control, so every change has an author, a review and a history. Teams use it because it makes environments repeatable: dev, staging and prod come from the same modules with different variables, so they do not drift apart. A plan step shows exactly what will change before anything happens, which makes reviews safer than clicking in a console. It also speeds up recovery, because you can rebuild an environment from code after a disaster. Declarative tools keep state and compare it with the real world, so they can detect drift when someone does make a manual change.

8. Explain metrics, logs and traces. How does each help you run a cloud application?

A strong answer covers:

  • Metrics are numeric time series, cheap to store, good for dashboards and alerts
  • Logs are detailed event records, good for debugging specific errors
  • Traces follow one request across services and show where time is spent
  • Use them together: alert on metrics, then drill into traces and logs
  • Tools such as CloudWatch, Prometheus, Grafana and OpenTelemetry
Show model answer

Metrics are numbers measured over time, like request rate, error rate, latency and CPU. They are cheap to store and query, so I use them for dashboards and alerts, for example in Prometheus with Grafana or in CloudWatch. Logs are detailed records of individual events, such as an error with a stack trace and request ID; they answer what exactly happened. Traces follow a single request as it moves through load balancers, services and databases, and show how long each step took, which is the fastest way to find a slow dependency in a microservice system. They work best together: a metric alert tells me the error rate jumped, a trace shows which service is failing, and that service logs explain why. I usually instrument with OpenTelemetry so all three share the same request context.

9. How does a CDN work, and what should you consider when caching content with one?

A strong answer covers:

  • Edge locations cache copies of content close to users
  • Cache hit serves from edge; miss goes to the origin
  • TTLs and Cache-Control headers decide how long content stays
  • Cache key design and invalidation or versioned file names
  • Do not cache private or user-specific responses by mistake
Show model answer

A CDN has many edge locations around the world. When a user requests a file, DNS sends them to a nearby edge. If the edge has a cached copy, it returns it at once, which is a cache hit; if not, it fetches from the origin, such as an S3 bucket or load balancer, stores it and returns it. This lowers latency and takes load off the origin. The main things I think about are TTLs and Cache-Control headers, which decide how long content is kept, and the cache key, because including unnecessary headers or cookies kills the hit ratio. For updates I prefer versioned file names like app.3f2a.js over frequent invalidations. Finally, I make sure personalized or private responses are marked no-store or private so the CDN never serves one user data to another.

10. Compare block, object and file storage in the cloud. Give a use case for each.

A strong answer covers:

  • Block storage: raw volumes attached to one server, like EBS or Azure Managed Disks
  • Object storage: objects with keys via HTTP API, like S3 or GCS, very durable and cheap
  • File storage: shared file systems over NFS or SMB, like EFS or Azure Files
  • Use cases: databases on block, backups and media on object, shared content on file
  • Cost, performance and access pattern drive the choice
Show model answer

Block storage gives a server a raw disk volume, such as EBS on AWS or Managed Disks on Azure. It has low latency and is formatted with a file system by the OS, so it suits databases and boot volumes, but usually only one instance uses it. Object storage, such as S3 or Google Cloud Storage, stores whole objects under keys and is accessed over an HTTP API. It is extremely durable, scales without limits and is cheap, so it is ideal for backups, logs, data lakes, images and static websites, but you cannot edit part of a file in place. File storage, such as EFS or Azure Files, gives a shared file system over NFS or SMB that many servers can mount at once, which fits shared content, home directories or legacy apps that expect file paths. I choose based on access pattern, performance and cost.

Medium questions medium

1. Design a secure three-tier web application on AWS (or your preferred cloud). Walk through the network and services.

A strong answer covers:

  • VPC across multiple AZs with public, private app and private data subnets
  • Load balancer and CDN/WAF at the edge; app tier in private subnets with auto scaling
  • Managed database in isolated subnets with Multi-AZ and encryption
  • Security groups referencing each other, least privilege IAM roles, secrets manager
  • Monitoring, logging, backups and IaC
Show model answer

I would build a VPC across three availability zones with three subnet layers. Public subnets hold only the Application Load Balancer and NAT gateways. CloudFront with AWS WAF sits in front for caching, TLS and protection against common attacks. Private app subnets run the application on ECS Fargate or an EC2 Auto Scaling group, scaling on CPU or request count. Isolated data subnets host Aurora or RDS with Multi-AZ, encryption with KMS and automated backups. Security groups chain together: the ALB accepts 443 from the internet, the app accepts traffic only from the ALB security group, and the database only from the app security group. The app uses an IAM role and reads credentials from Secrets Manager. I add VPC endpoints for S3 and other services, CloudWatch logs and alarms, CloudTrail, and define everything in Terraform with CI review.

2. How do you manage Terraform state and multiple environments (dev, staging, prod) safely?

A strong answer covers:

  • Remote backend with locking, versioning and encryption
  • Separate state per environment and per component to limit blast radius
  • Reusable modules with environment-specific variables
  • Plan in CI on pull requests, apply with approval
  • Restrict access to state since it may contain secrets; handle drift
Show model answer

I always use a remote backend, for example an S3 bucket with versioning, encryption and native state locking, or Azure Blob or GCS. Each environment gets its own state, and often its own cloud account, so a mistake in dev cannot touch prod. I also split large systems into smaller states such as network, data and app, which keeps plans fast and limits the blast radius. Shared logic lives in versioned modules, and each environment has a thin root configuration with its own variables. Some teams use workspaces, but I prefer separate directories or a tool like Terragrunt for clearer separation. Changes go through pull requests where CI runs plan and posts the output, and apply runs only after approval, ideally from the pipeline using OIDC credentials. State can contain secrets, so access is tightly restricted. I also run scheduled plans to detect drift.

3. A team stores customer documents in an S3 bucket. How would you secure it?

A strong answer covers:

  • Block Public Access at account and bucket level
  • Least privilege bucket and IAM policies, enforce TLS
  • Encryption at rest with SSE-KMS and key policy control
  • Versioning, Object Lock or MFA delete, and lifecycle rules
  • Logging and monitoring with CloudTrail data events, access logs, Macie or GuardDuty
  • Private access through VPC endpoints and pre-signed URLs
Show model answer

First I turn on S3 Block Public Access at both account and bucket level and keep Object Ownership set to bucket owner enforced, so ACLs are disabled. Access is granted through IAM roles and a bucket policy with least privilege, plus a condition that denies requests not using TLS. Data is encrypted with SSE-KMS using a customer managed key, so key policy adds a second layer of control and every use is logged. I enable versioning, and for compliance data Object Lock, to protect against deletion or ransomware. Applications reach the bucket through a VPC gateway endpoint, and the bucket policy can require that endpoint. Users download files through short-lived pre-signed URLs instead of public links. For visibility I enable CloudTrail data events, use Amazon Macie to find sensitive data, GuardDuty for threats, and lifecycle rules to delete data we no longer need.

4. An instance in a private subnet cannot reach the internet to install packages. How do you troubleshoot it?

A strong answer covers:

  • Check the private subnet route table has 0.0.0.0/0 to a NAT gateway
  • Check the NAT gateway is in a public subnet with a route to an internet gateway and is available
  • Check security group outbound rules and NACL rules including ephemeral ports
  • Check DNS resolution settings in the VPC
  • Use tools like Reachability Analyzer and VPC Flow Logs
Show model answer

I would follow the packet path step by step. First, the private subnet route table must send 0.0.0.0/0 to a NAT gateway. Second, that NAT gateway must sit in a public subnet whose route table points 0.0.0.0/0 to an internet gateway attached to the VPC, and the NAT must be in the available state with an Elastic IP. Third, I check the instance security group allows outbound traffic on 80 and 443, and that the network ACLs on both subnets allow outbound traffic and the inbound return traffic on ephemeral ports 1024 to 65535, since NACLs are stateless. Fourth, I check DNS: the VPC needs DNS resolution enabled, and I test with nslookup or curl to an IP. Finally, VPC Reachability Analyzer and Flow Logs quickly show where traffic is rejected. If the instance only needs AWS services, VPC endpoints may be a better answer.

5. How would you plan the migration of an on-premises application to the cloud?

A strong answer covers:

  • Discovery and assessment of dependencies, data size and constraints
  • Choose a strategy per app: rehost, replatform, refactor, retire, retain, repurchase
  • Set up landing zone, networking and security first
  • Migrate data with replication and plan the cutover with rollback
  • Test, then optimize cost and operations after migration
Show model answer

I start with discovery: list servers, dependencies, data volumes, performance needs, compliance rules and current costs, often with a discovery tool. Then for each application I pick one of the 7 Rs, such as rehost (lift and shift), replatform (for example moving the database to RDS), refactor, repurchase as SaaS, retire or retain. Before moving anything, I set up a landing zone with accounts, networking, VPN or Direct Connect to the data center, identity and logging. For data, I use continuous replication such as AWS DMS or native database replication, so the final cutover is short. I run the app in parallel, do performance and failover tests, and plan a cutover window with a clear rollback plan, like switching DNS back. After go-live I monitor closely, rightsize resources, and gradually modernize, because the first move is rarely the most cost efficient design.

6. Describe how you would build a CI/CD pipeline for Terraform changes across dev, staging and production.

A strong answer covers:

  • Run fmt, validate, linting and security scanning on every pull request
  • Post terraform plan output to the pull request for review
  • Apply the reviewed plan after merge, with remote state and locking
  • Promote through environments with approvals for production
  • Use OIDC short-lived credentials and separate roles per environment
  • Scheduled drift detection
Show model answer

On every pull request the pipeline runs terraform fmt -check, validate, tflint and a security scanner such as Checkov or Trivy, then runs plan for each affected environment and posts the plan to the pull request. Reviewers approve the code and the plan together. After merge, the pipeline applies to dev automatically, then staging, and production waits for a manual approval through a protected GitHub environment. I save the plan file and apply exactly that plan so nothing changes between review and apply. State lives in a remote backend with locking, separate per environment. The pipeline authenticates to the cloud with OIDC, assuming a different least-privilege role per environment, so there are no long-lived keys. Finally, a nightly job runs plan against each environment and alerts if it finds drift.

7. A team wants to move a service onto your Kubernetes cluster. What do you check before calling it production ready?

A strong answer covers:

  • Resource requests and limits set from real usage
  • Correct liveness and readiness probes and graceful shutdown
  • Multiple replicas spread across zones with a PodDisruptionBudget
  • Autoscaling with HPA and cluster capacity
  • Secrets from a secret store, least-privilege service accounts, non-root images
  • Metrics, logs, alerts and a rollback plan
Show model answer

First I check resources: every container needs CPU and memory requests based on real usage, and a memory limit, so scheduling and autoscaling work. Next, probes: a readiness probe that reflects whether the pod can serve traffic, a simple liveness probe that only checks the process, and graceful shutdown that handles SIGTERM and drains connections. For availability I want at least two or three replicas spread across zones with topology spread constraints, plus a PodDisruptionBudget that still allows node drains. I add an HPA on CPU or a custom metric. On security, the image should be scanned and run as non-root, secrets should come from a secret manager, and the pod should use its own service account with workload identity scoped to least privilege. Finally, I confirm dashboards, alerts tied to SLOs, logs with request IDs, and a tested rollback path.

8. You are on call and p99 latency for a cloud API jumps from 200 ms to 3 seconds. Walk through how you investigate and handle it.

A strong answer covers:

  • Acknowledge, assess user impact and communicate status
  • Check recent changes such as deploys, config or infrastructure
  • Narrow down with metrics and traces: which endpoint, AZ, or dependency
  • Look at saturation: CPU, memory, connections, throttling, queue depth
  • Mitigate first with rollback, scaling or failover, then find the root cause
  • Blameless postmortem with follow-up actions
Show model answer

I acknowledge the page, check how many users are affected, and open an incident channel so others know I am on it. The first question is what changed: a deploy, a config flag, a scaling event, or a provider issue on the status page. Then I narrow the scope using dashboards and traces: is it all endpoints or one, all AZs or one, and which dependency is slow, such as the database, a cache or an external API. I look at saturation signals like CPU, memory, connection pools, database load, throttling errors and queue depth. My priority is to mitigate before fully understanding, so if a deploy lines up with the spike I roll it back, or I scale out or fail over if capacity is the issue. Once stable, I find the root cause and run a blameless postmortem with concrete follow-up actions.

9. How do you manage application secrets such as database passwords and API keys in a cloud environment?

A strong answer covers:

  • Store secrets in a managed secret store like Secrets Manager, Key Vault or Secret Manager
  • Access through workload identity, IAM roles or managed identities, not static keys
  • Encrypt with KMS and audit every read
  • Automatic rotation and short-lived or dynamic credentials
  • Never in code, images, plain env files or Terraform state where avoidable
  • Secret scanning in repositories and CI
Show model answer

I keep secrets in a managed store such as AWS Secrets Manager, Azure Key Vault or Google Secret Manager, encrypted with KMS keys. Applications get access through their cloud identity, an IAM role, a managed identity or Kubernetes workload identity, so there is no bootstrap secret to protect. Access is least privilege per service and every read is logged in CloudTrail or the equivalent. I turn on automatic rotation for database credentials, and where possible use short-lived credentials instead, such as IAM database authentication or dynamic secrets. Secrets must never be committed to Git, baked into images or put in plain environment files, so I run secret scanning in repositories and CI. In Kubernetes I sync secrets with the External Secrets Operator or the CSI driver. I also avoid putting secrets into Terraform state where possible.

10. Design a tagging and cost allocation strategy for a company running many teams on AWS.

A strong answer covers:

  • Small mandatory tag set: owner or team, environment, application, cost center
  • Enforce with IaC defaults, tag policies and SCPs or Config rules
  • Account structure per team or environment as the primary cost boundary
  • Activate cost allocation tags and build per-team reports and budgets
  • Handle shared costs and untagged spend with a showback model
Show model answer

I start with accounts, because separate AWS accounts per team and environment are the cleanest cost boundary and need no tagging discipline. Inside accounts I define a short mandatory tag set, such as team, application, environment and cost-center, with fixed allowed values. I enforce it in several places: Terraform default_tags in the provider so every resource gets them, AWS Organizations tag policies for consistent values, and Config rules or CI policy checks to flag untagged resources. Those tags are activated as cost allocation tags so Cost Explorer and the Cost and Usage Report can break spend down. Each team gets budgets and anomaly alerts on its own spend. Shared costs like networking or support are split by an agreed formula in a showback report, and we track the percentage of untagged spend as a metric to drive it down.

Hard questions hard

1. Design a multi-region disaster recovery setup for a payments API with an RPO of under 1 minute and an RTO of 15 minutes. What trade-offs do you consider?

A strong answer covers:

  • Translate RTO/RPO into a strategy such as warm standby
  • Asynchronous cross-region data replication and its lag
  • Traffic failover with DNS health checks or global load balancing
  • Infrastructure as code, replicated secrets, keys and images in the second region
  • Regular failover drills, runbooks and clear failover decision
  • Cost, consistency and split-brain risks
Show model answer

An RPO under a minute rules out periodic backups, and an RTO of 15 minutes rules out building a region from scratch, so I would use warm standby. The primary region runs the full stack. The secondary runs a smaller copy deployed from the same Terraform and pipeline. Data uses Aurora Global Database or DynamoDB global tables, which replicate asynchronously with typical lag around a second, meeting the RPO. Secrets, KMS keys, container images and config are replicated too. Route 53 failover records or a global load balancer shift traffic, but I prefer a human-approved or well-tested automated failover to avoid flapping. Key trade-offs: async replication means a few seconds of transactions can be lost, so payments need idempotency keys and reconciliation; split brain must be prevented by fencing the old primary. Standby costs money, and the plan only works if we run regular game days.

2. How would you design a multi-account cloud landing zone for a company with 20 product teams?

A strong answer covers:

  • Use AWS Organizations or equivalent with OUs per environment and function
  • Separate accounts for security, logging, networking and workloads
  • Central identity with SSO and permission sets
  • Guardrails using SCPs, config rules and policy as code
  • Centralized networking with transit gateway and shared services
  • Account vending automation, tagging and cost allocation
Show model answer

I would use AWS Organizations, often with Control Tower, and treat the account as the main security and billing boundary. The structure has OUs such as Security, Infrastructure, Workloads split into Prod and Non-Prod, and Sandbox. Core accounts include a log archive account receiving organization-wide CloudTrail and Config, a security tooling account for GuardDuty and Security Hub as delegated admin, and a network account owning the transit gateway, egress and DNS. Each product team gets separate dev, staging and prod accounts, created by an automated account vending pipeline with baseline Terraform, budgets and tags. People log in through IAM Identity Center connected to the corporate IdP, using permission sets instead of IAM users. SCPs act as guardrails, for example denying unused regions, disabling CloudTrail changes and root usage. The trade-off is more accounts to manage, but blast radius, cost tracking and autonomy are much better.

3. Leadership asks you to reduce the cloud bill by 30 percent without hurting reliability. How do you approach it?

A strong answer covers:

  • Get visibility first: tagging, cost allocation, find the top cost drivers
  • Remove waste: idle resources, unattached volumes, old snapshots, non-prod schedules
  • Rightsize and modernize: instance types, Graviton, autoscaling, storage tiers
  • Commitment discounts and Spot where safe
  • Reduce data transfer and NAT costs; set budgets and ownership for ongoing FinOps
Show model answer

I would start with data, not guesses. Using Cost Explorer or the cost and usage report with good tagging, I find the top services, accounts and teams driving spend, since usually a few items make up most of the bill. Quick wins come from waste: idle instances, unattached volumes, old snapshots, oversized dev environments running all night, and forgotten load balancers. Next is rightsizing with Compute Optimizer data, moving to newer or ARM-based Graviton instances, tuning autoscaling, and moving storage to Intelligent-Tiering or cheaper classes with lifecycle rules. After usage is lean, I buy Savings Plans for the steady baseline and move fault-tolerant work to Spot. I also review data transfer: NAT gateway traffic, cross-AZ chatter and egress, often fixed with VPC endpoints and caching. To keep reliability, changes go through normal testing and monitoring. Finally, I set budgets, anomaly alerts and team-level showback so savings last.

4. How would you migrate a large production database to a managed cloud database with near-zero downtime?

A strong answer covers:

  • Initial full load plus change data capture to keep target in sync
  • Validate data and schema compatibility before cutover
  • Plan the cutover: freeze writes briefly, wait for lag zero, switch connections
  • Use DNS or config switch and keep a rollback path with reverse replication
  • Test performance, monitor replication lag, rehearse the cutover
Show model answer

The key idea is to keep the old and new databases in sync while the application is still live. First I check compatibility, such as engine versions, extensions and character sets, and create the target schema. Then I do a full load using native tools like pg_dump or a snapshot, or AWS DMS, followed by change data capture through native logical replication or DMS so ongoing writes keep flowing to the target. I validate row counts and checksums and run load tests against the new database. For cutover, I rehearse in staging first. In production, I briefly stop writes or put the app in read-only mode, wait until replication lag is zero, run final validation, and switch the connection string through config or a DNS name. Before switching, I set up reverse replication if possible, so rollback is fast. Total write downtime can be a few minutes or less.

5. A company needs reliable connectivity between its data center and the cloud. Compare site-to-site VPN and a dedicated connection like AWS Direct Connect, and describe a resilient design.

A strong answer covers:

  • VPN runs encrypted over the internet, quick and cheap but variable latency and limited throughput
  • Direct Connect is a private dedicated link with consistent latency and higher bandwidth, but takes longer to set up
  • Direct Connect is not encrypted by default; use MACsec or VPN over it if needed
  • Resilience with redundant connections at different locations, or VPN as backup
  • BGP routing and transit gateway integration, avoid overlapping CIDRs
Show model answer

A site-to-site VPN creates IPsec tunnels over the public internet. It can be set up in hours and is cheap, but latency and throughput vary, and each tunnel has bandwidth limits, around 1.25 Gbps on AWS. Direct Connect, ExpressRoute on Azure or Cloud Interconnect on GCP, is a private dedicated link through a colocation partner. It gives stable latency, high bandwidth and lower data transfer prices, but takes weeks to provision and is not encrypted by default, so I would add MACsec or run a VPN over it for sensitive traffic. For resilience I would use two Direct Connect connections at two different locations, landing on a Direct Connect gateway attached to a transit gateway, with BGP handling failover. A cheaper option is one Direct Connect plus a VPN backup. I also plan non-overlapping IP ranges and monitor BGP sessions and link health.

6. Design a shared Kubernetes platform used by 30 product teams. How do you handle isolation, security, cost and upgrades?

A strong answer covers:

  • Namespace per team with RBAC, ResourceQuotas and LimitRanges
  • Network policies and admission policies for baseline security
  • Workload identity per service account for cloud access
  • Separate clusters for prod vs non-prod or high-risk tenants
  • Cost allocation per namespace and autoscaling with Karpenter or cluster autoscaler
  • Regular, tested upgrade process with GitOps
Show model answer

I would run separate clusters for production and non-production, and give highly sensitive tenants their own cluster, because namespaces are a soft boundary. Inside a cluster, each team gets namespaces created through a self-service template with RBAC, ResourceQuotas, LimitRanges and a default-deny NetworkPolicy. Admission policies with Kyverno or Gatekeeper enforce Pod Security standards, approved registries, required labels and resource requests. Each workload uses its own service account mapped to a cloud role through workload identity, so teams never share credentials. For cost, Karpenter or Cluster Autoscaler handles capacity, and a tool like OpenCost charges spend back per namespace label. Everything is managed through GitOps with Argo CD or Flux. Upgrades follow a fixed cadence: test in a canary cluster, check deprecated APIs, then roll node pools gradually with PodDisruptionBudgets respected.

7. You find out that long-lived AWS access keys were pushed to a public GitHub repository an hour ago. How do you respond?

A strong answer covers:

  • Immediately deactivate the key and revoke any active sessions
  • Investigate CloudTrail for actions taken with that key across all regions
  • Look for persistence: new users, keys, roles, Lambda functions, instances
  • Contain and clean up, check billing for crypto mining
  • Remove from history but treat as compromised regardless
  • Root cause and prevention: OIDC, no long-lived keys, secret scanning
Show model answer

I treat it as an active incident, because bots scan GitHub for keys within minutes. First I deactivate the access key, and if it belonged to a user with assumed role sessions I revoke those sessions with a deny policy on tokens issued before now. Then I investigate CloudTrail for every API call made with that key ID in all regions, and check GuardDuty findings. I look for persistence such as new IAM users, access keys, roles with odd trust policies, Lambda functions, EC2 instances in unused regions and changes to logging, plus a billing spike from crypto mining. I remove anything the attacker created and rotate any secrets they could have read. Rewriting Git history is worth doing, but the key stays compromised either way. Afterwards I run a postmortem and remove long-lived keys entirely in favor of OIDC and roles, with secret scanning and push protection enabled.

8. Design observability and alerting for a customer-facing API so on-call gets paged for real problems but not for noise.

A strong answer covers:

  • Define SLIs such as availability and latency, and SLOs with error budgets
  • Page on symptoms using multi-window burn rate alerts
  • Cause metrics like CPU or queue depth go to dashboards or tickets
  • Golden signals plus traces and structured logs for fast diagnosis
  • Every alert has an owner and a runbook, and is reviewed for noise
  • Control cardinality and cost of telemetry
Show model answer

I start from what users feel. I define SLIs such as the share of requests that succeed and the share served under 300 ms, measured at the load balancer or gateway, and set SLOs like 99.9 percent over 30 days, which gives an error budget. Paging alerts are multi-window burn rate alerts on those SLOs: a fast burn pages within minutes, a slow burn opens a ticket. Cause signals like CPU, memory, queue depth or disk go to dashboards and low-priority alerts, not pages. For diagnosis I collect the golden signals per service, distributed traces with OpenTelemetry, and structured logs with trace IDs. Every paging alert must have an owner and a runbook, and we review alert volume each week and delete or tune noisy ones. I also watch telemetry cost by limiting label cardinality and sampling traces.

9. Design an event-driven order processing system on a public cloud that must handle traffic spikes and never lose or double-charge an order.

A strong answer covers:

  • Durable queue or stream to buffer spikes between producers and consumers
  • At-least-once delivery means idempotent consumers with idempotency keys
  • Transactional outbox to publish events reliably with database writes
  • Dead-letter queues, retries with backoff, and alerts on DLQ depth
  • Ordering only where needed, using partition or message group keys
  • Saga or step functions for multi-step workflows and compensation
Show model answer

The API validates the order, writes it to the database and records an event in an outbox table in the same transaction, so we never save an order without publishing its event. A relay or change data capture pushes outbox events to a queue or stream such as SQS, EventBridge or Kafka, which absorbs spikes while consumers scale on queue depth. Delivery is at-least-once, so every consumer is idempotent: payment calls use the order ID as an idempotency key, and we store processed message IDs. Failures retry with exponential backoff, and messages that keep failing go to a dead-letter queue with an alarm and a redrive process. I only enforce ordering where it matters, by keying on order ID. The multi-step flow of payment, inventory and shipping runs as a saga, for example in Step Functions, with compensating actions like refunds.

10. Your company has hundreds of Terraform configurations owned by many teams. How do you structure modules, state and governance so it scales safely?

A strong answer covers:

  • Versioned, reusable modules in a registry with clear interfaces
  • Small state files split by environment, region and component to limit blast radius
  • Remote state with locking, encryption and least-privilege access
  • Policy as code checks in CI such as OPA, Sentinel or Checkov
  • Pinned provider and module versions with automated upgrade PRs
  • Platform team ownership balanced with team self-service
Show model answer

I separate reusable modules from live configurations. A platform team owns a set of opinionated modules, such as a VPC, an EKS cluster or a service bucket, published to a private registry with semantic versions, tests and changelogs. Product teams compose these in their own live repos. State is split into small units by account, environment, region and component, so one bad apply has a limited blast radius and plans stay fast; layers share data through outputs or data sources, not one giant state. Every backend is remote, encrypted and locked, with access limited to that pipeline role. In CI, policy as code with OPA, Sentinel or Checkov blocks things like public buckets or missing tags. Provider and module versions are pinned, and Renovate opens upgrade PRs so teams move forward regularly instead of falling years behind.