Skip to main content
Build your agent on Neon and provision backends you fully control. See how Ideavo does it
/APIs & SDKs/Projects and branches/postgres

Neon CLI command: postgres

Manage computes, databases, and roles, and connect to Lakebase Postgres, from one command group

View as Markdown

The postgres command groups the commands that work with Lakebase Postgres in a Neon project: computes, databases, roles, connection strings, and psql. Its aliases are pg and lakebase, so neon pg roles list and neon lakebase roles list work too.

computes is only available under postgres. The other subcommands run the same command as their top-level spelling, so neon postgres roles list and neon roles list do the same thing. Both spellings work.

If --project-id is omitted, the CLI resolves it from your context file, auto-selects when your account has only one project, and otherwise asks you to pass --project-id.

Subcommands: computes, connection-string, databases, psql, roles

neon postgres computes

Manages the computes in a Neon project. Aliases: compute, endpoints, and endpoint. For background, see Manage computes.

neon postgres computes <sub-command> [options]
OptionDescriptionTypeDefaultRequired
--project-idProject IDstring—No

Subcommands: delete, get, list, restart, start, suspend, update

update, start, suspend, restart, and delete wait until the change is applied. Pass --no-wait to return as soon as the API accepts the request. To add a compute, use neon branches add-compute.

neon postgres computes list

Lists computes. With --branch, or when your .neon context file pins a branch, it lists that branch's computes. Otherwise it lists every compute in the project. --all-branches lists every compute in the project even when .neon pins a branch.

neon postgres computes list [options]
OptionDescriptionTypeDefaultRequired
--all-branchesList every compute in the project, ignoring --branch and the branch .neon pinsbooleanfalseNo
--branchBranch ID or namestring—No
--project-idProject IDstring—No
neon postgres computes list --branch main
Output
Computes on main
ID                      Branch ID                  Type        Current State  Autoscaling Limit Min Cu  Autoscaling Limit Max Cu
ep-cool-king-123456     br-lively-sunset-123456    read_write  active         0.25                      2

neon postgres computes get

Shows a compute's details, including its host, state, autoscaling limits, and scale-to-zero timeout.

neon postgres computes get <id> [options]
OptionDescriptionTypeDefaultRequired
--project-idProject IDstring—No
neon postgres computes get ep-cool-king-123456
Show output
ID                        ep-cool-king-123456
Branch ID                 br-lively-sunset-123456
Type                      read_write
Current State             active
Host                      ep-cool-king-123456.us-east-2.aws.neon.tech
Region ID                 aws-us-east-2
Autoscaling Limit Min Cu  0.25
Autoscaling Limit Max Cu  2
Suspend Timeout Seconds   600
Disabled                  false
Last Active               2026-11-05T14:46:05Z
Created At                2026-11-05T14:46:01Z

neon postgres computes update

Changes a compute's size, scale-to-zero timeout, name, or connection access. It sends only the options you pass, and fails if you pass none. When the change is applied, it prints the compute.

neon postgres computes update <id> [options]
OptionDescriptionTypeDefaultRequired
--cuThe number of Compute Units. Could be a fixed size (e.g. "2") or a range delimited by a dash (e.g. "0.5-3").string—No
--disabledRestrict connections to the compute. Disabling schedules a suspend. Use --disabled=false to allow connections again.boolean—No
--nameName of the computestring—No
--suspend-timeoutScale-to-zero idle timeout, in seconds, before the compute suspends. 0 uses the plan default; -1 disables scale-to-zero (never suspends). Minimum is plan-dependent (Scale: 60); maximum 604800 (one week). Free cannot change it; Launch can only enable or disable; Scale can set any value.number—No
--waitWait until the change is applied. Use --no-wait to return as soon as the API accepts itbooleantrueNo
--project-idProject IDstring—No

Set autoscaling to 0.25 to 2 compute units (CU) and suspend after 10 minutes of inactivity:

neon postgres computes update ep-cool-king-123456 --cu 0.25-2 --suspend-timeout 600

--disabled restricts connections to the compute and schedules a suspend. Pass --disabled=false to allow connections again:

neon postgres computes update ep-cool-king-123456 --disabled=false

neon postgres computes start

Starts a suspended compute and prints it once it's active.

neon postgres computes start <id> [options]
OptionDescriptionTypeDefaultRequired
--waitWait until the change is applied. Use --no-wait to return as soon as the API accepts itbooleantrueNo
--project-idProject IDstring—No
neon postgres computes start ep-cool-king-123456

neon postgres computes suspend

Suspends a compute and prints it once it's idle.

neon postgres computes suspend <id> [options]
OptionDescriptionTypeDefaultRequired
--waitWait until the change is applied. Use --no-wait to return as soon as the API accepts itbooleantrueNo
--project-idProject IDstring—No
neon postgres computes suspend ep-cool-king-123456

neon postgres computes restart

Restarts a compute and prints it once it's back up.

neon postgres computes restart <id> [options]
OptionDescriptionTypeDefaultRequired
--waitWait until the change is applied. Use --no-wait to return as soon as the API accepts itbooleantrueNo
--project-idProject IDstring—No
neon postgres computes restart ep-cool-king-123456

With --no-wait, the output says the restart was accepted but not yet applied:

Output
Compute ep-cool-king-123456: restart accepted, not yet applied

neon postgres computes delete

Deletes a compute, such as a read replica you no longer need, and prints a confirmation.

neon postgres computes delete <id> [options]
OptionDescriptionTypeDefaultRequired
--waitWait until the change is applied. Use --no-wait to return as soon as the API accepts itbooleantrueNo
--project-idProject IDstring—No
neon postgres computes delete ep-divine-tree-123456
Output
Compute ep-divine-tree-123456 deleted

neon postgres databases

Lists, creates, and deletes databases. It's the same command as neon databases, which documents its subcommands and options.

neon postgres databases <sub-command> [options]
neon postgres databases list

neon postgres roles

Lists, inspects, creates, and deletes roles, and resets their passwords. It's the same command as neon roles, which documents its subcommands and options.

neon postgres roles <sub-command> [options]
neon postgres roles list

neon postgres connection-string

Prints a connection string for a branch. Alias: cs. It's the same command as neon connection-string, which documents its options.

neon postgres connection-string [branch] [options]
neon pg cs main

neon postgres psql

Opens a psql session on a branch. It's the same command as neon psql, which documents its options.

neon postgres psql [branch] [options] [-- psql-args]
neon postgres psql main -- -c "SELECT version()"
Was this page helpful?
Edit on GitHub