Skip to the page

AWS design and SRE · senior

AWS cost, compute choice and database failover

Find cost causes with data, choose compute by team size, and make applications survive a managed database failover by handling DNS caching and dead connections.

The notes

What you must know

  • Cost: Cost Explorer grouped by service, usage type, account and tags, day by day. Use the Cost and Usage Report in Athena and Cost Anomaly Detection.
  • EC2-Other hides NAT gateway hours and data processing, EBS volumes and snapshots, data transfer and public IPv4 addresses. A common cause is private workloads reaching S3 or ECR through NAT instead of VPC endpoints.
  • Cost fixes: gateway and interface endpoints, deleting unused volumes and snapshots, right-sizing, savings plans for steady use, and budgets and tags per team.
  • Compute choice for a small team: EC2 with Auto Scaling gives control but you patch and deploy; ECS on Fargate has no servers and is simple; EKS gives the Kubernetes ecosystem but you own add-ons and upgrades; Lambda fits event and short jobs. A small team usually starts with ECS on Fargate or Lambda.
  • RDS Multi-AZ failover promotes the standby and points the endpoint's DNS name at it. Connections to the old primary break.
  • Apps may keep working on the old address because the JVM caches DNS or the pool holds dead connections. If the old primary vanishes without closing connections, sockets wait for TCP retransmissions to give up, which can take many minutes by default on Linux.
  • Fixes: a short JVM DNS cache TTL, socket and query timeouts, pool validation and max lifetime, a driver or proxy that understands failover, and a failover test in staging.
  • Make recovery time a tested number, not an assumption.

The red pen

Common traps: mistake → fix

  • Mistake: The bill doubled because we launched big things

    Fix: small items like NAT data and snapshots add up.

  • Mistake: Kubernetes is always the right answer

    Fix: match to team size and need.

  • Mistake: Multi-AZ means no impact

    Fix: clients must reconnect.

Easy to hard

Questions interviewers ask, easy to hard

  1. The AWS bill doubled. Where do you start?
  2. EC2, ECS, EKS or Lambda for a four-engineer startup?
  3. RDS failed over in a minute but the app was down for 15 minutes. Why?
  4. What are the hidden costs under EC2-Other?

Practise

Practise with these questions

Explain it out loud

Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.

Practise by voice

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview