Automate schema migrations using DizzleORM and GitHub Actions - Manage thousands of tenants with this workflow

Manage Organizations using the Neon CLI

Beta

This feature is in Beta. Please give us Feedback from the Neon Console or by connecting with us on Discord.

Neon's CLI (neonctl) provides an expanding set of commands to manage your organizations.

Authorization

Use the auth command to authenticate your Neon account from the CLI. This command opens a browser where you will be asked to grant the necessary permissions to managae both your personal and organization resources.

Note that authentication is tied to your personal account. Once authenticated, you can access and manage any Organizations that you belong to.

See Auth - CLI to learn more.

List Organizations

The neonctl orgs list command outputs a list of all organizations that the CLI user currently belongs to. This command is useful for quickly identifying the org_id associated with each organization, which can be used in other CLI operations.

Example:

neon orgs list
Organizations
┌────────────────────────┬──────────────────┐
 Id Name
├────────────────────────┼──────────────────┤
 org-ocean-art-12345678 Example Org
└────────────────────────┴──────────────────┘

See Orgs - CLI to learn more.

Manage projects within an Organization

The Neon CLI projects command supports an --org-id option. This allows you to list or create projects within a specified organization.

Example: Listing all projects in an 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
└───────────────────────────┴───────────────────────────┴────────────────────┴──────────────────────┘

You can include the org-id to apply the following subcommands specifically to your organization:

See Projects - CLI to learn more.

Setting Organization Context

To simplify your workflow, the Neon CLI set-context command supports setting an organization context. This means you don't have to specify an organization ID every time you run a CLI command.

Sees set-context - CLI to learn more.

Last updated on

Was this page helpful?