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 neonctl 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.
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 |
Example
create
This subcommand allows you to create a Neon project.
The Neon Free Tier supports creating a single project. The Neon Pro Plan allows creating multiple projects.
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-eu-central-1 , aws-us-east-2 , aws-us-east-1 . Defaults to aws-us-east-2 if not specified. | string number | |
--psql | Connect to a database via psql using connection string. psql must be installed to use this option. | boolean | |
--set-context | Set the current context to the new project. The default is false . | boolean |
Examples
-
Create a project with a user-defined name in a specific region:
tip
The Neon CLI provides a
neonctl 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 and branch 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 | ✓ |
--ip-allow | A list of IP addresses that are allowed to connect to the endpoint | string | |
--ip-primary-only | If true, the list will be applied only to the primary branch. The deafault value is false . | boolean |
Examples
Update the project name:
Update the IP allowlist. Multiple values are specified as a list without a delimiter.
Apply the IP allowlist to the primary branch only:
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 neonctl 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. Neon Pro Plan users can open a support ticket from the console. For more detail, see Getting Support.
Last updated on