Nov 18, 20266 min read

How to Migrate Supabase Storage to Google Cloud Storage

A step-by-step guide to moving Supabase Storage buckets, signed URLs and storage RLS policies to Google Cloud Storage in your own GCP project, with a TypeScript backend that declares the buckets and the access checks in code.

Illustration for How to Migrate Supabase Storage to Google Cloud Storage

Supabase Storage keeps files in buckets and controls access with RLS policies on the storage.objects table. Moving it to Google Cloud Storage usually happens alongside moving the backend to GCP.

The work is in what has no direct GCS counterpart: storage RLS policies, Supabase's signed and public URL helpers, and image transformations. This guide covers the inventory, the copy with rclone, the code changes in a TypeScript backend on Encore, and a two-pass cutover.

Supabase Storage vs Google Cloud Storage at a glance

Supabase StorageGoogle Cloud Storage
Access controlRLS policies on storage.objectsIAM with uniform bucket-level access
Private file linkscreateSignedUrl, createSignedUploadUrlV4 signed URLs, up to 7 days
Public filesPublic buckets at /storage/v1/object/public/Public bucket, usually behind Cloud CDN
Image resizing/storage/v1/render/image/ transformationsNone built in
S3 APIS3-compatible endpoint with access keysXML API with HMAC keys, or the JSON API
VersioningNot supportedObject versioning per bucket
Storage priceIncluded quota, then per GB on paid plansAbout $0.020 per GB-month for Standard in US regions

GCS prices are from Cloud Storage pricing, checked on November 18, 2026, and vary by region and storage class. Signed URL limits are from the GCS signed URLs docs.

Step 1: Inventory buckets, policies and URLs

Every bucket and object is a row in the storage schema of your Supabase database, so counts and sizes come from one query:

SELECT b.id AS bucket, b.public, count(o.id) AS objects, pg_size_pretty(sum((o.metadata->>'size')::bigint)) AS total FROM storage.buckets b LEFT JOIN storage.objects o ON o.bucket_id = b.id GROUP BY b.id, b.public ORDER BY b.id;

List the storage policies from pg_policies where schemaname = 'storage', and write each one down as a sentence, such as "users read and write files under a folder named after their user ID". In the code, search for getPublicUrl, createSignedUrl, createSignedUploadUrl and render/image, and in the database for columns that hold full Supabase URLs instead of object keys.

Step 2: Declare the buckets and access rules in code

Encore is a backend framework with built-in infrastructure for TypeScript and Go. Each Supabase bucket becomes a Bucket in code, and deploying to your GCP project creates a GCS bucket with a unique name and grants the service account for the service access to it. Per the GCP infrastructure docs, public buckets are served through Cloud CDN.

Application code passes through Encore and infrastructure guardrails to resources provisioned in your own AWS or GCP account.
Get started
brew install encoredev/tap/encore &&
encore app create
Copy

Run in your terminal to get started locally.

import { api, APIError } from "encore.dev/api"; import { getAuthData } from "~encore/auth"; import { Bucket } from "encore.dev/storage/objects"; // Was the public "avatars" bucket. A GCS bucket served through Cloud CDN. export const avatars = new Bucket("avatars", { public: true }); // Was the private "documents" bucket. A GCS bucket with no public access. export const documents = new Bucket("documents", { versioned: true }); // Replaces the storage RLS policy that compared // (storage.foldername(name))[1] with auth.uid(). function ownKey(path: string): string { const { userID } = getAuthData()!; if (path.includes("..")) throw APIError.invalidArgument("invalid path"); return `${userID}/${path}`; } // Replaces createSignedUploadUrl. export const documentUploadUrl = api( { expose: true, auth: true, method: "POST", path: "/documents/upload-url" }, async (p: { path: string }): Promise<{ url: string; key: string }> => { const key = ownKey(p.path); const { url } = await documents.signedUploadUrl(key, { ttl: 600 }); return { url, key }; }, ); // Replaces createSignedUrl. export const documentDownloadUrl = api( { expose: true, auth: true, method: "GET", path: "/documents/download-url/*path" }, async (p: { path: string }): Promise<{ url: string }> => { const key = ownKey(p.path); if (!(await documents.exists(key))) throw APIError.notFound("no such document"); const { url } = await documents.signedDownloadUrl(key, { ttl: 300 }); return { url }; }, ); // Replaces getPublicUrl. export const avatarUrl = api( { expose: true, method: "GET", path: "/avatars/:userID" }, async (p: { userID: string }): Promise<{ url: string }> => { return { url: avatars.publicUrl(`${p.userID}.png`) }; }, );

