Cloud Cost Optimization for DBAs
Why managing cost is now part of the cloud DBA's job: how cloud databases are billed, pricing models, ten ways to cut costs, the tools that show where money goes, and the FinOps cycle.
Why cost is now a DBA's job
On-premises, a database server was bought once and the bill went to finance. In the cloud, every database sends a bill every month, and almost every decision a DBA makes, from instance size to backup retention, changes that bill. Managing cost has become one of the cloud DBA's most visible responsibilities.
Databases are usually among the most expensive items on a company's cloud bill: they run around the clock, they need fast storage, and production databases are often duplicated for high availability. Industry surveys regularly find that companies believe a large share of their cloud spending, often around a quarter, is wasted on resources that are idle, oversized, or forgotten.
That makes cost skills valuable. A cloud DBA who can cut the database bill by a third without hurting performance or reliability saves real money every month, and that gets noticed.
How cloud databases are billed
A managed database's monthly bill is made of several parts. Here's an example for a production database:
- Compute
- The database instance's processors and memory, billed for every hour (or second) it runs, whether it's busy or idle. Bigger instances cost more, and high availability setups often pay for a second, standby instance.
- Storage and I/O
- The gigabytes the database uses, billed per month. Faster storage costs more: some services charge for provisioned speed (IOPS), and some, such as Amazon Aurora's standard option, charge for every I/O request.
- Backups
- Automated backups and snapshots take storage. Providers include some backup storage at no extra cost, but long retention periods and old manual snapshots add up.
- Data transfer
- Moving data into the cloud is usually free, but data leaving it, to the internet, to another region, and on some clouds between availability zones, is charged per gigabyte.
- Licensing
- Commercial engines such as Oracle and SQL Server cost extra. You either pay for the license in the hourly price (license included) or use licenses the company already owns (bring your own license, or BYOL).
Pricing models
The same database can cost very different amounts depending on how you pay for it:
| Model | How it works | Best for |
|---|---|---|
| On-demand (pay as you go) | Pay by the hour or second, with no commitment. The most flexible, and the most expensive per hour. | New projects, short-lived databases, and workloads you're still sizing |
| Reserved capacity | Commit to an instance type for one or three years in exchange for a large discount, often a third or more off on-demand prices. Called Reserved Instances on AWS and reservations on Azure. | Steady production databases that run all the time |
| Serverless | Capacity scales up and down automatically with the load, and you pay for what's actually used. Some services, such as Azure SQL Database serverless, can pause when idle. | Spiky, unpredictable, or rarely used databases |
Ten ways DBAs cut database costs
Most savings come from a handful of levers. Each one is a DBA decision:
- 1. Right-size compute
- Look at CPU and memory use over several weeks, not one busy afternoon. A database that never goes above 20% CPU can usually move to a smaller instance, and each step down a size roughly halves the compute cost. Newer instance generations often do the same work for less money, too.
- 2. Schedule non-production databases
- Development and test databases rarely need to run nights and weekends. Stopping them outside working hours cuts their compute cost by around 70% (see below). Note that storage is still billed while a database is stopped, and Amazon RDS restarts a stopped database automatically after seven days, so schedules need automation.
- 3. Reserve steady workloads
- Once a production database is right-sized and you know it will run for a year or more, reserved capacity brings a large discount for the same instance.
- 4. Go serverless for spiky workloads
- A database that's busy for an hour a day, or unpredictably, can cost far less on a serverless option that scales down, or pauses, when idle.
- 5. Tune queries
- A slow query burns CPU and I/O on every run. Fixing the worst queries, often with an index, can let you drop to a smaller instance, and directly cuts per-I/O charges. Performance tuning and cost tuning are the same skill.
- 6. Tidy storage
- Choose the right storage type: on AWS, for example, general-purpose
gp3storage lets you buy speed separately from size, instead of paying for a premium tier. Delete unattached volumes, archive old data to cheaper object storage, and drop tables and indexes nobody uses. - 7. Trim backups
- Keep backups as long as the business and the law require, and no longer. Delete old manual snapshots that are no longer needed, and store long-term archives in cheaper storage tiers.
- 8. Match high availability to need
- A standby in a second zone roughly doubles compute cost. It's essential for production, but rarely needed for development and test databases. Add read replicas only where they're used.
- 9. Cut data transfer
- Keep applications and their databases in the same region, and in the same zone where possible. Avoid chatty traffic between regions, and use caching so the same data isn't fetched again and again.
- 10. Optimize licensing
- Compare license-included pricing with bringing licenses the company already owns, pick the edition you actually need (Enterprise features cost far more than Standard), and, for new systems, consider open source engines such as PostgreSQL, which have no license fees.
Scheduling: an easy win
A week has 168 hours. A team that only works on weekdays from 8 AM to 6 PM uses its test database for 50 of them:
You can't cut what you can't see
Before you can save money, you need to know where it goes. Every cloud provides tools for this:
- Tagging
- Labels attached to every resource, such as
owner,environment(dev, test, prod), andproject. Tags let billing reports show what each team and project costs, and make forgotten resources easy to spot. A database without tags is a database nobody owns. - Cost reports
- Dashboards that break the bill down by service, tag, and day, such as AWS Cost Explorer, Microsoft Cost Management in Azure, and Cost Analysis in OCI.
- Budgets and alerts
- A monthly budget per project or team, with an alert when spending is on track to go over it, so surprises are caught within days, not at the end of the month.
- Advisors
- Built-in recommendation services, such as AWS Trusted Advisor, Azure Advisor, and OCI Cloud Advisor, flag idle and oversized resources automatically.
The FinOps cycle
FinOps (financial operations) is the practice of managing cloud costs as a shared responsibility between engineering, finance, and the business. The FinOps Foundation describes it as a continuous cycle of three phases:
- Inform
- Make costs visible: tag everything, build cost reports, and show each team what its databases cost.
- Optimize
- Find and act on the biggest savings first: right-sizing, schedules, reserved capacity, and query tuning.
- Operate
- Make cost part of everyday work: budgets and alerts, cost checks in design reviews, and automation that keeps savings in place.
The DBA's part is the database layer: knowing what each database costs, why, and what it would take to make it cheaper without making it worse.
A worked example
Say Kofi is asked to review a team's three databases. Using simple example prices (real prices vary by provider, region, and engine):
| Database | Before | Change | After (per month) |
|---|---|---|---|
| Production | Large instance at $2.00 an hour, 24/7, CPU never above 25%: about $1,460 | Right-size to a medium instance at $1.00 an hour, then reserve it at a 35% discount | About $475 |
| Test | Medium instance at $1.00 an hour, running 24/7: about $730 | Schedule it for weekdays, 8 AM to 6 PM (about 217 hours a month) | About $217 |
| Old project database | Small instance at $0.25 an hour, unused for six months: about $183 | Take a final backup, then delete it | $0, plus a little backup storage |
| Total | About $2,373 | About $692: roughly 70% less |
None of these changes needed new technology. They needed someone who understood both the databases and the bill.
Cost-aware, not cost-obsessed
Saving money must never quietly break the promises a DBA makes to the business. A few rules keep cost cutting safe:
- Never trade away recovery. Backups, tested restores, and the agreed RPO and RTO come first. Trim backups to what's required, never below it.
- Keep production highly available. Cut standby databases in development and test, not where an outage would cost more than the standby.
- Measure before and after. Downsize based on weeks of data, then watch performance after the change, and be ready to scale back up.
- Talk to the owners. Before stopping or deleting anything, confirm with the team that owns it. Tags make that easy.
Key takeaways
- In the cloud, every resource costs money every hour, and most database costs come from decisions a DBA makes.
- A database bill is made of compute, storage and I/O, backups, data transfer, and licensing. Compute is usually the largest part.
- On-demand pricing is flexible, reserved capacity is cheaper for steady workloads, and serverless suits spiky ones.
- The main levers: right-size, schedule non-production, reserve, go serverless, tune queries, tidy storage and backups, match HA to need, cut data transfer, and optimize licenses.
- Tag everything, and use cost reports, budgets, and advisors to see where money goes. FinOps repeats inform, optimize, operate.
- Be cost-aware, not cost-obsessed: never trade away recovery or production availability to save money.