# Databases and data on Cloud Run

> Cloud SQL, Firestore and Postgres for a Cloud Run app: choosing one, connecting, pooling, migrations, backups, files in Cloud Storage and Redis.

<https://exodus.elim.io/blog/topic/data>

A Cloud Run instance keeps nothing on its disk, so every piece of state lives in a database or a bucket. These guides cover choosing between Cloud SQL, Firestore and a serverless Postgres, connecting and pooling, running migrations as a job, moving a database without losing rows, backups and point-in-time recovery, files in Cloud Storage, and what replaces Redis.

- [Backups and point-in-time recovery on Cloud SQL: the defaults, getting a table back, and settings to check on day one](https://exodus.elim.io/blog/backups-and-point-in-time-recovery-on-cloud-sql.md): What a new Cloud SQL instance backs up by default, the four settings to change, how a restore and a point-in-time clone work, a copy that outlives the instance, and what it costs.
- [Cloud SQL, Firestore or a serverless Postgres: choosing the database for a Cloud Run app](https://exodus.elim.io/blog/cloud-sql-firestore-or-serverless-postgres.md): The database sets the floor of a Cloud Run bill: Cloud SQL from $9.37 a month, Firestore per document, or a serverless Postgres on another cloud. Costs, connections and code for each.
- [Connecting Cloud Run to Cloud SQL: the /cloudsql socket, connectors, private IP and the errors of the first deploy](https://exodus.elim.io/blog/connecting-cloud-run-to-cloud-sql.md): Three ways from Cloud Run to Cloud SQL: the /cloudsql socket, a connector library, or a private IP. The commands, the connection string, the cost, and the errors of the first deploy.
- [Connection pooling on Cloud Run: sizing the pool, Cloud SQL's 25 connections, PgBouncer or Managed Connection Pooling](https://exodus.elim.io/blog/connection-pooling-on-cloud-run.md): Each Cloud Run instance opens its own pool, and the smallest Cloud SQL machine takes 25 connections. How to size pools per framework, and when to use Managed Connection Pooling or PgBouncer.
- [Database migrations on Cloud Run: run them as a job, before the deploy](https://exodus.elim.io/blog/database-migrations-as-cloud-run-jobs.md): Cloud Run has no release phase. How to run migrations as a Cloud Run job with the new image before the deploy, write migrations the old revision survives, and pay about a tenth of a cent a run.
- [Do you still need Redis on Cloud Run? Each job it does, what replaces it, and what it costs if it stays](https://exodus.elim.io/blog/do-you-still-need-redis-on-cloud-run.md): A PaaS Redis collects sessions, cache, queue, rate limits and locks; on Cloud Run it is Memorystore billed every hour. How to move each job to Postgres or Cloud Tasks, and when Redis stays.
- [Moving a Postgres database to Cloud SQL without losing data: rehearse, compare, freeze, copy](https://exodus.elim.io/blog/moving-a-postgres-database-without-losing-data.md): A dump and restore moves a small Postgres in minutes and loses rows written meanwhile unless writes stop. The order that keeps a way back, Cloud SQL's flags, proving both sides match.
- [The smallest Cloud SQL instances and what they cost](https://exodus.elim.io/blog/cloud-sql-smallest-instances-and-what-they-cost.md): Cloud SQL's cheapest machines, from $7.67 to $184.69 a month, priced with storage, backups, HA and the charges people miss. Which to choose, how to create it, how to read its cost.
- [Files and uploads on Cloud Run: from disk to a Cloud Storage bucket](https://exodus.elim.io/blog/files-and-uploads-with-cloud-storage.md): A Cloud Run instance's disk is memory and dies with the instance. How to move uploads to Cloud Storage with signed URLs, serve downloads, move existing files, and what it costs.
