railway bucket
Manage storage buckets for your project.
Usage
railway bucket <COMMAND> [OPTIONS]Aliases
railway buckets
Global options
| Flag | Description |
|---|---|
-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 infoSubcommands
| Subcommand | Aliases | Description |
|---|---|---|
list | ls | List buckets |
create | add, new | Create a new bucket |
delete | remove, rm | Delete a bucket |
info | show, get | Show bucket details |
credentials | creds | Show or reset S3-compatible credentials |
rename | mv | Rename a bucket |
List buckets
List all buckets deployed in the current environment.
railway bucket list| Flag | Description |
|---|---|
--json | Output in JSON format |
Default output:
my-bucket
another-bucketWith --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| Flag | Description |
|---|---|
-r, --region <REGION> | Bucket region. Prompted interactively if omitted. |
--json | Output in JSON format |
Available regions:
| Code | Location |
|---|---|
sjc | US West, California |
iad | US East, Virginia |
ams | EU West, Amsterdam |
sin | Asia 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| Flag | Description |
|---|---|
-y, --yes | Skip confirmation |
--2fa-code <CODE> | 2FA code for verification |
--json | Output in JSON format |
Default output:
Deleted bucket my-bucketIf 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| Flag | Description |
|---|---|
--json | Output in JSON format |
Default output:
Name: my-bucket
Bucket ID: bucket-id
Environment: production
Region: sjc
Storage: 1.2 GB
Objects: 3,456With --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| Flag | Description |
|---|---|
--reset | Reset S3 credentials (invalidates existing credentials) |
-y, --yes | Skip confirmation when resetting (requires --reset) |
--2fa-code <CODE> | 2FA code for verification when resetting (requires --reset) |
--json | Output 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=virtualWhen --reset is used without --json, only a confirmation message is printed:
Credentials reset for my-bucketTo 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| Flag | Description |
|---|---|
-n, --name <NAME> | New bucket name. Prompted interactively if omitted. |
--json | Output in JSON format |
Default output:
Renamed my-bucket -> new-nameWith --json:
{
"id": "bucket-id",
"name": "new-name"
}