Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
1. [Log in](https://cockroachlabs.cloud/) to your CockroachDB {{ site.data.products.cloud }} account.
1. On the **Clusters** page, click **Create Cluster**.
1. On the **Create your cluster** page, select **Serverless**.
1. *(Optional)* Set a **Resource limit**.

Each non-contract CockroachDB {{ site.data.products.cloud }} organization is given 50 million [Request Units](#request-units) and 10 GiB of storage for free each month. If this is your first cluster, you can select **Start for free**.

1. Click **Create cluster**.

Your cluster will be created in a few seconds and the **Create SQL user** dialog will display.
2 changes: 1 addition & 1 deletion src/current/_includes/v21.2/setup/create-first-sql-user.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ The **Create SQL user** dialog allows you to create a new SQL user and password.
1. Copy the generated password and save it in a secure location.
1. Click **Next**.

Currently, all new users are created with full privileges. For more information and to change the default settings, see [[Manage SQL users on a cluster](../cockroachcloud/managing-access.html#manage-sql-users-on-a-cluster).
Currently, all new users are created with full privileges. For more information and to change the default settings, see [Manage SQL users on a cluster](../cockroachcloud/managing-access.html#manage-sql-users-on-a-cluster).
2 changes: 1 addition & 1 deletion src/current/_includes/v22.2/setup/create-first-sql-user.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ The **Create SQL user** dialog allows you to create a new SQL user and password.
1. Copy the generated password and save it in a secure location.
1. Click **Next**.

Currently, all new SQL users are created with admin privileges. For more information and to change the default settings, see [[Manage SQL users on a cluster](../cockroachcloud/managing-access.html#manage-sql-users-on-a-cluster).
Currently, all new SQL users are created with admin privileges. For more information and to change the default settings, see [Manage SQL users on a cluster](../cockroachcloud/managing-access.html#manage-sql-users-on-a-cluster).
4 changes: 4 additions & 0 deletions src/current/_includes/v23.1/setup/create-a-free-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
1. [Log in](https://cockroachlabs.cloud/) to your CockroachDB {{ site.data.products.cloud }} account.
1. On the **Clusters** page, click **Create Cluster**.
1. On the **Create your cluster** page, select **Serverless**.
1. *(Optional)* Set a **Resource limit**.

Each non-contract CockroachDB {{ site.data.products.cloud }} organization is given 50 million [Request Units](#request-units) and 10 GiB of storage for free each month. If this is your first cluster, you can select **Start for free**.

1. Click **Create cluster**.

Your cluster will be created in a few seconds and the **Create SQL user** dialog will display.
2 changes: 1 addition & 1 deletion src/current/_includes/v23.1/setup/create-first-sql-user.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ The **Create SQL user** dialog allows you to create a new SQL user and password.
1. Copy the generated password and save it in a secure location.
1. Click **Next**.

Currently, all new SQL users are created with admin privileges. For more information and to change the default settings, see [[Manage SQL users on a cluster](https://www.cockroachlabs.com/docs/cockroachcloud/managing-access#manage-sql-users-on-a-cluster).
Currently, all new SQL users are created with admin privileges. For more information and to change the default settings, see [Manage SQL users on a cluster](https://www.cockroachlabs.com/docs/cockroachcloud/managing-access#manage-sql-users-on-a-cluster).
4 changes: 4 additions & 0 deletions src/current/_includes/v23.2/setup/create-a-free-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
1. [Log in](https://cockroachlabs.cloud/) to your CockroachDB {{ site.data.products.cloud }} account.
1. On the **Clusters** page, click **Create Cluster**.
1. On the **Create your cluster** page, select **Serverless**.
1. *(Optional)* Set a **Resource limit**.

Each non-contract CockroachDB {{ site.data.products.cloud }} organization is given 50 million [Request Units](#request-units) and 10 GiB of storage for free each month. If this is your first cluster, you can select **Start for free**.

1. Click **Create cluster**.

Your cluster will be created in a few seconds and the **Create SQL user** dialog will display.
2 changes: 1 addition & 1 deletion src/current/_includes/v23.2/setup/create-first-sql-user.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ The **Create SQL user** dialog allows you to create a new SQL user and password.
1. Copy the generated password and save it in a secure location.
1. Click **Next**.

Currently, all new SQL users are created with admin privileges. For more information and to change the default settings, see [[Manage SQL users on a cluster](https://www.cockroachlabs.com/docs/cockroachcloud/managing-access#manage-sql-users-on-a-cluster).
Currently, all new SQL users are created with admin privileges. For more information and to change the default settings, see [Manage SQL users on a cluster](https://www.cockroachlabs.com/docs/cockroachcloud/managing-access#manage-sql-users-on-a-cluster).
2 changes: 1 addition & 1 deletion src/current/cockroachcloud/create-a-serverless-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Private connectivity is not available for {{ site.data.products.serverless }} cl

Your cluster's [resource limits](https://www.cockroachlabs.com/docs/{{site.current_cloud_version}}/architecture/glossary#resource-limits) are the maximum amount of storage and RUs you can use in a month. If you reach your storage limit, your cluster will be throttled and you may only be able to delete data. If you reach your RU limit, your cluster will be disabled until the end of the billing cycle unless you raise the limit.

All CockroachDB {{ site.data.products.cloud }} organizations get 50M RUs and 10 GiB of storage for free each month. Free resources can be spent across all CockroachDB {{ site.data.products.serverless }} clusters in an organization. You can set higher resource limits to maintain a high level of performance with larger workloads. You will only be charged for what you use.
Each non-contract CockroachDB {{ site.data.products.cloud }} organization is given 50 million [Request Units](#request-units) and 10 GiB of storage for free each month. Free resources can be spent across all CockroachDB {{ site.data.products.serverless }} clusters in an organization. You can set higher resource limits to maintain a high level of performance with larger workloads. You will only be charged for what you use.

{% include cockroachcloud/serverless-usage.md %} For more information, see [Planning your cluster]({% link cockroachcloud/plan-your-cluster.md %}).

Expand Down
193 changes: 51 additions & 142 deletions src/current/cockroachcloud/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ referral_id: docs_quickstart_free
docs_area: get_started
---

This page shows you how to use the [CockroachDB {{ site.data.products.cloud }} Console](https://cockroachlabs.cloud) to create a CockroachDB {{ site.data.products.serverless }} cluster and then insert and read some sample data from a Java or Node.js sample application.
This page shows you how to use the [CockroachDB {{ site.data.products.cloud }} Console](https://cockroachlabs.cloud) to create a CockroachDB {{ site.data.products.serverless }} cluster, connect to it using a sample workload, and run your first query.

## Create a CockroachDB {{ site.data.products.serverless }} cluster

Expand All @@ -19,193 +19,102 @@ This page shows you how to use the [CockroachDB {{ site.data.products.cloud }} C

## Connect to the cluster

Select a language to connect a sample application to your cluster. To connect to your cluster directly from the command line, refer to [Connect to a {{ site.data.products.serverless }} Cluster](connect-to-a-serverless-cluster.html?fiters=command-line#connect-to-your-cluster).
You can connect to your cluster directly from the {{ site.data.products.cloud }} Console's SQL Shell or using the command line. To connect a sample application to your cluster instead, refer to [Example Applications Overview](https://www.cockroachlabs.com/docs/{{site.current_cloud_version}}/example-apps.md)

<div class="filters clearfix">
<button class="filter-button" data-scope="java">Java</button>
<button class="filter-button" data-scope="node">Node.js</button>
<button class="filter-button" data-scope="console">Cloud Console</button>
<button class="filter-button" data-scope="cli">Command line</button>
</div>
<section class="filter-content" markdown="1" data-scope="java">

Once you create a SQL user, the **Connect to cluster** dialog will show information about how to connect to your cluster.

1. Select **Java** from the **Select option/language** dropdown.
1. Copy the `JDBC_DATABASE_URL` environment variable command provided and save it in a secure location.

This Quickstart uses default certificates, so you can skip the Download CA Cert instructions.

{{site.data.alerts.callout_info}}
The connection string is pre-populated with your username, password, cluster name, and other details. Your password, in particular, will be provided *only* once. Save it in a secure place (Cockroach Labs recommends a password manager) to connect to your cluster in the future. If you forget your password, a Cluster Administrator can reset it. Refer to: [Managing SQL users on a cluster]({% link cockroachcloud/managing-access.md %}#manage-sql-users-on-a-cluster)
{{site.data.alerts.end}}

## Configure the connection environment variable

<div class="filters clearfix">
<button class="filter-button" data-scope="mac">Mac</button>
<button class="filter-button" data-scope="linux">Linux</button>
<button class="filter-button" data-scope="windows">Windows</button>
</div>
<section class="filter-content" markdown="1" data-scope="console">

<section class="filter-content" markdown="1" data-scope="mac linux">
In a terminal set the `JDBC_DATABASE_URL` environment variable to the JDBC connection string:
{{site.data.alerts.callout_info}}
The SQL Shell is available only to team members with the [Cluster Administrator role]({% link cockroachcloud/managing-access.md %}).
{{site.data.alerts.end}}

{% include_cached copy-clipboard.html %}
~~~ shell
export JDBC_DATABASE_URL="<jdbc-connection-string>"
~~~

The code sample uses the connection string stored in the environment variable `JDBC_DATABASE_URL` to connect to your cluster.
</section>

<section class="filter-content" markdown="1" data-scope="windows">
In a terminal set the `JDBC_DATABASE_URL` environment variable to the JDBC connection string:

{% include_cached copy-clipboard.html %}
~~~ shell
$env:JDBC_DATABASE_URL = "<jdbc-connection-string>"
~~~

The code sample uses the connection string stored in the environment variable `JDBC_DATABASE_URL` to connect to your cluster.
1. Close the **Connect to cluster** dialog that displays once you create a SQL user.
1. From the cluster's **Overview** page, navigate to the **SQL Shell**.

</section>
<section class="filter-content" markdown="1" data-scope="cli">

## Run the Java sample code

1. Clone the `quickstart-code-samples` repo:
Once you create a SQL user, the **Connect to cluster** dialog will show information about how to connect to your cluster.

1. Select **CockroachDB Client** from the **Select option** dropdown.
1. In a terminal, run the command provided in the **Download the latest CockroachDB Client** section of the dialog to install CockroachDB.
1. Expand the **Connect to the database** section, then copy the `cockroach sql` command provided and save it in a secure location.

{% include_cached copy-clipboard.html %}
~~~ shell
git clone https://github.com/cockroachdb/quickstart-code-samples
~~~

1. Navigate to the `java` directory of the repo:

{% include_cached copy-clipboard.html %}
~~~ shell
cd quickstart-code-samples/java
cockroach sql --url "postgresql://{user}@{host}:{port}/defaultdb?sslmode=verify-full"
~~~

The code sample in this directory does the following:
1. Connects to CockroachDB {{ site.data.products.cloud }} with the [JDBC driver](https://jdbc.postgresql.org) using the JDBC connection string set in the `JDBC_DATABASE_URL` environment variable.
1. Creates a table.
1. Inserts some data into the table.
1. Reads the inserted data.
1. Prints the data to the terminal.
1. In your terminal, enter the copied `cockroach sql` command and connection string to start the [built-in SQL client](https://www.cockroachlabs.com/docs/{{site.current_cloud_version}}/cockroach-sql.html).

1. Run the application using `gradlew`:
1. Enter the SQL user's password and hit enter.

{% include_cached copy-clipboard.html %}
~~~ shell
./gradlew run
~~~
{% include cockroachcloud/postgresql-special-characters.md %}

The output should look like this:
A welcome message displays:

~~~
> Task :app:run
Hello world!

BUILD SUCCESSFUL in 3s
2 actionable tasks: 2 executed
#
# Welcome to the CockroachDB SQL shell.
# All statements must be terminated by a semicolon.
# To exit, type: \q.
#
~~~

</section>
<section class="filter-content" markdown="1" data-scope="node">

Once you create a SQL user, the **Connect to cluster** dialog will show information about how to connect to your cluster.

1. Select **General connection string** from the **Select option** dropdown.
1. Open the **General connection string** section, then copy the connection string provided and save it in a secure location.

This Quickstart uses default certificates, so you can skip the Download CA Cert instructions.

{{site.data.alerts.callout_info}}
The connection string is pre-populated with your username, password, cluster name, and other details. Your password, in particular, will be provided *only* once. Save it in a secure place (Cockroach Labs recommends a password manager) to connect to your cluster in the future. If you forget your password, a Cluster Administrator can reset it. Refer to: [Managing SQL users on a cluster]({% link cockroachcloud/managing-access.md %}#manage-sql-users-on-a-cluster)
{{site.data.alerts.end}}
## Run SQL statements

## Configure the connection environment variable

<div class="filters clearfix">
<button class="filter-button" data-scope="mac">Mac</button>
<button class="filter-button" data-scope="linux">Linux</button>
<button class="filter-button" data-scope="windows">Windows</button>
</div>

<section class="filter-content" markdown="1" data-scope="mac linux">
In a terminal set the `DATABASE_URL` environment variable to the connection string:

{% include_cached copy-clipboard.html %}
~~~ shell
export DATABASE_URL="<connection-string>"
~~~

The code sample uses the connection string stored in the environment variable `DATABASE_URL` to connect to your cluster.
</section>

<section class="filter-content" markdown="1" data-scope="windows">
In a terminal set the `DATABASE_URL` environment variable to the connection string:

{% include_cached copy-clipboard.html %}
~~~ shell
$env:DATABASE_URL = "<connection-string>"
~~~

The code sample uses the connection string stored in the environment variable `DATABASE_URL` to connect to your cluster.
</section>

## Run the Node.js sample code

1. Clone the `quickstart-code-samples` repo:
1. You can now run [CockroachDB SQL statements]({% link cockroachcloud/learn-cockroachdb-sql.md %}):

{% include_cached copy-clipboard.html %}
~~~ shell
git clone https://github.com/cockroachdb/quickstart-code-samples
~~~ sql
> CREATE DATABASE bank;
~~~

1. Navigate to the `node` directory of the repo:

{% include_cached copy-clipboard.html %}
~~~ shell
cd quickstart-code-samples/node
~~~ sql
> CREATE TABLE bank.accounts (id INT PRIMARY KEY, balance DECIMAL);
~~~

The code sample in this directory does the following:
1. Connects to CockroachDB {{ site.data.products.cloud }} with the [node-postgres driver](https://node-postgres.com) using the connection string set in the `DATABASE_URL` environment variable.
1. Creates a table.
1. Inserts some data into the table.
1. Reads the inserted data.
1. Prints the data to the terminal.


1. Install the app requirements:

{% include_cached copy-clipboard.html %}
~~~ shell
$ npm install
~~~ sql
> INSERT INTO bank.accounts VALUES (1, 1000.50);
~~~

1. Run the app:

{% include_cached copy-clipboard.html %}
~~~ shell
$ node app.js
~~~ sql
> SELECT * FROM bank.accounts;
~~~

The output will look like this:


~~~
Hello world!
id | balance
-----+----------
1 | 1000.50
(1 row)
~~~

</section>
<section class="filter-content" markdown="1" data-scope="cli">
1. To exit the SQL shell:

{% include_cached copy-clipboard.html %}
~~~ sql
> \q
~~~
</section>

## Learn more

Now that you have a free CockroachDB {{ site.data.products.serverless }} cluster running, try out the following:

- Build a simple CRUD application in [Go](https://www.cockroachlabs.com/docs/{{site.current_cloud_version}}/build-a-go-app-with-cockroachdb), [Java](https://www.cockroachlabs.com/docs/{{site.current_cloud_version}}/build-a-java-app-with-cockroachdb), [Node.js](https://www.cockroachlabs.com/docs/{{site.current_cloud_version}}/build-a-nodejs-app-with-cockroachdb), or [Python](https://www.cockroachlabs.com/docs/{{site.current_cloud_version}}/build-a-python-app-with-cockroachdb).
- [Learn CockroachDB SQL]({% link cockroachcloud/learn-cockroachdb-sql.md %}).
- [Create and manage SQL users]({% link cockroachcloud/managing-access.md %}).
- Explore our [example apps](https://www.cockroachlabs.com/docs/{{site.current_cloud_version}}/example-apps) for examples on how to build applications using your preferred driver or ORM and run it on CockroachDB.
- Explore our [example apps](https://www.cockroachlabs.com/docs/{{site.current_cloud_version}}/example-apps.md) for examples on how to build applications using your preferred driver or ORM and run it on CockroachDB.
- [Migrate your existing data](https://www.cockroachlabs.com/docs/{{site.current_cloud_version}}/migration-overview).

This page highlights just one way you can get started with CockroachDB. For information on other options that are available when creating a CockroachDB cluster, see the following:
Expand Down