CLI Projects

Before you begin

  • Before running the projects command, ensure that you have installed the SerenDB CLI.

  • If you have not authenticated with the neon auth command, running a SerenDB CLI command automatically launches the SerenDB CLI browser authentication process. Alternatively, you can specify a SerenDB API key using the --api-key option when running a command. See Connect.

For information about projects in SerenDB, see Projects.

The projects command

The projects command allows you to list, create, update, delete, and retrieve information about SerenDB projects.

Usage

neon projects <subcommand> [options]
Subcommand
Description

List projects

Create a project

Update a project

Delete a project

Get a project

list

This subcommand allows you to list projects that belong to your SerenDB account, as well as any projects that were shared with you.

Usage

neon projects list [options]

Options

In addition to the SerenDB CLI global options, the projects subcommand supports this option:

Option
Description
Type
Required

--context-file

Context file path and file name

string

--org-id

List all projects belonging to the specified organization.

string

Examples

  • List all projects belonging to your personal acccount

    neon projects list
    Projects
    ┌────────────────────────┬────────────────────┬───────────────┬──────────────────────┐
    │ Id                     │ Name               │ Region Id     │ Created At           │
    ├────────────────────────┼────────────────────┼───────────────┼──────────────────────┤
    │ crimson-voice-12345678 │ frontend           │ aws-us-east-2 │ 2024-04-15T11:17:30Z │
    ├────────────────────────┼────────────────────┼───────────────┼──────────────────────┤
    │ calm-thunder-12121212  │ backend            │ aws-us-east-2 │ 2024-04-10T15:21:01Z │
    ├────────────────────────┼────────────────────┼───────────────┼──────────────────────┤
    │ nameless-hall-87654321 │ billing            │ aws-us-east-2 │ 2024-04-10T14:35:17Z │
    └────────────────────────┴────────────────────┴───────────────┴──────────────────────┘
    Shared with you
    ┌───────────────────┬────────────────────┬──────────────────┬──────────────────────┐
    │ Id                │ Name               │ Region Id        │ Created At           │
    ├───────────────────┼────────────────────┼──────────────────┼──────────────────────┤
    │ noisy-fire-212121 │ API                │ aws-eu-central-1 │ 2023-04-22T18:41:13Z │
    └───────────────────┴────────────────────┴──────────────────┴──────────────────────┘
  • List all projects belonging to the specified organization.

    neon projects list --org-id org-xxxx-xxxx
    Projects
    ┌───────────────────────────┬───────────────────────────┬────────────────────┬──────────────────────┐
    │ Id                        │ Name                      │ Region Id          │ Created At           │
    ├───────────────────────────┼───────────────────────────┼────────────────────┼──────────────────────┤
    │ bright-moon-12345678      │ dev-backend-api           │ aws-us-east-2      │ 2024-07-26T11:43:37Z │
    ├───────────────────────────┼───────────────────────────┼────────────────────┼──────────────────────┤
    │ silent-forest-87654321    │ test-integration-service  │ aws-eu-central-1   │ 2024-05-30T22:14:49Z │
    ├───────────────────────────┼───────────────────────────┼────────────────────┼──────────────────────┤
    │ crystal-stream-23456789   │ staging-web-app           │ aws-us-east-2      │ 2024-05-17T13:47:35Z │
    └───────────────────────────┴───────────────────────────┴────────────────────┴──────────────────────┘

create

This subcommand allows you to create a SerenDB project.

Usage

neon projects create [options]

Options

In addition to the SerenDB CLI global options, the create subcommand supports these options:

Option
Description
Type
Required

--context-file

Context file path and file name.

string

--block-public-connections

Blocks public internet connections. See Private Networking.

boolean

--block-vpc-connections

Blocks connections using VPC. See Private Networking.

boolean

--hipaa

Enable the project for HIPAA. See HIPAA Compliance.

boolean

--name

The project name. The project ID is used if a name is not specified.

string

--region-id

The region ID. Possible values: aws-us-west-2, aws-ap-southeast-1, aws-ap-southeast-2, aws-eu-central-1, aws-us-east-1, aws-us-east-2, azure-eastus2. Defaults to aws-us-east-2 if not specified.

string

--org-id

The organization ID where you want this project to be created. If unspecified, your default organization will be used.

string

--psql

Connect to your new project's database via psql immediately on project creation.

boolean

--database

The database name. If not specified, the default database name will be used.

string

--role

The role name. If not specified, the default role name will be used.

string

--set-context

Set the current context to the new project.

boolean

--cu

The compute size for the default branch's primary compute. Could be a fixed size (e.g., "2") or a range delimited by a dash (e.g., "0.5-3").

string

