a month ago
Hi Railway team,
I'm using Railway on the Hobby plan to host a Shopify SaaS application with PostgreSQL.
I have successfully created and verified an AES-256-GCM encrypted backup stored in a private Backblaze B2 bucket.
I now want to perform a one-time restore test using an isolated PostgreSQL 18 database.
My questions:
- Can a temporary Railway Sandbox securely access existing service variables using server-side references, without exposing their secret values to my local computer?
- What is the correct CLI syntax for referencing variables from an existing service when creating a Sandbox?
- Can this be done without giving the Sandbox access to the production database or private network?
- What is the recommended secure SSH setup and host-key verification procedure for Railway?
- Is this possible on the Hobby plan without upgrading or adding a recurring subscription?
A restore test using synthetic data has already passed. The remaining step is verifying the restore using the real encrypted backup.
I want to perform the test securely, keep costs minimal, and destroy the temporary environment immediately afterward.
Thank you for your guidance!
3 Replies
a month ago
Yes, sandboxes are available on every plan, including Hobby, with no separate subscription. They bill per second at VM rates (CPU used, memory in use, egress) against your plan's included usage, and stop billing once destroyed.
Variable values passed to railway sandbox create can reference existing Railway variables, which are resolved server-side when the sandbox is created. Use the bare Service.VARIABLE form or ${{Service.VARIABLE}}, for example railway sandbox create --variable B2_KEY_ID=MyService.B2_KEY_ID --variable B2_APP_KEY=MyService.B2_APP_KEY. Your local shell only sees the reference string, not the value.
Sandboxes are created in ISOLATED mode by default: outbound internet only (so it can reach Backblaze), and it cannot reach your other services over the private network, nor can they reach it. Only --private-network changes that, and references to a service's internal address need it, so leave the flag off and avoid referencing your production DATABASE_URL.
For SSH, register a key with railway ssh keys add --key ~/.ssh/id_ed25519.pub (or at Account Settings -> SSH Keys), then connect with railway sandbox ssh, optionally with -i to pin a specific key. You can also skip SSH entirely and run steps with railway sandbox exec -- <command>.
To keep costs down, set a short --idle-timeout-minutes (1 to 120 on Hobby) and run railway sandbox destroy <id> as soon as the test is done. See railway sandbox and Sandboxes.
Status changed to Awaiting User Response Railway • about 1 month ago
Railway
Yes, sandboxes are available on every plan, including Hobby, with no separate subscription. They bill per second at VM rates (CPU used, memory in use, egress) against your plan's included usage, and stop billing once destroyed. Variable values passed to `railway sandbox create` can reference existing Railway variables, which are resolved server-side when the sandbox is created. Use the bare `Service.VARIABLE` form or `${{Service.VARIABLE}}`, for example `railway sandbox create --variable B2_KEY_ID=MyService.B2_KEY_ID --variable B2_APP_KEY=MyService.B2_APP_KEY`. Your local shell only sees the reference string, not the value. Sandboxes are created in `ISOLATED` mode by default: outbound internet only (so it can reach Backblaze), and it cannot reach your other services over the private network, nor can they reach it. Only `--private-network` changes that, and references to a service's internal address need it, so leave the flag off and avoid referencing your production `DATABASE_URL`. For SSH, register a key with `railway ssh keys add --key ~/.ssh/id_ed25519.pub` (or at [Account Settings -> SSH Keys](https://railway.com/account/ssh-keys)), then connect with `railway sandbox ssh`, optionally with `-i` to pin a specific key. You can also skip SSH entirely and run steps with `railway sandbox exec -- <command>`. To keep costs down, set a short `--idle-timeout-minutes` (1 to 120 on Hobby) and run `railway sandbox destroy <id>` as soon as the test is done. See [railway sandbox](https://docs.railway.com/cli/sandbox) and [Sandboxes](https://docs.railway.com/sandboxes).
a month ago
Thanks! Your instructions worked. I successfully created an isolated Sandbox on the Hobby plan, resolved the seven required backup variables server-side, and installed PostgreSQL 18.
However, my AI development tool's security controls prevent it from executing the final restore command.
Could a human from Railway confirm the safest supported way for me, as the account owner, to manually execute this one-time restore within the isolated Sandbox console, without exposing secrets or accessing production databases?
I want to avoid any additional subscription and destroy the Sandbox immediately afterward.
Status changed to Awaiting Railway Response Railway • about 1 month ago
a month ago
Running the restore yourself from your own terminal is fully supported. Run railway sandbox ssh for an interactive shell in the active sandbox, or railway sandbox exec -- <your restore command> to run it as a single command. Both connect to the same isolated sandbox you already created.
The seven variables you seeded at creation are available to every command over both exec and SSH, so your restore script can read them from the environment and you never need to type or paste the secret values on your machine. The sandbox is still in its default isolated mode with no access to your private network, so it cannot reach your production database.
When the restore check is done, run railway sandbox destroy and confirm with railway sandbox list that it no longer appears. Usage is billed per second against your Hobby plan, with no separate subscription, and stops once the sandbox is destroyed. See railway sandbox.
Status changed to Awaiting User Response brody • about 1 month ago
a month ago
This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!
Status changed to Solved Railway • about 1 month ago