The auth: true endpoints rely on an auth handler that verifies your session or JWT and returns the user ID. In a local encore run test, user u_42 got a signed upload URL, a PUT to it returned 200, the same user got a download URL, user u_7 asking for the same path got not_found and a request with no token got unauthenticated. The object storage docs cover signed URLs and public buckets, and connecting your own cloud covers linking the GCP project.

Moving the RLS rule into ownKey puts it in code you can test, and a coding agent that adds a new bucket or upload flow changes the same TypeScript file, with the next deploy creating the bucket and its permissions.

Step 3: Copy the files with rclone

Deploy once so the buckets exist, and find their generated names with gcloud storage ls. Then generate S3 access keys in the Supabase Storage settings, which bypass RLS and belong on a server only, and configure both remotes. The GCS remote uses Application Default Credentials and bucket_policy_only for buckets with uniform bucket-level access:

# ~/.config/rclone/rclone.conf [supabase] type = s3 provider = Other access_key_id = <supabase s3 access key id> secret_access_key = <supabase s3 secret> endpoint = https://<project_ref>.storage.supabase.co/storage/v1/s3 region = <project region> [gcs] type = google cloud storage env_auth = true bucket_policy_only = true

Run rclone sync supabase:documents gcs:<documents bucket> --progress for each bucket, then rclone check with --size-only to compare. For large buckets, run the copy from a Compute Engine VM in the bucket's region, and spot-check Content-Type with gcloud storage objects describe. The rclone GCS docs list the remaining options.

Step 4: Replace image transformations

Supabase's render/image endpoint resizes on request, and GCS has nothing equivalent. Either resize on upload, by storing a few fixed sizes from a subscription that runs after each upload, or put an image service in front of the public bucket. Resizing on upload keeps the bill and the latency predictable for avatars and thumbnails.

Step 5: Cut over in two passes

Run the full sync a day ahead, deploy the code that issues GCS URLs behind a flag, then in a short window stop uploads to Supabase, run rclone sync again to copy only what changed, and turn the flag on. If the GCS buckets already hold new uploads, use rclone copy instead, since sync deletes destination objects that are missing on the source. Rewrite stored Supabase URLs to object keys with one UPDATE, and keep the Supabase buckets for a few days until the logs show no requests.

Best fit: TypeScript or Go backends moving from Supabase to their own GCP project that want buckets, CDN and access rules declared in the code that uses them.

Frequently asked questions

How do I copy files from Supabase Storage to Google Cloud Storage?

Generate S3 access keys in the Supabase Storage settings, add Supabase as an S3-compatible rclone remote and GCS as a google cloud storage remote, then run rclone sync per bucket. rclone keeps object keys, so a file at u_42/lease.pdf in Supabase lands at u_42/lease.pdf in GCS.

What replaces Supabase Storage RLS policies on Google Cloud Storage?

GCS has no row-level policies, so with uniform bucket-level access IAM decides which service accounts can read or write a bucket, and per-user rules such as only reading files under your own user ID folder move into the backend that issues signed URLs.

Do Supabase signed URLs work after moving to GCS?

No. Existing Supabase signed and public URLs keep pointing at Supabase until you delete the bucket, so new URLs come from GCS: V4 signed URLs that expire after at most seven days for private files, and a public bucket behind Cloud CDN for public files. Store object keys in the database instead of full URLs so the host can change without a data migration.

How does Encore create the GCS buckets?

You declare each bucket in TypeScript or Go with new Bucket(name), and deploying to your GCP project creates a GCS bucket with a unique name and grants the service account of each service that uses it access. Buckets declared with public set to true are served through Cloud CDN.

Deploy to your cloud on AWS and Google Cloud
without managing infrastructure

Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.

~/orders — claude
Claude Code
Claude Code v2.1.180Opus 5.5~/orders