Autoscaling Report: Production databases on Neon use 2.4x less compute and 50% less cost than if they were running on a provisioned platform.
/CLI/buckets

Neon CLI command: buckets

Manage branch object-storage buckets and their objects

Private Preview

This feature is in private preview: it's not ready for production use, and it may be briefly unavailable as we deploy updates. To get access, sign up here.

The buckets command manages branch object-storage buckets and their objects. Buckets belong to a branch; the object subcommands work with the objects inside a bucket.

Subcommands: create, delete, list, object

neon buckets create

Creates a bucket on a branch.

neon bucket create <name> [options]
OptionDescriptionTypeDefaultRequired
--access-levelThe visibility of the bucket Possible values: private, public_readstringprivateNo
--branchBranch ID or namestringNo
--project-idProject IDstringNo

Create a private bucket on a branch:

neon buckets create my-bucket --access-level private

neon buckets list

Lists the buckets on a branch.

neon bucket list [options]
OptionDescriptionTypeDefaultRequired
--project-idProject IDstringNo

List the buckets on a branch with json output:

neon buckets list --output json

neon buckets delete

Deletes a bucket from a branch.

neon bucket delete <name> [options]
OptionDescriptionTypeDefaultRequired
--project-idProject IDstringNo
neon buckets delete my-bucket

Bucket objects

Lists, downloads, uploads, or deletes objects in a bucket.

Subcommands: delete, get, list, put

neon buckets object list

Lists objects in a bucket.

neon bucket object list <bucket>[/<prefix>] [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--cursorPagination cursor returned as next_cursor by a previous callstringNo
--delimiterCollapse keys sharing this prefix separator into folders. Defaults to "/" (folder view); ignored when --recursive is setstringNo
--limitMaximum number of items (objects + folders) to returnnumberNo
--project-idProject IDstringNo
--recursiveList every key flat, descending into nested folders (no delimiter). Mutually exclusive with --delimiter. Mirrors "aws s3 ls --recursive"booleanfalseNo

List the objects under a prefix, collapsing keys into folders:

neon buckets object list my-bucket/images --delimiter /

neon buckets object get

Downloads an object from a bucket to a local file.

neon bucket object get <bucket>/<key> [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--filePath to write the downloaded object to (defaults to the object filename in the current directory)stringNo
--project-idProject IDstringNo
neon buckets object get my-bucket/images/logo.png --file ./logo.png

neon buckets object put

Uploads a local file to a bucket as an object.

neon bucket object put <bucket>/<key> [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--content-typeContent-Type to store the object with (e.g. text/plain)stringNo
--filePath to the local file to uploadstringYes
--project-idProject IDstringNo

Upload a file, optionally setting the Content-Type to store it with:

neon buckets object put my-bucket/images/logo.png --file ./logo.png
neon buckets object put my-bucket/notes/readme.txt --file ./readme.txt --content-type text/plain

neon buckets object delete

Deletes an object, or every object under a prefix.

neon bucket object delete <bucket>/<key> [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestringNo
--project-idProject IDstringNo
--recursiveDelete every object under the given prefix. The prefix must end with "/"booleanfalseNo

With --recursive, the target is treated as a prefix, which must end with /.

Delete a single object, or every object under a prefix:

neon buckets object delete my-bucket/images/logo.png
neon buckets object delete my-bucket/images/ --recursive
Was this page helpful?
Edit on GitHub

On this page

Copy neon init command