Cost Analysis and Optimization Recommendations Questions
Analyze cost implications of architectural choices. Propose cost optimizations with business case justification. Understand trade-offs between cost and other dimensions. Recognize when cost concerns should change architectural decisions.
MediumSystem Design
81 practiced
Design an architecture for a microservices platform distributed across multiple AZs and two regions that minimizes networking costs while preserving acceptable latency and fault isolation. Consider choices like VPC peering, transit gateway, regional load balancers, data replication, and implications of service mesh traffic.
Sample Answer
**Approach / goals**Design a multi-AZ, two-region microservices platform that minimizes inter-region networking costs, preserves low latency for critical paths, and keeps fault isolation between services and regions.**High-level architecture**- Primary components: per-region VPCs (multi-AZ), regional Transit Gateway (TGW) attachment pattern, regional ALBs, asynchronous cross-region data replication, and service mesh scoped to region.- Use TGW per region to aggregate intra-region VPC traffic; avoid full mesh VPC peering to reduce management overhead.**Traffic & cost strategy**- Keep latency-sensitive call paths (user API → regional services) fully regional using regional ALBs and region-scoped TGW attachments.- Route cross-region traffic only for replication, failover, or non-latency-sensitive analytics. Use async replication (CDC/event streams) to avoid synchronous cross-region RPCs.- Where possible, colocate read replicas or caches (Redis/ElastiCache, CDN) in each region to eliminate cross-region reads.**Service mesh considerations**- Run service mesh control plane per region; allow data plane (sidecars) to talk regionally by default.- For cross-region requests, use an explicit gateway/proxy (eg. egress gateway) that batches/optimizes calls and applies retry/backoff to reduce expensive cross-region calls and egress charges.- Disable mesh mutual TLS for cross-region service-to-service unless required; use encrypted links at network layer and strong auth to reduce mesh control plane chatter across regions.**Data replication**- Use async replication (CDC, Kafka MirrorMaker, or cloud-native replication) for databases and object storage replication to reduce latency and egress.- For stateful services where RPO must be low, implement regional active-passive with automated failover and DNS weight shifting.**Trade-offs & rationale**- TGW (regional) vs VPC peering: TGW simplifies routing and scales better; avoid peering full mesh which increases inter-region egress unpredictably.- Cross-region sync increases cost/latency — limit to required datasets and use compression/batching.- Service mesh regionalization preserves fault isolation and reduces control/data plane cross-region traffic.**Operational / monitoring**- Centralized observability (logs/metrics) aggregated asynchronously to avoid real-time cross-region transfers; use sampling and metrics replicas.- SLOs: low-latency regional tiers for user-facing paths; relaxed SLOs for cross-region replication.This design minimizes cross-region egress, confines most traffic to region/AZ, provides fault isolation via regional control planes, and uses async replication and regional caching to preserve acceptable latency.
HardTechnical
85 practiced
Create an outline for a 5-year TCO model for migrating a legacy ERP system to cloud. Include assumptions and line items for: infrastructure cost, migration project cost, licensing, personnel and training, managed services, monitoring/ops, and potential exit costs. Explain how you'd run sensitivity analysis and present scenarios to stakeholders.
Sample Answer
**Overview / Approach**As Cloud Architect I'd produce a 5-year TCO spreadsheet broken into CAPEX/OPEX, with year-by-year cashflows and NPV/IRR. Key deliverables: assumptions sheet, detailed line-item tabs, summary dashboard and scenario/sensitivity tabs.**Assumptions (sample)**- Migration timeline: 12 months pilot + 6–18 months full migration- Discount rate: 8% / inflation 3% annually- Growth: 5% annual increase in compute/storage needs- Cloud provider rates: current list/pricing and 10% annual price decline for reserved savings- SLA and RPO/RTO targets dictate architecture**Line items**- Infrastructure cost: compute (VM, containers), storage (block/object/archive), network (egress), DBaaS, backups, reserved vs on‑demand mix, DR region- Migration project cost: discovery, refactor/replatform, data migration, testing, runbooks, cutover windows, third‑party tools- Licensing: legacy ERP vendor maintenance, new cloud service licenses, OS/database licenses, per‑core vs subscription- Personnel & training: internal FTEs (cloud engineers, security, app owners), contractor/consultant support, training courses/certifications, ramp-up hiring- Managed services & support: MSP/CloudOps contracts, managed DB, 24x7 NOC- Monitoring & ops: APM, logging, SIEM, cost of runbooks/automation, on-call overhead- Exit costs & residuals: data egress, license termination/penalties, redeployment to another cloud/private, asset write‑offs**Templates & Metrics**- KPIs: 5‑yr NPV, payback, annual run rate, cost per transaction/user, risk-adjusted cost- Detailed unit-cost rows (unit price, quantity, utilization)**Sensitivity & Scenarios**- Sensitivity: vary key drivers (migration duration ±50%, % refactor vs lift‑and‑shift, reserved instance uptake, data egress rates) and compute tornado charts showing impact on NPV.- Scenarios to present: - Conservative: full rehost with minimal refactor, higher consulting hours, low reserved discounts - Optimistic: high refactor reducing runtime costs, 3‑yr reserved commitments, automation reduces ops FTEs - Risk/high-cost: extended project delays, license double‑up during cutover, higher egress- Present via dashboard: base-case, best/worst-case, and breakeven analysis; include sensitivity tables and recommended mitigations (e.g., phased refactor, reserved purchasing, governance guardrails).This structure enables stakeholders to compare financial and technical tradeoffs and choose a migration strategy aligned to risk appetite and business outcomes.
HardSystem Design
93 practiced
Design a multi-tenant Kubernetes cluster architecture optimized for cost while ensuring tenant isolation, fair compute allocation, and cost visibility. Address node sizing (mixed spot and on-demand pools), autoscaling, cluster-autoscaler policies, pod priorities/quotas, resource request/limit enforcement, and how to attribute cost per namespace for chargeback.
Sample Answer
**Clarify goals & constraints**- Optimize cost while preserving strong tenant isolation, fair compute allocation, and accurate per-namespace cost attribution. Support preemptible/spot usage where safe.**High-level architecture**- Single Kubernetes control plane + multiple node pools per AZ: (1) On‑demand for critical/latency-sensitive tenants, (2) Spot/Preemptible pools for best-effort batch and dev, (3) Small shared pool for system infra. Use taints/tolerations + nodeSelector/nodeAffinity to pin tenants to appropriate pools when needed.**Node sizing & instance mix**- Use heterogeneous instance types and sizes to improve bin‑packing and spot availability. Default guidance: - On‑demand: fewer larger nodes (e.g., 8–16 vCPU) for predictable workloads requiring fewer pods/node overhead. - Spot: many smaller nodes (e.g., 2–8 vCPU) to reduce risk of large-scale preemptions and improve scheduler packing.- Maintain diversified families to reduce correlated spot termination risk.**Autoscaling**- Use cluster-autoscaler (or Karpenter) configured per node pool: - Scale-up policy: fast for spot and on‑demand to meet pending pods. - Scale-down: conservative for on‑demand (longer cooldown), aggressive for spot. - Karpenter preferred for heterogeneous, instance-type flex and rapid provisioning.- HPA/VPA for tenant workloads. Prefer HPA on CPU/memory/custom metrics; VPA for safe single-replica workloads.**Cluster-Autoscaler policies**- Configure node group priorities and max surge capacity. Prevent CA from terminating on‑demand nodes serving high-priority tenants by: - Setting nodeGroup weights and expander strategy. - Using labels and CA ignored-node-pools for protected node groups.- Respect PodDisruptionBudgets for safe scale-down.**Pod priorities / quotas / fairness**- Define PriorityClasses: critical, standard-paid, best-effort-dev.- Per-tenant ResourceQuota and LimitRange in each namespace to cap total CPU/memory and enforce request/limit patterns.- Use Vertical Pod resource enforcement patterns: require CPU/memory requests (deny if missing) via OPA/Gatekeeper policy.- Use fair-share by combining ResourceQuota with LimitRange + fair sharing scheduler plugin (e.g., Kubernetes’ PodPriority+PriorityClasses or kube-scheduler’s Fair-Share plugin / Descheduler for eviction).**Resource request/limit enforcement**- Enforce via admission controller (Gatekeeper) policies: - Reject pods without requests. - Enforce min/max request-to-limit ratio. - Apply namespace default resource requests using LimitRange.- Use QoS classes: ensure paid tenants run in Guaranteed/Burstable, dev in BestEffort when appropriate.**Spot/preemption handling**- Use PodPriority + PriorityAdmission to ensure critical pods aren’t placed on spot pools.- For pods on spot: implement graceful termination handler, checkpointing, and use PodDisruptionBudgets, readiness/grace periods.- Consider running resilient workloads on spot with replicas across node pools and AZs.**Cost visibility & chargeback**- Instrument cluster with: - Kubecost (or CloudHealth + native billing export), Prometheus + kube-state-metrics. - Export cloud billing (AWS Cost & Usage → Cost Allocation Tags; GCP Billing Export → BigQuery).- Enforce standard namespace annotations/labels: tenant-id, cost-center, environment. Ensure cloud provider resource tags propagate to node VMs.- Aggregate cost: - Node cost allocation: map node labels to namespaces via pod-level CPU/memory time share to apportion node hourly cost. - Storage, LB, IPs: tag and attribute to namespace using cloud tags and kubecost mapping.- Produce showback/chargeback reports per tenant; automate with Kubecost or custom ETL into billing data warehouse. Validate by sampling and reconciling with cloud billing.**Operational controls & governance**- CI policies to enforce resource annotations & cost tags.- RBAC: namespace-level admin roles; restrict node pool creation to platform team.- Observability: Prometheus/Grafana alerts on budget overrun, CA behavior, spot termination rate.- Regularly review node sizing and right-size with usage reports.**Trade-offs**- Single cluster reduces management cost but increases blast radius; mitigate via strong isolation (NetworkPolicies, RBAC, PodSecurityPolicies/PSA).- Larger on‑demand nodes lower cloud API pressure but increase bin-packing inefficiency; choose hybrid sizing.This design balances cost (spot + autoscaling + diverse sizes), tenant isolation (namespaces, quotas, RBAC, taints/tolerations), fair compute allocation (ResourceQuota + priority classes + scheduler features), and precise chargeback (kubecost + billing export + tags).
MediumTechnical
75 practiced
Design a chargeback/showback model for internal product teams to charge for cloud consumption. Explain what metrics to expose on billing statements, how to allocate shared resource costs (e.g., networking, support), incentives to encourage cost-conscious behavior, and a governance process to handle disputes.
Sample Answer
**Approach (summary)** I’d implement a FinOps-first chargeback/showback model combining transparent usage metrics, principled allocation of shared costs, behavioral incentives, and a lightweight governance workflow so product teams can own cost and value.**Metrics on billing statements** - Raw usage: vCPU-hours, GB-month storage, GB egress, DB I/O, request counts - Unit costs and rates (on-demand vs discounted) and amortized committed discounts (e.g., RI/Saving Plans) - Capacity/reservation utilization and unallocated slack - Labels/tags: product, environment, cost center, team owner - Anomalies & trends: % month-over-month change, forecast vs budget, cost-per-transaction or cost-per-active-user**Allocating shared costs** - Tag-first: attribute as much as possible to owners. - Fixed shared pool + usage-based split: network/support/security = base allocation (e.g., 30%) evenly or by headcount, remainder pro-rated by direct usage (e.g., network by egress proportion). - Amortize committed discounts and enterprise licenses back to teams by their historical usage share. - Example: Internet egress $10k => 20% base by team count, 80% split by each team’s egress GB.**Incentives to drive cost-conscious behavior** - Showback for visibility, chargeback for accountability once mature. - Budget alerts + automated guardrails (stop/start limits, quota) to prevent surprises. - Savings-sharing: percentage of validated savings returned to team budget for reinvestment. - Gamification and monthly “efficiency” KPIs (cost per feature, right-sizing score).**Governance & dispute process** - Cost Review Board (rep from FinOps, Cloud Platform, Finance, product owners) meets biweekly. - Dispute workflow: submit ticket with evidence (tags, timestamps) → 5 business day investigation → temporary adjustment for contested charges → final resolution and lessons (root cause, tagging gaps). - Policy engine: tagging enforcement, required owners, and cost allocation rules versioned and published. - Quarterly audits and runbook for anomaly retrofits (re-tagging, crediting).This balances transparency, technical allocation fidelity, behavioral incentives, and a fast governance loop so teams can both control and be accountable for cloud spend.
EasyTechnical
105 practiced
You inherit a cloud account with 150 VMs: 100 are production running 24/7 and 50 are dev/test used primarily from 9am-6pm weekdays. Describe five immediate cost-optimization actions you would take within the first 30 days, the rationale behind each, and estimate qualitatively the expected impact.
Sample Answer
**Overview (first 30 days)**Below are five immediate, high-impact cost-optimization actions I’d take, the rationale for each, and qualitative expected impact.1) **Implement off-hours scheduling for dev/test (9am–6pm)** - Action: Use cloud-native schedulers or runbooks to stop/start the 50 dev/test VMs outside working hours; apply auto-start on weekdays. - Rationale: Eliminates pay-for-idle compute. Simple to automate and reversible. - Impact: High — ~40–60% savings on those 50 VMs (overall account ~13–20%).2) **Rightsize VM instance types for all VMs** - Action: Analyze CPU/memory/IO metrics over 14–30 days, then downsize oversized instances or move to burstable types for low-utilization workloads. - Rationale: Prevents overprovisioning; matches resources to demand. - Impact: Medium–High — 10–30% on resized VMs.3) **Apply Reserved/Committed Use Discounts for stable production** - Action: Purchase 1-year or 3-year reserved instances or committed use for the 100 prod VMs where workload is steady. Use convertible options where flexibility needed. - Rationale: Significant unit-cost reduction for predictable workloads. - Impact: High — 30–70% on committed capacity (depends on term).4) **Identify and decommission orphaned resources and unattached storage** - Action: Scan for unused disks, snapshots, IPs, load balancers, unattached NICs and delete or archive per policy. - Rationale: Storage and idle resources accumulate hidden costs. - Impact: Low–Medium — immediate one-time savings, reduces ongoing waste.5) **Enforce tagging and implement cost governance & alerts** - Action: Apply mandatory cost-center/tier/environment tags; set budget alerts and automated remediation for anomalies. Create a lightweight chargeback report for owners. - Rationale: Enables accountability, trend tracking, and prevents future drift. - Impact: Long-term: Medium — prevents reintroduction of waste and supports continuous optimization.Together these actions balance quick wins (scheduling, decommission) with strategic changes (rightsizing, commitments, governance) to reduce spend substantially within 30 days while minimizing risk to production.
Unlock Full Question Bank
Get access to hundreds of Cost Analysis and Optimization Recommendations interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.