Skip to main content
This quickstart shows you how to deploy a CockroachDB cluster using free trial credits and run your first queries.

Before You Begin

You’ll need:
  • A CockroachDB Cloud account (sign up at cockroachlabs.cloud)
  • A modern web browser
  • (Optional) Command-line access for SQL client connection

Create a Free Trial Cluster

1

Sign Up

Navigate to cockroachlabs.cloud and create a new account or sign in with SSO.
2

Start Cluster Creation

Click Create Cluster from the Clusters page.
3

Select Plan

Choose Standard plan (recommended for trial) and click Next.
4

Configure Cluster

  • Cloud Provider: Select AWS or GCP
  • Regions: Choose a region close to you
  • Capacity: Use default settings (4-8 vCPUs recommended)
5

Apply Trial Credits

The 30-day trial code is automatically applied. Verify you see the trial credit on the summary.
6

Name and Create

Give your cluster a name and click Create cluster. Your cluster will be ready in 20-30 seconds.
Your trial includes $400 in credits, valid for 30 days. Be sure to delete your trial cluster before the trial expires to avoid charges.

Create a SQL User

Before connecting to your cluster, you need to create a SQL user.
1

Navigate to SQL Users

From your cluster’s Overview page, click SQL Users in the left navigation.
2

Add New User

Click Add User and enter:
  • Username: Choose a username (e.g., myuser)
  • Password: Create a strong password
3

Save Credentials

Click Create and save your password securely. You won’t be able to view it again.

Authorize Your Network

CockroachDB Cloud requires you to authorize networks that can connect to your cluster.
1

Go to Networking

Click Networking in the left navigation.
2

Add Your IP

Click Add Network and select Current Network to automatically add your current IP address.
3

Configure Access

  • Give it a descriptive name (e.g., “My Office”)
  • Select CockroachDB Client to allow SQL connections
  • Click Apply
For production use, remove the 0.0.0.0/0 allowlist entry and add only specific IP ranges your applications will use.

Connect to Your Cluster

You can connect to your cluster using the cockroach SQL client or any PostgreSQL-compatible driver.

Using CockroachDB SQL Client

1

Download the Client

Download the CockroachDB binary for your operating system from the Connect dialog.
# On macOS
curl https://binaries.cockroachdb.com/cockroach-latest.darwin-10.9-amd64.tgz | tar -xz

# On Linux
curl https://binaries.cockroachdb.com/cockroach-latest.linux-amd64.tgz | tar -xz
2

Get Connection String

Click Connect in the Console and select CockroachDB Client. Copy the connection command provided.
3

Connect

Run the connection command in your terminal:
cockroach sql --url "postgresql://myuser:[email protected]:26257/defaultdb?sslmode=verify-full"

Using Application Connection

For connecting from your application, select your language from the Connect dialog:
const { Client } = require('pg');

const client = new Client({
  connectionString: process.env.DATABASE_URL,
});

client.connect();

Run Your First Query

Once connected, try running some SQL commands:
-- Create a database
CREATE DATABASE bank;

-- Use the database
USE bank;

-- Create a table
CREATE TABLE accounts (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  balance DECIMAL(10,2)
);

-- Insert data
INSERT INTO accounts (balance) VALUES (1000.50), (2500.75), (500.00);

-- Query data
SELECT * FROM accounts;
You should see output like:
                   id                  | balance
---------------------------------------+----------
  3a8b9c7d-1234-5678-90ab-cdef12345678 | 1000.50
  4b9c8d7e-2345-6789-01bc-def123456789 | 2500.75
  5c0d9e8f-3456-7890-12cd-ef1234567890 |  500.00
(3 rows)

Monitor Your Cluster

You can monitor your cluster’s performance in the Cloud Console:
  • Overview: View cluster health and key metrics
  • Metrics: Detailed performance charts
  • SQL Activity: Monitor queries and transactions
  • Insights: Performance recommendations

Clean Up

When you’re done experimenting:
1

Disable Deletion Protection

Navigate to the cluster’s Overview page and disable deletion protection if enabled.
2

Delete the Cluster

Click Actions > Delete cluster and confirm.
Deleting a cluster permanently removes all data. Make sure to back up any important data before deletion.

Next Steps

Build an App

Build a sample application

Migrate Data

Migrate your existing data

Learn SQL

Learn CockroachDB SQL

Manage Users

Create and manage SQL users

Build docs developers (and LLMs) love