---
title: "How to Set Up Nightly Backups to AWS S3 for Multiple Neon Projects"
description: "Nightly backups of multiple Neon Postgres databases can be automated with one GitHub Actions workflow per database."
url: "https://swe.quest/articles/how-to-set-up-nightly-backups-to-aws-s3-for-multiple-neon-projects-8546de66a0aa7f01"
canonical: "https://neon.com/blog/nightly-backups-for-multiple-neon-projects"
source: "Neon"
published: "2024-10-29"
difficulty: "medium"
kind: "How-to"
reading_minutes: 7
tags: ["postgres","ci-cd","cloud","databases"]
---

# How to Set Up Nightly Backups to AWS S3 for Multiple Neon Projects

A post on [Neon](https://swe.quest/sources/neon.md), published 2024-10-29, 7 min read, How-to. Original: [https://neon.com/blog/nightly-backups-for-multiple-neon-projects](https://neon.com/blog/nightly-backups-for-multiple-neon-projects)

## Summary

Nightly backups of multiple Neon Postgres databases can be automated with one GitHub Actions workflow per database. Each workflow runs on a cron schedule, installs a matching Postgres client version, and assumes an AWS IAM role via OIDC. It then pipes pg\_dump through gzip, deletes .gz files in that database's S3 folder older than a configurable retention period, and uploads the new dump. Workflows differ only in name, connection-string secret and retention. GitHub-hosted runners time out after about 6 hours, so large databases may need self-hosted runners.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [CI/CD](https://swe.quest/tags/ci-cd.md) (Reliability & operations)
- [Cloud platforms](https://swe.quest/tags/cloud.md) (Infrastructure)
- [Databases](https://swe.quest/tags/databases.md) (Data & databases)

## Prerequisites

- GitHub Actions workflows ([easy posts on CI/CD](https://swe.quest/tags/ci-cd.md?difficulty=easy))
- AWS S3 and IAM roles ([easy posts on Cloud platforms](https://swe.quest/tags/cloud.md?difficulty=easy))
- pg\_dump basics

## Keywords

Neon, GitHub Actions, AWS S3, pg\_dump, AWS IAM, PostgreSQL

## Related posts

- [How to create an AWS S3 bucket for Postgres backups](https://swe.quest/articles/how-to-create-an-aws-s3-bucket-for-postgres-backups-1b827136764e94f1.md): Neon · 2024-10-28 · Medium · 4 min read · Cloud platforms, Identity & auth, PostgreSQL, CI/CD, Multi-tenancy
  Part 1 of a series on automating nightly Postgres backups from many Neon projects to S3 via scheduled GitHub Actions covers the AWS setup.
- [Automated PostgreSQL Backups](https://swe.quest/articles/automated-postgresql-backups-be869b2aa09ef3bf.md): Railway · 2022-09-02 · Medium · 4 min read · PostgreSQL, Cloud platforms, Storage systems
  A deployable Node.js template automates PostgreSQL backups on Railway by running a cron job that uploads compressed dumps to an S3 bucket.
- [Neon Twin: Move Dev/Test/Staging to Neon, Keep Production on RDS](https://swe.quest/articles/neon-twin-move-dev-test-staging-to-neon-keep-production-on-rds-a26cd19df36ac332.md): Neon · 2024-07-24 · Medium · 7 min read · PostgreSQL, CI/CD, Databases
  A Neon Twin is a nightly-synced copy of an RDS Postgres production database kept in Neon for dev, test and staging, so teams get instant provisioning, branching and scale-to-zero without migrating production.
- [Neon Twin: Automate Partial Data Dumps with Postgres and GitHub Actions](https://swe.quest/articles/neon-twin-automate-partial-data-dumps-with-postgres-and-github-actions-0e318b92e17657ec.md): Neon · 2025-02-10 · Medium · 7 min read · PostgreSQL, CI/CD, Testing
  A scheduled GitHub Actions workflow can keep a Neon "Twin" refreshed with a partial copy of a production Postgres database.
- [Neon Twin: How to deploy a change tested in Neon to prod in RDS](https://swe.quest/articles/neon-twin-how-to-deploy-a-change-tested-in-neon-to-prod-in-rds-09282f8f58bccb12.md): Neon · 2024-08-15 · Medium · 10 min read · Schema migrations, PostgreSQL, CI/CD, Deployment
  Schema changes tested on Neon database branches can be promoted to an AWS RDS production Postgres database through GitHub Actions that run when a pull request merges.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
