Neon CLI commands — projects
Use the Neon CLI to manage Neon directly from the terminal
Before you begin
- Before running the
projects
command, ensure that you have installed the Neon CLI. - If you have not authenticated with the neon auth command, running a Neon CLI command automatically launches the Neon CLI browser authentication process. Alternatively, you can specify a Neon API key using the
--api-key
option when running a command. See Connect.
For information about projects in Neon, see Projects.
projects
command
The The projects
command allows you to list, create, update, delete, and retrieve information about Neon projects.
Usage
Subcommand | Description |
---|---|
list | List projects |
create | Create a project |
update | Update a project |
delete | Delete a project |
get | Get a project |
list
This subcommand allows you to list projects that belong to your Neon account, as well as any projects that were shared with you.
Usage
Options
In addition to the Neon 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. If unspecified, personal account projects are listed instead. | string |
Examples
-
List all projects belonging to your personal acccount
-
List all projects belonging to the specified organization.
create
This subcommand allows you to create a Neon project.
Usage
Options
In addition to the Neon CLI global options, the create
subcommand supports these options:
Option | Description | Type | Required |
---|---|---|---|
--context-file | Context file path and file name. | string | |
--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, the project is created in your personal account. | 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 |
Examples
-
Create a project with a user-defined name in a specific region:
tip
The Neon CLI provides a
neon connection-string
command you can use to extract a connection uri programmatically. See Neon CLI commands — connection-string. -
Create a project with the
--output
format of the command set tojson
. This output format returns all of the project response data, whereas the defaulttable
output format (shown in the preceding example) is limited in the information it can display.Example output
-
Create a project and connect to it with
psql
. -
Create a project, connect to it with
psql
, and run an.sql
file. -
Create a project, connect to it with
psql
, and run a query. -
Create a project and set the Neon CLI project context.
update
This subcommand allows you to update a Neon project.
Usage
The id
is the project ID, which you can obtain by listing your projects or from the Settings page in the Neon Console.
Options
In addition to the Neon CLI global options, the update
subcommand supports this option:
Option | Description | Type | Required |
---|---|---|---|
--context-file | Context file path and file name | string | |
--name | The project name. The value cannot be empty. | string | ✓ |
Examples
Update the project name:
delete
This subcommand allows you to delete a Neon project.
The id
is the project ID, which you can obtain by listing your projects or from the Settings page in the Neon Console.
Options
Only global options apply.
Example
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 Neon project.
Usage
The id
is the project ID, which you can obtain by listing your projects or from the Settings page in the Neon Console.
Options
In addition to the Neon CLI global options, the delete
subcommand supports this option:
Option | Description | Type | Required |
---|---|---|---|
--context-file | Context file path and file name. | string |
Example
Need help?
Join our Discord Server to ask questions or see what others are doing with Neon. Users on paid plans can open a support ticket from the console. For more details, see Getting Support.