Keeping cloud costs in check

Cloud bills rarely jump because of one big decision. They creep up, one forgotten resource at a time.

The cloud makes it easy to start something and just as easy to forget it’s running. Most surprise bills aren’t caused by growth. They come from test environments nobody turned off, logs nobody reads, and servers sized for a launch day that has long passed. A few habits keep the bill predictable.

Set budgets and alerts

Every major cloud provider lets you set a budget and send an alert as spending approaches it. Do it on day one, with alerts at a few points along the way. Budgets usually warn rather than stop spending, so make sure the alerts reach a person who will act on them.

Tag everything

Label each resource with the product, the environment and an owner. Tags turn a long, confusing bill into one you can read: this much for production, this much for staging, this much for last spring’s experiment. Without them, nobody can say what a resource is for, so nobody dares delete it.

Clean up what’s idle

The usual suspects are development environments left running overnight and over weekends, storage left behind after a server was deleted, old snapshots and backups past their retention period, and unused addresses and load balancers. Schedule non-production environments to shut down outside working hours, and look for idle resources every month.

Right-size after launch

Servers and databases are often sized from a guess made before launch. After a few weeks of real traffic, look at actual usage. If something rarely uses more than a small part of its capacity, move it down a size. Look again after big changes in traffic, in either direction. Managed services that scale down on their own, or charge only when used, are often cheaper for parts of an app that are quiet most of the day.

Watch logs and data transfer

Logs are cheap per gigabyte and expensive in bulk. Set a retention period for each log group instead of keeping everything forever, which is often the default, and turn off noisy debug output in production. Data transfer out of the cloud is another quiet cost: serve images and files through a content delivery network, and keep services that talk to each other in the same region.

Commit only once usage is steady

Providers offer discounts in exchange for committing to a level of usage for a year or more. On steady workloads they can save real money. Wait until usage has settled, and commit to the floor, not the peak.

A monthly half hour

Put thirty minutes on the calendar each month to read the bill by service and by tag. Compare it with last month and ask about anything that grew. Small surprises found every month stay small, and the bill stays something you planned rather than something that happened to you.