google_sql_database_instance cost estimation
A managed MySQL, PostgreSQL, or SQL Server database. Priced by tier, storage, and HA mode. Sustained-use discounts apply.
A google_sql_database_instance is a managed relational database. Cloud SQL supports MySQL, PostgreSQL, and SQL Server. Pricing has three main components.
First, compute. The instance tier defines vCPU and memory. Shared-core tiers (db-f1-micro, db-g1-small) are cheap and right for dev. Custom and standard tiers scale up to db-n1-highmem-96 (96 vCPU, 624 GB RAM). Compute is billed per vCPU-hour and per GB-RAM-hour. Sustained-use discounts apply automatically to monthly running instances.
Second, storage. SSD storage is $0.17/GB-month; HDD is $0.09/GB-month. Storage can be auto-scaled (storage_auto_resize = true), only growing, never shrinking. HDD is right for archive or write-heavy workloads where IOPS aren't critical; SSD is the default for application databases.
Third, high availability. Setting availability_type = "REGIONAL" provisions a synchronous standby in another zone. Effectively doubles compute and storage cost. The default ZONAL has no standby.
Backups are free up to the size of the database. Backup storage above that is billed at $0.08/GB-month. Point-in-time recovery requires binary logging or WAL retention, slightly increasing storage cost.
SQL Server has license-included pricing that's 2-3x more expensive than PostgreSQL or MySQL at equivalent instance sizes. License costs can be reduced with Bring-Your-Own-License if you have eligible Microsoft licenses.
c3x reads tier, disk_size, disk_type, and availability_type from the resource.
Terraform example
A minimal but realistic configuration that C3X can estimate.
resource "google_sql_database_instance" "main" {
name = "production-postgres"
database_version = "POSTGRES_16"
region = "us-central1"
settings {
tier = "db-custom-4-16384"
availability_type = "REGIONAL"
disk_size = 200
disk_type = "PD_SSD"
disk_autoresize = true
backup_configuration {
enabled = true
point_in_time_recovery_enabled = true
retained_backups = 14
}
}
deletion_protection = true
}Pricing dimensions
What you actually pay for when you provision google_sql_database_instance.
| Dimension | Unit | What's being charged |
|---|---|---|
| vCPU hours | per vCPU per hour | Compute charge for the instance tier. Custom tiers bill by vCPU count. $0.041/vCPU-hour for PostgreSQL in us-central1 |
| Memory hours | per GB-RAM per hour | Memory charge for the instance tier. $0.007/GB-RAM-hour |
| Storage (SSD) | per GB-month | Provisioned SSD storage. Cannot be reduced after creation. $0.17/GB-month |
| Storage (HDD) | per GB-month | Provisioned HDD storage. Cheaper but lower performance. $0.09/GB-month |
| Backups (above database size) | per GB-month | Backups up to the database size are free. Anything beyond is billed. $0.08/GB-month |
| Regional HA (multiplier) | doubles compute + storage | availability_type = REGIONAL provisions a synchronous standby, doubling cost. |
Optimization tips
Common ways to reduce google_sql_database_instance cost without changing the workload.
Use shared-core tiers for non-production
Up to 95%db-f1-micro and db-g1-small are 90%+ cheaper than standard or custom tiers. Right for dev/staging, ephemeral databases, and personal projects. Not for production.
Skip Regional HA for non-production
About 50%Regional HA doubles compute and storage cost. Non-production rarely needs the 99.95% SLA. Disable for dev/staging.
Commit to 1-year or 3-year usage
25-52%Committed Use Discounts cut Cloud SQL compute prices by 25% (1-year) or 52% (3-year). Right for production databases that won't move.
Use HDD storage for write-heavy archive workloads
About 50% on storageHDD is roughly half the per-GB cost of SSD. Lower IOPS but fine for append-only logs, audit databases, or any workload where IOPS aren't critical.
FAQ
Does c3x apply Sustained Use Discounts to Cloud SQL?
Yes. SUDs apply automatically to instances running more than 25% of the month, up to a 30% discount for full-month running. c3x applies these to monthly estimates.
What's the difference between Cloud SQL and AlloyDB?
AlloyDB is a separate higher-performance PostgreSQL service with different pricing (priced by vCPU + RAM + storage like Cloud SQL but more expensive). Right for analytical or high-performance workloads. Cloud SQL is right for general-purpose application databases.
Are backups really free?
Yes, up to the size of the database. A 100 GB database gets 100 GB of free backup. Beyond that, you pay. Long retention windows (>30 days) can push backup costs above the free amount.
Why is SQL Server more expensive?
Cloud SQL for SQL Server includes the Microsoft license cost, which roughly doubles or triples the per-vCPU rate. Use BYOL if you have eligible licenses, or consider PostgreSQL if compatible.
Related resources
Estimate this resource in your own Terraform
Free, open source, no API key. C3X parses your Terraform and shows line-item cost for every resource, including google_sql_database_instance.