--- title: "CockroachDB With Wasabi" slug: "how-do-i-use-cockroachdb-with-wasabi" updated: 2026-08-03T16:19:39Z published: 2026-08-03T16:19:39Z canonical: "docs.wasabi.com/how-do-i-use-cockroachdb-with-wasabi" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.wasabi.com/llms.txt > Use this file to discover all available pages before exploring further. # CockroachDB With Wasabi [CockroachDB](https://www.cockroachlabs.com) (CRDB) has been validated for use with Wasabi as a cloud storage target for [Backup and Restore](https://www.cockroachlabs.com/docs/stable/backup-and-restore-overview.html#backup-and-restore-types) of a cluster, database, or table. CockroachDB is a Cloud-Native Distributed SQL Database designed to scale fast and survive disasters. CockroachDB natively supports S3-compatible Wasabi storage without any other product or service dependency. ## Requirements - An active Wasabi cloud storage account. - CockroachDB versions 21.2 and later. Refer to the [Release Support Policy](https://www.cockroachlabs.com/docs/releases/release-support-policy) for the latest releases. ## Architecture Diagram The diagram below depicts the reference architecture for using Wasabi with CockroachDB. ![crdb-pic2.png](https://cdn.document360.io/bef0a1ea-7768-4d5a-b520-c4fe2f7fafad/Images/Documentation/9981384526491.png) ## Creating a Wasabi Bucket Create a bucket in the Wasabi region of your choice for backing up the CockroachDB database. If the goal is to use Object Lock-enabled buckets, refer to the Object Lock section[Object Lock](/v1/docs/how-do-i-use-cockroachdb-with-wasabi#object-lock) section, below. Once the bucket is created, create a user with the correct roles and policies, and download the Wasabi API access key by following the steps in [3—Creating a User Account and Access Key](https://docs.wasabi.com/docs/creating-a-wasabi-api-access-key-set). The user should have read/write access to the Wasabi bucket. ## Creating Backup And Restore on CRDB Users can create full or incremental backups of a cluster, database, or table. Taking regular backups of your data is an operational best practice. The following use cases describe how to use Wasabi’s cloud storage for CockroachDB bulk operations. Wasabi recommends enabling Object Lock on Wasabi to protect the validity of CockroachDB backups. For more details on creating immutable backups, refer to Object Lock below. ### Disaster Recovery - Continual Full and/or Incremental Backups - Recovery points from a potential Catastrophic Failure CockroachDB Backups are primarily needed for disaster recovery. Continually taking full and incremental CockroachDB backups create a backup collection in the target Wasabi bucket. The backups are stored at the collection URI which is passed in a BACKUP or RESTORE statement. The following example depicts a backup collection created in a single Wasabi bucket. ![bucket.png](https://cdn.document360.io/bef0a1ea-7768-4d5a-b520-c4fe2f7fafad/Images/Documentation/9982688526619.png)A user with sufficient database [backup](https://www.cockroachlabs.com/docs/stable/backup#required-privileges) or [restore privileges](https://www.cockroachlabs.com/docs/stable/restore#required-privileges) and sufficient [storage permissions](https://www.cockroachlabs.com/docs/stable/use-cloud-storage-for-bulk-operations.html?filters=s3compatible#storage-permissions) can initiate/configure/schedule backup/restore operations via [SQL statements](https://www.cockroachlabs.com/docs/stable/backup-and-restore-overview.html#backup-and-restore-sql-statements) using any of the supported database client interfaces or tools. The statement below provides an example of issuing a one-time full backup: ```sql BACKUP DATABASE billing INTO 's3://crdb_backups/billing?AWS_ACCESS_KEY_ID=bucket_access_key&AWS_SECRET_ACCESS_KEY=secret&AWS_ENDPOINT=s3.wasabisys.com&AWS_REGION=us-east-1' WITH detached; ``` The statement below provides an example to restore from the latest backup: ```sql RESTORE FROM LATEST IN 's3://crdb_backups?AWS_ACCESS_KEY_ID=bucket_access_key&AWS_SECRET_ACCESS_KEY=secret&AWS_ENDPOINT=s3.wasabisys.com&AWS_REGION=us-east-1'; ``` Below is an example of a statement to restore from an incremental backup: ```sql RESTORE FROM '2021/03/23-213101.37' IN 's3://crdb_backups?AWS_ACCESS_KEY_ID=bucket_access_key&AWS_SECRET_ACCESS_KEY=secret&AWS_ENDPOINT=s3.wasabisys.com&AWS_REGION=us-east-1'; ``` > The example above discusses using the us-east-1 region. Refer to [Service URLs for Wasabi's Storage Regions](https://docs.wasabi.com/docs/what-are-the-service-urls-for-wasabis-different-storage-regions) to use the correct values for AWS_ENDPOINT and AWS_REGION parameters based on the location of your bucket. The S3_STORAGE_CLASS parameter in the URI does not apply to Wasabi, as it offers a single storage class. The example below shows a representation in CockroachDB’s interactive SQL client. ![sql.png](https://cdn.document360.io/bef0a1ea-7768-4d5a-b520-c4fe2f7fafad/Images/Documentation/9972180629275.png) ### CockroachDB Cluster Migration: - Forklift migration from On-Premise to CockroachCloud - Bulk Import PGDUMP or MYSQLDUMP Successive backup-restore operations can be used on the CockroachDB cluster to migrate data and metadata to CockroachCloud, using a Wasabi bucket as staging storage. For heterogeneous migrations, such as from PostgreSQL or MySQL to CockroachDB, a temporary Wasabi storage bucket provides cost-effective staging for data files during export-import-style migrations. CockroachDB can be used to [IMPORT](https://www.cockroachlabs.com/docs/stable/import.html) data directly from a Wasabi bucket. The following example shows how to import a complete database (schema and data) from a PostgreSQL dump. ```sql IMPORT PGDUMP 's3://migration/pgdump.sql? AWS_ACCESS_KEY_ID=bucket_access_key&AWS_SECRET_ACCESS_KEY=secret&AWS_ENDPOINT=s3.wasabisys.com&AWS_REGION=us-east-1' WITH ignore_unsupported_statements; ``` The example below shows how to import a single table from a MySQL database dump. ```sql IMPORT TABLE customers FROM MYSQLDUMP 's3://migration/customers.sql? AWS_ACCESS_KEY_ID=bucket_access_key&AWS_SECRET_ACCESS_KEY=secret&AWS_ENDPOINT=s3.wasabisys.com&AWS_REGION=us-east-1' WITH skip_foreign_keys; ``` > The example above discusses using the us-east-1 region. Refer to [Service URLs for Wasabi's Storage Regions](https://docs.wasabi.com/docs/what-are-the-service-urls-for-wasabi-s-different-storage-regions) to use the correct values for AWS_ENDPOINT and AWS_REGION parameters based on the location of your bucket. The S3_STORAGE_CLASS parameter in the URI does not apply to Wasabi, as it offers a single storage class. ### CockroachDB Cluster Cloning - Create a Staging environment with Production data Wasabi can be used to store CockroachDB backups and run a cloning operation by restoring a recently taken full backup. This procedure may be used for cluster cloning by leveraging a point-in-time copy of a production database backup. Refer to the example below to restore the latest backup. ```sql RESTORE FROM LATEST IN 's3://crdb_backups?AWS_ACCESS_KEY_ID=bucket_access_key&AWS_SECRET_ACCESS_KEY=secret&AWS_ENDPOINT=s3.wasabisys.com&AWS_REGION=us-east-1'; ``` ### Staging Storage for Data Export-Import Data exchanges in CockroachDB bulk data exports and imports require a staging area for the data files. A Wasabi storage bucket can be used as a staging area for CockroachDB exports and imports. The example below shows the command to export data. ```sql EXPORT INTO CSV 's3://staging/customers.csv? AWS_ACCESS_KEY_ID=bucket_access_key&AWS_SECRET_ACCESS_KEY=secret&AWS_ENDPOINT=s3.wasabisys.com&AWS_REGION=us-east-1' WITH delimiter = '|' FROM TABLE bank.customers; ``` > The example above discusses using the us-east-1 region. Refer to [Service URLs for Wasabi's Storage Regions](https://docs.wasabi.com/docs/what-are-the-service-urls-for-wasabi-s-different-storage-regions) to use the correct values for AWS_ENDPOINT and AWS_REGION parameters based on the location of your bucket. The S3_STORAGE_CLASS parameter in the URI does not apply to Wasabi since Wasabi offers a single storage class. ## Object Lock CockroachDB supports writing backups to Wasabi buckets with [Object Lock](https://docs.wasabi.com/docs/object-locking) enabled. This allows users to store database backups using a write-once-read-many (WORM) model. The following steps describe the procedure for creating Object Lock-enabled buckets in the Wasabi console. To create object-locked buckets using the S3 API, refer to the documentation in the [Wasabi S3 API Reference](https://docs.wasabi.com/docs/wasabi-api). 1. On the Wasabi console, click **Create Bucket** and input the Bucket Name and select the region. Click **Next**. ![blobid12.png](https://cdn.document360.io/bef0a1ea-7768-4d5a-b520-c4fe2f7fafad/Images/Documentation/blobid12.png) 2. In the Set Properties window, enable versioning by setting **Bucket Versioning** and enable Object Locking by setting **Enable Object Locking**. Then click **Next**, review the details, and click **Create Bucket** to create the bucket. ![blobid13.png](https://cdn.document360.io/bef0a1ea-7768-4d5a-b520-c4fe2f7fafad/Images/Documentation/blobid13.png) 3. Once the bucket is created, select it and click **Settings**. ![Screen_Shot_2022-10-27_at_4.24.59_PM.png](https://cdn.document360.io/bef0a1ea-7768-4d5a-b520-c4fe2f7fafad/Images/Documentation/9958588778011.png) 4. On the settings page, click **Object Locking**. ![Screen_Shot_2022-10-27_at_4.26.17_PM.png](https://cdn.document360.io/bef0a1ea-7768-4d5a-b520-c4fe2f7fafad/Images/Documentation/9958661329435.png) 5. In the Object Locking tab, enable **Bucket-Level Object Retention**. For Governance mode select **Enable Governance Mode**. To enable Compliance mode, select **Enable Compliance Mode**. Set the retention time based on the customer’s retention policies for preserving backups. ![Screen_Shot_2022-10-27_at_4.27.28_PM.png](https://cdn.document360.io/bef0a1ea-7768-4d5a-b520-c4fe2f7fafad/Images/Documentation/9958660384795.png) > When defining the bucket's retention time, customer requirements and database size need to be considered. Once backups are uploaded to the bucket, they cannot be deleted or modified until after the retention period has expired, and will incur a storage charge. 6. Once the Object Lock-enabled bucket is created, follow the steps in the Backup and Restore on CRDB section to create immutable backups.