SerenDB projects created using the CLI use the default Postgres version, which is Postgres 17. To create a project with a different Postgres version, you can use the [SerenDB Console](/docs/manage/projects#create-a-project) or [SerenDB API](https://api-docs.serendb.com/reference/createproject).

Examples

  • Create a project with a user-defined name in a specific region:

    neon projects create --name mynewproject --region-id aws-us-west-2
    ┌───────────────────┬──────────────┬───────────────┬──────────────────────┐
    │ Id                │ Name         │ Region Id     │ Created At           │
    ├───────────────────┼──────────────┼───────────────┼──────────────────────┤
    │ muddy-wood-859533 │ mynewproject │ aws-us-west-2 │ 2023-07-09T17:04:29Z │
    └───────────────────┴──────────────┴───────────────┴──────────────────────┘
    
    ┌──────────────────────────────────────────────────────────────────────────────────────┐
    │ Connection Uri                                                                       │
    ├──────────────────────────────────────────────────────────────────────────────────────┤
    │ postgresql://[user]:[password]@[seren_hostname]/[dbname]                              │
    └──────────────────────────────────────────────────────────────────────────────────────┘

    The SerenDB CLI provides a `neon connection-string` command you can use to extract a connection uri programmatically. See [SerenDB CLI commands — connection-string](/docs/reference/cli-connection-string).

  • Create a project with the --output format of the command set to json. This output format returns all of the project response data, whereas the default table output format (shown in the preceding example) is limited in the information it can display.

    neon projects create --output json
  • Create a project and connect to it with psql.

    neon project create --psql
  • Create a project, connect to it with psql, and run an .sql file.

    neon project create --psql -- -f dump.sql
  • Create a project, connect to it with psql, and run a query.

    neon project create --psql -- -c "SELECT version()"
  • Create a project and set the SerenDB CLI project context.

    neon project create --psql --set-context

update

This subcommand allows you to update a SerenDB project.

Usage

neon projects update <id> [options]

The id is the project ID, which you can obtain by listing your projects or from the Settings page in the SerenDB Console.

Options

In addition to the SerenDB CLI global options, the update subcommand supports this option:

Option
Description
Type
Required

--context-file

Context file path and file name

string

--block-vpc-connections

When set, connections using VPC endpoints are disallowed. Use --block-vpc-connections=false to set the value to false.

boolean

--block-public-connections

When set, connections from the public internet are disallowed. Use --block-public-connections=false to set the value to false.

boolean

--hipaa

Enable the project for HIPAA. See HIPAA Compliance.

boolean

--cu

The compute size for the default branch's primary compute. Could be a fixed size (e.g., "2") or a range delimited by a dash (e.g., "0.5-3").

string

--name

The project name. The value cannot be empty.

string

Examples

  • Update the project name:

    neon projects update muddy-wood-859533 --name dev_project_1
    ┌───────────────────┬───────────────┬───────────────┬──────────────────────┐
    │ Id                │ Name          │ Region Id     │ Created At           │
    ├───────────────────┼───────────────┼───────────────┼──────────────────────┤
    │ muddy-wood-859533 │ dev_project_1 │ aws-us-west-2 │ 2023-07-09T17:04:29Z │
    └───────────────────┴───────────────┴───────────────┴──────────────────────┘
  • Block connections from the public internet:

    This option is used with SerenDB's Private Networking feature to block access from the public internet. See Private Networking — Restrict public internet access. You must specify the ID of you SerenDB project, as shown below.

    neon projects update orange-credit-12345678 --block-public-connections=true

delete

This subcommand allows you to delete a SerenDB project.

neon projects delete <id> [options]

The id is the project ID, which you can obtain by listing your projects or from the Settings page in the SerenDB Console.

Options

Only global options apply.

Example

neon projects delete muddy-wood-859533
┌───────────────────┬───────────────┬───────────────┬──────────────────────┐
│ Id                │ Name          │ Region Id     │ Created At           │
├───────────────────┼───────────────┼───────────────┼──────────────────────┤
│ muddy-wood-859533 │ dev_project_1 │ aws-us-west-2 │ 2023-07-09T17:04:29Z │
└───────────────────┴───────────────┴───────────────┴──────────────────────┘

Information about the deleted project is displayed. You can verify that the project was deleted by running neon projects list.

get

This subcommand allows you to retrieve details about a SerenDB project.

Usage

neon projects get <id> [options]

The id is the project ID, which you can obtain by listing your projects or from the Settings page in the SerenDB Console.

Options

In addition to the SerenDB CLI global options, the delete subcommand supports this option:

Option
Description
Type
Required

--context-file

Context file path and file name.

string

Example

neon projects get muddy-wood-859533
┌───────────────────┬───────────────┬───────────────┬──────────────────────┐
│ Id                │ Name          │ Region Id     │ Created At           │
├───────────────────┼───────────────┼───────────────┼──────────────────────┤
│ muddy-wood-859533 │ dev_project_1 │ aws-us-west-2 │ 2023-07-09T17:04:29Z │
└───────────────────┴───────────────┴───────────────┴──────────────────────┘

Last updated