|Docs

railway bucket

Manage storage buckets for your project.

Usage

railway bucket <COMMAND> [OPTIONS]

Aliases

  • railway buckets

Global options

FlagDescription
-e, --environment <ENV>Environment name or ID
-b, --bucket <BUCKET>Bucket name or ID (used by delete, info, credentials, rename)
railway bucket -b my-bucket -e production info

Subcommands

SubcommandAliasesDescription
listlsList buckets
createadd, newCreate a new bucket
deleteremove, rmDelete a bucket
infoshow, getShow bucket details
credentialscredsShow or reset S3-compatible credentials
renamemvRename a bucket

List buckets

List all buckets deployed in the current environment.

railway bucket list
FlagDescription
--jsonOutput in JSON format

Default output:

my-bucket
another-bucket

With --json:

[
  {
    "id": "bucket-id",
    "name": "my-bucket"
  },
  {
    "id": "another-bucket-id",
    "name": "another-bucket"
  }
]

Create a bucket

Create a new bucket and deploy it to the target environment. An optional name can be passed as a positional argument; if omitted, the API assigns a default.

railway bucket create my-bucket --region sjc
FlagDescription
-r, --region <REGION>Bucket region. Prompted interactively if omitted.
--jsonOutput in JSON format

Available regions:

CodeLocation
sjcUS West, California
iadUS East, Virginia
amsEU West, Amsterdam
sinAsia Pacific, Singapore

Default output:

Created bucket my-bucket (sjc)

If the environment has unmerged staged changes, the operation is staged instead of committed directly. This applies to create, delete, and any other config-patching subcommand:

Created bucket my-bucket (sjc) and staged it for production (use 'railway environment edit' to commit)

With --json:

{
  "id": "bucket-id",
  "name": "my-bucket",
  "region": "sjc",
  "staged": false,
  "committed": true
}

Delete a bucket

Delete a bucket from the target environment. Requires confirmation unless --yes is passed.

railway bucket delete
railway bucket delete --yes
FlagDescription
-y, --yesSkip confirmation
--2fa-code <CODE>2FA code for verification
--jsonOutput in JSON format

Default output:

Deleted bucket my-bucket

If the environment has unmerged staged changes, the deletion is staged instead of committed directly:

Staged deletion of bucket my-bucket for production (use 'railway environment edit' to commit)

With --json:

{
  "id": "bucket-id",
  "name": "my-bucket",
  "staged": false,
  "committed": true
}

Show bucket info

Display bucket instance details including storage size, object count, and region.

railway bucket info
FlagDescription
--jsonOutput in JSON format

Default output:

Name:          my-bucket
Bucket ID:     bucket-id
Environment:   production
Region:        sjc
Storage:       1.2 GB
Objects:       3,456

With --json:

{
  "id": "bucket-id",
  "name": "my-bucket",
  "environmentId": "environment-id",
  "environment": "production",
  "region": "sjc",
  "storageBytes": 1200000000,
  "storage": "1.2 GB",
  "objects": 3456
}

Show or reset credentials

Display S3-compatible credentials for the selected bucket. The default output uses AWS_*=value lines suitable for eval or piping into .env files. Pass --reset to invalidate existing credentials and generate new ones.

railway bucket credentials
railway bucket credentials --reset --yes
FlagDescription
--resetReset S3 credentials (invalidates existing credentials)
-y, --yesSkip confirmation when resetting (requires --reset)
--2fa-code <CODE>2FA code for verification when resetting (requires --reset)
--jsonOutput in JSON format

Default output:

AWS_ENDPOINT_URL=https://storage.railway.app
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_S3_BUCKET_NAME=my-bucket-abc123
AWS_DEFAULT_REGION=auto
AWS_S3_URL_STYLE=virtual

When --reset is used without --json, only a confirmation message is printed:

Credentials reset for my-bucket

To view the new credentials after resetting, run railway bucket credentials again or use --reset --json.

With --json (both with and without --reset):

{
  "endpoint": "https://storage.railway.app",
  "accessKeyId": "your-access-key",
  "secretAccessKey": "your-secret-key",
  "bucketName": "my-bucket-abc123",
  "region": "auto",
  "urlStyle": "virtual"
}

Rename a bucket

Rename a bucket. Prompts for the new name interactively, or accepts --name.

railway bucket rename
railway bucket rename --name new-name
FlagDescription
-n, --name <NAME>New bucket name. Prompted interactively if omitted.
--jsonOutput in JSON format

Default output:

Renamed my-bucket -> new-name

With --json:

{
  "id": "bucket-id",
  "name": "new-name"
}