惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
L
LangChain Blog
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
GbyAI
GbyAI
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
酷 壳 – CoolShell
酷 壳 – CoolShell
D
Docker
V
V2EX
月光博客
月光博客
Recent Commits to openclaw:main
Recent Commits to openclaw:main
S
SegmentFault 最新的问题
雷峰网
雷峰网
Stack Overflow Blog
Stack Overflow Blog
Cyberwarzone
Cyberwarzone
P
Privacy International News Feed
Spread Privacy
Spread Privacy
Project Zero
Project Zero
腾讯CDC
Engineering at Meta
Engineering at Meta
T
Tenable Blog
aimingoo的专栏
aimingoo的专栏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Jina AI
Jina AI
大猫的无限游戏
大猫的无限游戏
量子位
Blog — PlanetScale
Blog — PlanetScale
D
DataBreaches.Net
T
Troy Hunt's Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
美团技术团队
N
News and Events Feed by Topic
T
Tor Project blog
H
Help Net Security
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Last Week in AI
Last Week in AI
S
Security Affairs
小众软件
小众软件
Scott Helme
Scott Helme
云风的 BLOG
云风的 BLOG
Apple Machine Learning Research
Apple Machine Learning Research
Vercel News
Vercel News
人人都是产品经理
人人都是产品经理
PCI Perspectives
PCI Perspectives
TaoSecurity Blog
TaoSecurity Blog
博客园 - 叶小钗
V
Visual Studio Blog
The Cloudflare Blog
Recent Announcements
Recent Announcements

Railway Blog

Where Railway is, and where it's going (Summer 2026) PaaS vs IaaS vs SaaS: What Each Means and Who Should Pick What in 2026 The Best Continuous Deployment Tools in 2026 The Best PaaS for Multi-Region Deployments in 2026 The Best Platforms for Monorepo Deployments in 2026 Compliance Isn't a Feature, It's a Posture What is BYOC (Bring Your Own Cloud)? A Developer's Guide for 2026 The Best Managed Kubernetes Hosting in 2026 The Best Container Registries in 2026 The Vanilla Cloud Tax: What Rolling Your Own on AWS Actually Costs What is a PaaS? A Developer's Guide for 2026 The Best Cloud Observability and Logging Tools in 2026 The Best PostgreSQL Hosting for Developers in 2026 The Best Multi-Region Hosting Platforms in 2026 The Best Platforms to Deploy AI Apps in 2026 (Not the Models, the Apps Around Them) The Agent-Native Cloud: What It Means and Why It Matters Incident Report: May 19, 2026- GCP Account Suspension Counting to 3 with a new builder processing 50M+ monthly builds Railway iOS preview now available via TestFlight Kill your onboarding: selling to 10,000+ new users a day Your AI wants to nuke your database. Guardrails fix that. Better Rails for Agents: A New Remote MCP and Railway Agent in the CLI Moving Railway's Frontend Off Next.js One command deploys, there's a Stripe APP for that From registrar to deployed: buying a domain inside Railway A letter to open source builders who deserve more Networking is a black box, we used eBPF to open it Heroku Walked So Railway Can Run Security Features Your Security Team Will Love Railway Runs Open Source, Now We're Funding It Railway raises $100M Series B to unburden the builders Deploy autoscaling services, AI Workflow automation, and LLM APIs Without Kubernetes Hosting Postgres with GeoLite2: a practical guide to IP geolocation, data loading, and updates Serverless functions vs containers: CI/CD, database connections, cron jobs, and long-running tasks Hosting Postgres with pgvector: provider tradeoffs, migrations, indexes, and tuning Introducing the Railway integration on Delve.co Secure Cloud Hosting for Compliance: A Practical Guide for Startups and Regulated Industries How G2X Unlocked Rapid Experimentation at Scale with Railway MindFort Runs 100+ AI Pen Testing Agents Without Their Previous $10k AWS Bill How Bilt's Marketing Engineering Team Delivers at Scale with Railway Railway Technology Partners: Earn Revenue on Templates You Didn't Build ~$1 Million Paid to Developers Who Built Railway Templates CI/CD for Modern Deployment: From Manual Deploys to PR Environments Kernel Powers 1,000+ AI Agents on $444/Month of Railway Infrastructure Deploy Full-Stack TypeScript Apps: Architectures, Execution Models, and Deployment Choices Railway vs Cloudflare: How Their Architectures Differ and When to Use Each Run Scheduled and Recurring Tasks with Cron Monitoring & Observability: Using Logs, Metrics, Traces, and Alerts to Understand System Failures Logs, Metrics, and Traces: What Does Each Signal Tell You? Server rendering benchmarks: Railway vs Cloudflare vs Vercel Top five Heroku alternatives Comparing top PaaS and deployment providers Pricing to Encourage Use The F in SOC2 stands for functional Deploy Together, Earn Together: Introducing Railway Partnerships How We Oops-Proofed Infrastructure Deletion on Railway Bring Back the Free Plan Railway MCP - Stateful, Serverful, Pay-per-use Infrastructure Hackathon: Winners Announced! Mark Your Calendar: Railway User Hackathon with Prizes Launching Railway's Affiliate Program Zero-Touch Bare Metal at Scale Ssh, We’re Announcing One More Thing! $1M for Open Source Introducing Central Station Speed Isn’t Just About Code, It’s About Where That Code Runs One-Second Deploys? We Didn’t Believe It Either Why We’re Moving on From Nix Railway V3: Faster and Cheaper How to Migrate from Cloudflare Pages to Railway Supercharging Directus on Railway with a Static Frontend How to Migrate from AWS Lambda to Railway Deploy Triton Inference Server on Railway How to Handle Database Connection Pooling Building a NestJS App on Railway Manually Optimize Deployments on Railway Implement a GitHub Actions Testing Suite Scaling a SaaS application on Railway Building a SaaS application on Railway Deploy a Dart App on Railway, Part 2 Deploy a Dart App on Railway, Part 1 Implementing Feature Flags from Scratch Cron Jobs with Django and GitHub Actions Deploy Offen on Railway Queues on Railway Working with NX, Railway and CI/CD Using GitLab CI/CD with Railway Migrating From Heroku To Railway Cron Jobs on Railway Deploy Beam on Railway Deploy Authorizer on Railway Deploying Monorepo Applications How to Backup and Restore Your Postgres Database How to Backup Your Redis Instance Deploy Cusdis on Railway Deploy Ghost on Railway Using Github Actions with Railway Deploy Calendso (cal.com) on Railway Self-hosted website analytics Use Notion as a CMS for your NextJS blog
Automated PostgreSQL Backups
Faraz Patankar · 2022-09-02 · via Railway Blog

