A step-by-step guide to replacing a Railway volume with S3: what a volume gives you that a bucket does not, how to copy the existing files over, and a TypeScript version where uploads go straight to the bucket.

A Railway volume is a disk mounted at a path such as /data, and many apps use it for uploads, generated PDFs or a SQLite file. It works until the service needs a second replica, since replicas cannot use volumes, and each redeploy has a short gap while the old deployment releases the disk.
Moving to AWS usually means replacing the disk with S3. This guide covers what changes in the code, how to copy the files, and how the same service looks with a bucket declared in code.
The Railway behavior is from its volumes reference, checked on November 23, 2026, and the S3 side from the S3 user guide. Most apps that write user files to a volume only ever read them back by name, which is exactly what object storage does.
Run railway volume files or railway volume browse on the service and sort the contents into three groups: files users uploaded, files the app generated and can rebuild, and anything that is a database or lock file. The first group goes to S3 with its names unchanged, the second can usually be regenerated on demand and skipped, and the third should not move to a bucket at all, since a SQLite file on object storage loses the locking that made it safe. Postgres is the better home for that data, and moving the database to RDS is a separate step.
Search the code for the mount path next, because every fs.writeFile, createReadStream and path.join("/data", ...) is a place that needs to change. Note which of them serve files straight back to the browser, since those are the ones that benefit from a signed download URL instead of streaming the bytes through the service.
Create the bucket in the AWS region closest to the service, block public access, and decide whether to turn on versioning, which keeps an overwritten file recoverable at the cost of storing every version. With the AWS CLI the copy is one command run from a shell inside the Railway service, which railway ssh opens:
# Inside the Railway service, with AWS credentials for a user that can write to the bucket
aws s3 sync /data s3://my-app-user-files --only-show-errors
aws s3 sync skips files that already exist with the same size and timestamp, so it can run once before the switch and again right after to pick up files that arrived in between. Run the final sync after writes have moved to S3, and keep the volume attached for a week afterwards in case a path was missed.
Replace each filesystem write with an upload to the bucket under the same key the file had as a path, so existing database rows that store avatars/42.png keep working. For large files, let the browser upload straight to S3 with a presigned URL, and the service only records the key. The service no longer needs a mount, so the replica limit and the redeploy gap go away with it.
Encore brings infrastructure from code, so the /data mount becomes a Bucket declared in the service that uses it. Per the AWS infrastructure docs, deploying creates the S3 bucket in your account, and Encore provisions an IAM role for the service that declares it, with access to that bucket.

Run in your terminal to get started locally.
An uploads service that replaces the volume, with a signed upload URL for the browser and the same endpoint reused to backfill the old files:
// files/files.ts
import { api, APIError } from "encore.dev/api";
import { Bucket } from "encore.dev/storage/objects";
// Replaces the Railway volume that was mounted at /data.
export const userFiles = new Bucket("user-files", { versioned: false });
interface UploadRequest {
key: string; // same relative path the file had under /data, for example avatars/42.png
}
// Returns a short-lived URL the browser (or a backfill script) PUTs the file to.
export const uploadUrl = api(
{ expose: true, method: "POST", path: "/files/upload-url" },
async ({ key }: UploadRequest): Promise<{ url: string }> => {
if (!/^[a-zA-Z0-9][a-zA-Z0-9/_.-]{0,200}$/.test(key) || key.includes("..")) {
throw APIError.invalidArgument("invalid key");
}
const signed = await userFiles.signedUploadUrl(key, { ttl: 900 });
return { url: signed.url };
},
);
// Downloads go straight from the bucket instead of through the service.
export const downloadUrl = api(
{ expose: true, method: "GET", path: "/files/*key" },
async ({ key }: { key: string }): Promise<{ url: string }> => {
if (!(await userFiles.exists(key))) throw APIError.notFound("file not found");
const signed = await userFiles.signedDownloadUrl(key, { ttl: 300 });
return { url: signed.url };
},
);
The backfill from the Railway side reuses the endpoint instead of AWS credentials: for each file, curl the upload-url endpoint with its key, then PUT the file to the URL that comes back, as in the object storage docs. Uploading the same key twice overwrites the file, so the loop can safely run again for the final pass. Add authentication to both endpoints with the auth handler before exposing them, since the examples above are open to anyone who can reach the service.
Locally, encore run starts a local bucket for the same code, so uploads and downloads work on a laptop without an AWS account. To deploy, connect your AWS account as described in Connect your cloud account and push with git push encore.
A coding agent asked to add file uploads writes the bucket and the two endpoints in one change and tests them locally, with no bucket policy or console step to hand off.
Best fit: Services leaving a Railway volume that want uploads in S3 in their own AWS account, with the bucket declared next to the code that uses it.
Pause writes while the final volume-to-S3 sync runs, then switch both writes and reads to the bucket before accepting writes again, so a file is never missing at the moment a user asks for it. If writes cannot pause, write to both stores until reads have moved. Keep the volume attached and unmodified for a week, and delete it only after a full cycle of normal traffic. Remember that a deleted volume is queued for deletion and can be restored for 48 hours, after which it is gone.
For files that users upload or the app generates, the equivalent is an S3 bucket, which any number of service instances can read and write at the same time. For a database or other software that needs a real filesystem, the equivalent is an EBS or EFS volume mounted on the task or instance.
No. A Railway service can have a single volume, and replicas cannot be used with volumes, so two services that need the same files have to pass them over the network. An S3 bucket removes the limit, since every service in the account that has permission can use the same objects.
Use railway volume files or railway volume browse to see what is stored, then run railway ssh into the attached service and upload each file to the new bucket with the AWS CLI or an upload URL. Copy a final time after switching writes, since files that arrive during the first copy will be missing.
With Encore you declare a Bucket in the service and call upload, download and signedUploadUrl on it, and the deploy creates the S3 bucket in your AWS account, and Encore provisions an IAM role for the service with access to it. Locally, encore run uses a local bucket, so the same code works without AWS credentials.
Deploy to your cloud on AWS and Google Cloud
without managing infrastructure
Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.