CodePark/ questions / Availability, scaling, IaC & cost
START PRACTICINGPRACTICE
Backend question · Cloud & AWS › Availability, scaling, IaC & cost

What are common surprises on an AWS bill for a backend team, and how do you keep costs under control?

Common surprises on the bill:

  • NAT gateway charges: an hourly fee plus a fee for every GB it processes. This hurts most when containers pull images or talk to S3 through the NAT.
  • Data transfer out to the internet, and traffic between AZs or between Regions.
  • Idle resources: forgotten dev databases, unattached EBS volumes, old snapshots, idle load balancers and unused Elastic IPs.
  • CloudWatch Logs with no retention period, plus noisy debug logging.
  • Oversized instances, and Lambda functions with too much memory.

How to control costs:

  • Set AWS Budgets with alerts, and review Cost Explorer regularly.
  • Tag every resource with its team, service and environment. Activate these tags as cost allocation tags, so you can see which team or service spends the money.
  • Add VPC endpoints for S3 and DynamoDB, so that traffic skips the NAT gateway.
  • Put CloudFront in front of large downloads.
  • Right-size resources based on their real metrics.
  • Use Savings Plans for steady load, and Spot instances for work that can be interrupted.
  • Schedule non-production environments to shut down when nobody uses them.
  • NAT gateway data processing and data transfer out are common surprises.
  • Idle and forgotten resources cost money, such as old snapshots and unattached volumes.
  • Logs without a retention period keep growing and keep costing.
  • Use Budgets, Cost Explorer and cost allocation tags to see and limit spending.
  • Save with VPC endpoints, right-sizing, Savings Plans, Spot and shutting dev down on a schedule.