A heavily requested feature we keep getting asked about is automated PostgreSQL backups and while we don’t natively support this feature, we tried to help our users by offering a step-by-step tutorial to backing up and restoring their PostgreSQL database on Railway.

The problem though was that while helpful, it was still a manual process and backups were being made to a local filesystem. To fix this, we created a simple node service which will automate database backups and can be deployed at the click of a button.

Prerequisites

Before we deploy the template, we need to set up an S3 bucket on AWS to store our backups and create our access key and access secret to access our bucket.

Creating an S3 Bucket

First, we’ll sign into or create a new account on AWS. Once we’ve logged in, we’ll navigate to the Amazon S3 service. Next, we’ll navigate to the Create Bucket page and set a bucket name and region.

S3 bucket configuration
S3 bucket configuration

You can leave the other settings to their default values (unless you know what you’re doing) and click the Create bucket button at the bottom of the page.

Configuring bucket access

Now that our bucket has been created, we will create a new IAM user to programmatically access our bucket.

To do this, navigate to your IAM dashboard and click on Users under IAM resources. Next, click the Add users button. Add a name for your user and for the credential type setting, select Access key - Programmatic access.

Add IAM user
Add IAM user

Next, on the permissions page, click the Attach existing policies directly option and filter the policies by searching for AmazonS3 and select the AmazonS3FullAccess option.

Set user permissions
Set user permissions

Note: Keeping AmazonS3FullAccess isn’t safe for the long run. It is suggested that you update the security policy to only allow access to that specific bucket. Here is a suggested policy to use.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "s3:PutObject",
            "Resource": [
                "arn:aws:s3:::YOURS3RESOURCENAME"
            ]
        }
    ]
}

On the next step, you can optionally add tags if you’d like and then proceed to the Review step, review the name, access type and permissions for the user and once you’re happy with the settings, click the Create User button.

Once your user is created copy the Access key ID and the Secret access key values as we will use them in our automated backups service.

User access key and secret
User access key and secret

Deploying the template

Deploy on Railway

Now that we have set up everything on AWS, we can proceed to deploy our template. Click the button above and configure the AWS specific values as mentioned below.

  • AWS_ACCESS_KEY_ID: The Access key ID from our IAM user
  • AWS_SECRET_ACCESS_KEY: The Secret access key from our IAM user
  • AWS_S3_BUCKET: The name of our S3 bucket
  • AWS_S3_REGION: The region of our S3 bucket (example: us-west-2)

Next, we need to set the value for the BACKUP_DATABASE_URL variable. If your database is part of the same project, you can simply set this to ${{ DATABASE_URL }} and Railway will automatically infer the value. If your database isn’t in the same project, you can simply copy the Postgres Connection URL for your database and enter the value here.

Copy the Postgres Connection URL
Copy the Postgres Connection URL

Optionally, you can also configure the cron schedule by setting the BACKUP_CRON_SCHEDULE variable. By default, the cron is set to run daily at 5 AM UTC. You can use CronTab to play around with and set up different cron schedules.

Once you’ve added all the variables, simply click the Deploy button and your service should be live. Here’s a link to our demo project running this service and backing up a PostgreSQL database within the same project.

Backup cron in action
Backup cron in action

Restoring data from the backup

Our data should is now being automatically backed up to our S3 bucket. If we ever want to restore this data to a database, we can do so very easily using pg_restore.

First, unzip the backup which is stored as a tar.gz file and then run:

pg_restore -d 'DATABASE_URL' BACKUP_FOLDER

In the above snippet, replace the DATABASE_URL with the connection URL of the database you’d like to restore the data to and the BACKUP_FOLDER with the name of the folder to which you extracted your backup zip file and voila, your backup has been restored!

Closing

We hope that this post helps anyone looking for automated PostgreSQL backups on Railway. The template itself is a very simple service written in JavaScript and can easily be extended to backup other databases and/or use other storage solutions, we’d love for users to extend, improve and contribute to the service.

If you do end up wiring up your own version of this service, feel free to reach out to us on Discord as we’d be happy to feature it both on this blog and our templates page!