Cloud Architecture Design Principles and Trade-offs Questions
The reasoning patterns for architecting cloud systems: reliability, scalability, security, performance, and cost as competing pillars, plus resilience patterns, well-architected design reviews, and scenario-based decision making. Covers how to justify architectural choices, evaluate trade-offs under real constraints, and design for failure. Provider-agnostic design thinking rather than a specific service catalog.
Design network and identity boundaries for a multi-tenant SaaS deployed in a single cloud region using separate VPCs/accounts per tenant for isolation. Address subnetting strategy, routing between shared services and tenant VPCs, use of service endpoints, security group design, cross-account roles, and how to centralize logging and authentication securely.
Sample Answer
Requirements & constraints:
- Strong isolation per tenant (network + identity), single cloud region, shared platform services (API gateway, auth, logging, data plane), low-latency connectivity, centralized audit/logs, secure cross-account access.
High-level design:
- One AWS account (or cloud management account) for platform/shared services; one separate account per tenant for isolation (VPC-per-account). Use AWS Organizations and SCPs to enforce guardrails.
Subnetting:
- In each tenant account VPC: /22 CIDR (e.g., 10.t.0.0/22) split into:
- Public /28 for NAT/IP-assigned endpoints (if any)
- Private application subnets /24 per AZ
- DB/subnet /26 per AZ (restricted)
- Platform VPC: larger CIDR /20 with service subnets (API, auth, logging, egress).
Routing & connectivity:
- Use AWS Transit Gateway in platform account to connect tenant VPCs across accounts (peer attachments per tenant). Route tables per attachment to enforce access. Only allow routes from tenant VPC -> shared-services subnets, not tenant-to-tenant.
- For high security, use AWS PrivateLink (VPC Endpoints) for shared services (authentication, APIs, logging ingestion). Expose platform services as endpoint services; tenants create Interface Endpoints in their VPCs—no routing through transit gateway needed for service access.
Service endpoints & data plane:
- Use S3 Gateway Endpoints for object storage access (policy-restricted by VPC/account) and Interface Endpoints for critical services (Secrets Manager, KMS, SNS, SQS) where supported.
- KMS keys: customer-managed multi-account keys with grants; keys in platform account but use key policies + cross-account grants.
Security groups & NACLs:
- Default deny at NACL and security group level. Security groups per tier:
- App SG: allow inbound from ALB SG, outbound to DB SG
- DB SG: allow inbound only from App SG and platform backups SG
- Endpoint SGs: allow connections from tenant app SGs
- Use least-privilege SG rules (referencing SG IDs, not IPs). Enforce host-based firewalling on instances.
Identity & cross-account access:
- Centralize identity in platform: use an enterprise IdP (OIDC/SAML) with AWS IAM Identity Center or cloud-native IAM federation. Users get roles via SSO mapped to cross-account IAM Roles.
- Cross-account roles: create roles in tenant accounts with narrowly-scoped permissions (role assumption allowed only from platform account or SSO principal). Use permission boundaries and session tags to enforce tenancy context.
Centralized logging and monitoring:
- All tenants push logs to platform logging ingestion via PrivateLink endpoints (or Transit Gateway with VPC flow logs forwarded). Use Kinesis/Firehose in platform account to ingest, transform, encrypt, and store in S3 (per-tenant prefixes) and forward to SIEM (Splunk/ELK). Enforce encryption with KMS and bucket policies restricting PutObject to tenant principal ARN.
- Central metrics/trace: tenants emit OTLP to collector endpoint in platform via PrivateLink; use tenant-id metadata and RBAC for access.
Security controls & audit:
- Flow logs + GuardDuty in each tenant account, aggregated to platform via Kinesis.
- Use centralized IAM audit: CloudTrail multi-account trails stored in platform S3 with object lockdown, MFA delete for sensitive logs.
- Use automated account/VPC hardening via Infrastructure-as-Code (Terraform) and validate with policy-as-code (Sentinel/Cloud Custodian).
Trade-offs:
- VPC-per-tenant maximizes isolation but increases management overhead; mitigate with automation. PrivateLink reduces lateral attack surface and avoids routing complexity but costs more.
This design gives strong network and identity boundaries, least-privilege access, centralized observability, and scalable onboarding via automation.
Describe the steps and major considerations for executing a lift-and-shift migration of an on-premises VM-based application to cloud IaaS. Include discovery, network mapping, data transfer, cutover strategy, rollback option, and post-migration validation.
Sample Answer
Approach: I break the lift-and-shift into six phases—Discovery, Planning (network & security mapping), Data Transfer, Cutover, Rollback, and Post-migration Validation—each with clear owners, timelines, and acceptance criteria.
- Discovery
- Inventory VMs, OS, apps, dependencies, storage, performance baseline, licensing constraints.
- Use agents or agents-less tools (e.g., Azure Migrate, AWS Application Discovery) to capture CPU/memory, disk I/O, ports, and inter-VM calls.
- Identify compliance, encryption, and SLA requirements.
- Network & Security Mapping
- Map on‑prem subnets, VLANs, firewall rules, VPN/Direct Connect needs, DNS and AD integration.
- Design VPC/VNet, subnets, security groups, route tables and any Transit/Peering; plan identity (AD/SSO) connectivity.
- Data Transfer
- Choose method by data size and RPO: online replication (rsync, Storage Gateway, Cloud Replication), block replication (VM replication services), or physical import.
- Prepare bandwidth, schedule seeding, and plan incremental sync to minimize cutover delta.
- Cutover Strategy
- Run pilot for non-critical workloads; do final incremental sync during low traffic window.
- Options: re-IP/rehydrate VM images in cloud IaaS (VM import), or create new cloud VMs from images and attach replicated disks.
- Freeze writes, final sync, update DNS, and validate traffic flow.
- Rollback Option
- Maintain on-prem snapshot/replica until post-validation complete.
- Have runbook to revert DNS, route changes, and reattach storage; verify data consistency thresholds and time-to-rollback targets.
- Post-migration Validation
- Functional tests, performance benchmarking vs baseline, security scans, backup and monitoring setup, disaster recovery validation.
- Verify licensing, patching, and cost optimization (right-sizing, reserved instances).
- Conduct a post-mortem and update documentation/runbooks.
Key considerations: network latency, licensing portability, compliance, cutover RPO/RTO, automation for repeatability, stakeholder communication and rollback timelines.
A client asks whether to adopt a managed database service (DBaaS) or self-manage Postgres on VMs. Create a decision matrix covering operational effort, scalability, portability, cost, control over upgrades, and failure modes. As a Solutions Architect, state when you would recommend each option and why.
Sample Answer
Decision matrix (rows = criteria; columns = DBaaS vs Self‑manage Postgres on VMs):
-
Operational effort
- DBaaS: Low — provider handles backups, patching, HA, monitoring.
- Self‑manage: High — you run upgrades, backups, tuning, runbooks, on-call.
-
Scalability
- DBaaS: Elastic scaling (read replicas, storage autoscale) with few operational steps.
- Self‑manage: Flexible but manual — autoscaling requires orchestration and capacity planning.
-
Portability / vendor lock‑in
- DBaaS: Moderate-to-high lock‑in — proprietary features, connection patterns, managed backups may not be portable.
- Self‑manage: High portability — standard Postgres configuration and tooling transferable across clouds/on‑prem.
-
Cost (TCO)
- DBaaS: Higher direct service fees; lower ops headcount — good for predictable sizing or if ops cost is high.
- Self‑manage: Lower raw infra cost possible; higher personnel and incident costs over time.
-
Control over upgrades & configuration
- DBaaS: Limited — provider schedules major upgrades or limits extension set; some tunables exposed.
- Self‑manage: Full control — you choose versions, extensions, kernel/IO tuning.
-
Failure modes & recovery
- DBaaS: Provider SLAs, automated failover, but less visibility into region/provider-wide failures.
- Self‑manage: You own RTO/RPO via architecture (replication, multi-AZ), but require tested DR runbooks.
When I’d recommend DBaaS
- Fast time-to-market, small/medium teams, or when reducing operational risk is priority.
- Use when SLA + automated backups/patching matter, and slight vendor lock‑in is acceptable.
- Example: SaaS startup with limited DB ops headcount that needs reliable HA and autoscaling.
When I’d recommend Self‑manage Postgres on VMs
- Need full control (custom extensions, specific tuning), strict portability requirements, or to avoid platform vendor features that hinder migration.
- Use for regulated workloads requiring auditable infrastructure, or where long-term cost optimization justifies ops investment.
- Example: Enterprise with an experienced DBA team, multi-cloud strategy, and custom Postgres extensions.
Decision rules I use in assessments
- Quantify ops cost vs service fees (3‑year TCO).
- List required Postgres extensions and tunables.
- Define portability risk threshold and acceptable vendor lock‑in.
- Define RTO/RPO, compliance, and upgrade cadence constraints.
Recommendation: If the client values speed, reduced ops, and predictable SLAs — choose DBaaS. If they require portability, deep customization, or aim to minimize vendor dependence and have ops capacity — self‑manage.
Design a distributed rate-limiting system for a global API platform deployed across 100 application servers and 50 edge POPs. Requirements: global per-tenant quotas, per-route throttling, soft and hard limits, fair sharing, burst handling, low-latency checks (<2ms), and resilience during network partitions. Explain algorithms (token bucket/leaky bucket), data stores, synchronization, and failure modes.
Sample Answer
Requirements clarification:
- Global per-tenant daily/second quotas, per-route throttles, soft (warning/deprioritize) and hard (reject) limits, fair sharing across tenants/clients, allow bursts, checks latency <2ms at edge, resilient to partitions, 100 app servers + 50 POPs.
High-level design:
- Use a hybrid edge-first token-bucket with global reconciliation. Each POP performs local, low-latency checks; a global control plane enforces long-term quotas and fairness.
Components:
- Edge POPs (50): lightweight rate limiter service co-located with ingress (written in C++/Rust) hosting per-tenant+route local token buckets and probabilistic sync client.
- Application servers (100): secondary enforcement for calls bypassing edge, detailed metrics collection.
- Global control plane: aggregation tier (Kafka streams), global policy engine, persistent store (distributed KV like CockroachDB or DynamoDB for quotas), and a reconciliation service.
- Observability: Prometheus + tracing; metrics feed into control plane.
Algorithm:
- Local Token Bucket per tenant+route: capacity = burst_allowance; refill_rate = allowed_rps_sharded.
- Soft vs hard: when tokens < soft_threshold -> mark request as “throttled soft” (delay/deprioritize); if tokens exhausted -> hard reject.
- Fair sharing: control plane computes global fair rates via weighted max-min fairness; distributes refill rates to POPs proportional to recent traffic and capacity.
- Burst handling: token bucket allows short bursts up to bucket size; control plane can temporarily loan tokens between POPs using credit-leasing.
Synchronization & consistency:
- POPs periodically (e.g., every 100–500ms) push usage deltas to Kafka; control plane computes global usage and adjusts refill rates; control messages pushed back to POPs via pub/sub.
- For strict global quotas, use a small global reservoir in control plane: POPs request lease tokens when local tokens near depletion (async, best-effort). To keep <2ms checkpath, local check is authoritative—global checks used for reconciliation and preventing quota overrun long-term.
- Use vector clocks / monotonic counters per POP to avoid double-counting; deltas are idempotent.
Failure modes & resilience:
- Network partition: POPs continue enforcing local limits using cached policies; they run in “degraded mode” with conservative default rates to avoid quota overshoot. Control plane marks partitions and later reconciles by draining deltas and applying corrective throttling (e.g., temporary hard limits) if global quota exceeded.
- Clock skew: use monotonic counters, not wall-clock; control plane uses ingestion order + watermarking.
- Message loss: Kafka with at-least-once; deltas are idempotent to handle duplicates.
- Control plane outage: POPs continue local enforcement; admin alerts for global quota enforcement suspension.
Data stores & scalability:
- High-throughput ingestion: Kafka; aggregation via stream processors (Flink) to compute global windows.
- Persistent quotas & policies: strongly-consistent KV (CockroachDB/Dynamo) for policy updates; for extremely low latency global leases consider Redis Cluster with RedLock for short-lived tokens (careful with safety).
- POP memory stores: in-memory maps + optional local RocksDB for persistence.
Latency considerations:
- Path: ingress -> local mem token check (O(1)) -> allow/reject in <1ms. Periodic sync off-path.
- Keep per-request work minimal; avoid remote calls on fast-path.
Trade-offs:
- Edge-first favors availability and latency but can temporarily overshoot global quota; reconciliation and conservative defaults limit impact.
- Strong consistency (centralized token allocation) would prevent overshoot but violate <2ms latency and availability during partitions.
Security & operational:
- Secure pub/sub with TLS + auth; rate limit config versioning; feature flags to roll out policies gradually.
- Chaos testing and runbooks for reconciliation scenarios.
Why this meets requirements:
- Local token buckets ensure <2ms checks and burst handling.
- Global control plane enforces fair sharing, soft/hard semantics, and long-term quotas via reconciliation and leasing.
- Design prioritizes availability during partitions while bounding quota overshoot with conservative defaults and post-facto reconciliation.
A regulated customer requires a hybrid multi-cloud DR strategy across AWS and GCP with RPO of 1 hour and RTO of 30 minutes for critical services. Design the architecture and operational runbooks for cross-cloud replication, networking, DNS failover, data consistency, and cost controls. Explain automation of failover and periodic DR drills.
Sample Answer
Requirements & constraints:
- RPO ≤ 1 hour, RTO ≤ 30 minutes for critical services across AWS & GCP.
- Regulated customer → strong audit, encryption, IAM, logging.
- Hybrid multi-cloud (primary on one cloud, DR in the other) with possibility of active-passive or active-active per service.
High-level architecture:
- Primary region (e.g., AWS us-east-1) runs production; DR region in GCP (e.g., us-central1). Use VPC/Networking on each side with transit/peering to on-prem if needed.
- Data replication:
- State/DB: Use cross-cloud asynchronous replication with change-capture + object storage snapshotting. Example: primary Postgres in AWS RDS with logical replication -> Cloud SQL in GCP (read replica promoted in DR) OR run self-managed DB with Debezium streaming into Kafka (MirrorMaker/Confluent Cloud) with connectors to both clouds. Ensure WAL shipping or CDC guarantees point-in-time within 1 hour.
- Object storage: Cross-cloud replication using scheduled incremental sync (rclone/gsutil) or third-party replication (e.g., CloudSync). Use versioning and immutable snapshots for compliance.
- Config and secrets: Store in both clouds (Secrets Manager + Secret Manager) with automated sync via HashiCorp Vault replication or secure pipeline (encryption-in-transit).
- Networking & DNS:
- Keep identical network CIDR and firewall rules template-managed (Terraform). Use Cloud NAT and shared security groups equivalents.
- Global DNS using a provider supporting health-checked failover (Route53, Cloud DNS with Traffic Director, or external like NS1). Use low TTL (60s) for records that might fail over; use weighted/priority records to prefer primary.
- Use Anycast + Global load balancer where possible (Cloud CDN / Global Accelerator) and health checks to remove unhealthy endpoints.
- Authentication & IAM:
- Mirror IAM roles/policies via IaC; maintain least privilege and audit trail. Use SSO (OIDC/SAML) with IdP that spans both clouds.
- Observability & Compliance:
- Centralized logging/metrics: replicate logs to a central SIEM (Splunk/ELK) or to both clouds; enable immutable logging and retention policies.
Operational runbooks (condensed):
- Failover trigger conditions: automated health threshold (X failed probes in Y minutes) OR manual declared incident.
- Pre-failover checks (automated where possible):
- Verify latest DB WAL/CDC offset <= 1 hour; run data consistency checksum between primary and DR.
- Verify latest object storage snapshot timestamp.
- Confirm secrets/config synced and schema migrations applied.
- Automated failover steps (scripted via CI/CD/automation):
- Promote DR DB replica (or restore last consistent snapshot + apply WAL) and mark read-write.
- Deploy or scale compute in DR using IaC modules (Terraform/Deployment Manager/CloudFormation equivalents). Use immutable images or containers from replicated registries.
- Update DNS: change priority to point to DR LB or set failover A/AAAA/CNAME. Use API to DNS provider to perform change and verify propagation via health checks.
- Activate networking routes, NAT, and firewall exceptions; attach any required floating IPs or target proxies.
- Run smoke tests (health endpoints, basic transactions) and report status to incident channel.
- Post-failover actions:
- Full functional tests, notify stakeholders/regulators, create incident record, start RCA.
- Begin reverse replication plan to return to primary when safe.
Automation & orchestration:
- Implement playbooks as code: Terraform for infra, Ansible/Cloud Build/CodePipeline to run failover steps, and orchestration via a runbook runner (StackStorm, Rundeck) with step gating.
- Use serverless orchestration (Cloud Functions + Step Functions / Workflows) to sequence: check replication offsets → promote DB → deploy apps → update DNS → run smoke tests.
- Health checks: Synthetic monitors + cloud LB health checks and a central controller that triggers failover when thresholds breache.
DR drills & verification:
- Schedule quarterly full drills and monthly limited drills (smoke tests). Use automated “firebreak” mode that fails over a subset (non-critical) first.
- Drill steps automated in a sandbox project or during a maintenance window with read-only traffic redirected to DR.
- Measure actual RPO/RTO during each drill, record metrics and deviations. Maintain drill playbooks and postmortem with action items.
- Use canary deployments in DR prior to full failover for apps.
Data consistency and edge cases:
- Ensure idempotent operations across services; use unique request IDs to avoid double-processing.
- For databases with strict consistency needs consider cross-region synchronous spanning within same cloud where possible; otherwise accept async but ensure compensating transactions.
- Handle split-brain by having single authoritative write endpoint; use leader election in orchestration to avoid simultaneous writes.
Cost controls:
- Use cost-optimized DR modes:
- Pilot light: essential services running in DR at minimal scale (small DB replica, minimal compute) to reduce cost but meet RTO via automated scale-up.
- Warm standby: scaled-down but ready; faster RTO but higher cost.
- Active-active (if budget permits).
- Use autoscaling, preemptible/spot instances where allowed for non-critical workers, and scheduled scale-down for test environments.
- Tagging and budgets; use alerts and automation to stop non-essential resources. Store long-term backups in cheaper tiers (Glacier/Coldline) but keep last 1 hour window in hot storage.
- Use IaC and policy-as-code (OPA, Cloud Custodian) to enforce cost and compliance guardrails.
Governance, security & audit:
- Maintain runbook versioning, automated test suite, and RBAC so only authorized operators can trigger failover.
- Continuous compliance evidence collection during drills (time-stamped snapshots, logs).
Trade-offs:
- Cross-cloud synchronous replication is impractical; we choose async CDC to meet RPO=1h. This increases complexity for consistency but permits multi-cloud DR.
- DNS failover has propagation limits; combine health checks and low TTLs with provider APIs to meet RTO 30m.
This design meets RPO/RTO targets using automated, tested playbooks, keeps costs manageable via pilot-light/warm-standby options, and enforces regulatory controls via encryption, auditing, and guarded failover operations.
Unlock Full Question Bank
Get access to all Cloud Architecture Design Principles and Trade-offs interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.