> Source: https://meetrix.io/store/postgresql/
> Markdown copy of that page. Cite the URL above, not this file.

[Store](https://meetrix.io/store/)  PostgreSQL

Open-source relational database

# Self-hosted PostgreSQL with S3 backups on AWS

Run PostgreSQL on Ubuntu in your own AWS account, with your database, user and backups to Amazon S3 set up when the stack launches.

 [Launch on AWS](https://aws.amazon.com/marketplace/pp/prodview-5plmww2vmivds)

-   Ready in 5-10 minutes
-   Backups to S3
-   Runs in your own account

![PostgreSQL with S3 backups on AWS by Meetrix](https://meetrix.io/assets/store/postgresql/postgresql.webp)

## What is PostgreSQL?

PostgreSQL is a free, open-source object-relational database. It supports both relational (SQL) and JSON queries, which makes it a common choice for web applications and data-heavy services.

-   ### SQL and JSON

    Relational queries and JSON documents in one database.

-   ### Data integrity

    Transactions and constraints you can rely on.

-   ### Extensible

    Extensions, custom types and functions.

-   ### Any client

    Connect with pgAdmin, psql or any PostgreSQL driver.

-   ### Backups to S3

    Database backups go to a bucket in your own account.

-   ### Community-driven

    Decades of development and a large ecosystem.

## What's in the Meetrix PostgreSQL AMI

The AMI ships PostgreSQL configured from your stack parameters, with backups to S3 set up.

-   PostgreSQL on Ubuntu with your database, user and password
-   Backups to your own Amazon S3 bucket
-   Network rules for database and SSH access
-   A CloudFormation template for your own AWS account
-   Email support from Meetrix at aws@meetrix.io

## How to set up a self-hosted PostgreSQL server

1.  ### Create an S3 bucket

    Make an S3 bucket in your account for the database backups.

2.  ### Launch the stack

    Subscribe on AWS Marketplace and launch the stack with your database name, user, password and bucket.

3.  ### Restrict access

    Limit DatabaseSSHLocation and SSHLocation to your own IP ranges instead of 0.0.0.0/0.

4.  ### Connect

    After 5-10 minutes, connect to the PublicIp on port 5432 with your user and password, for example from pgAdmin.

## Deploy on AWS

### PostgreSQL on AWS

An AMI on AWS Marketplace, launched into your own AWS account with a CloudFormation stack.

Deploys with

CloudFormation

Recommended size

t3.small

Backups

To Amazon S3

#### Setup guides

-   [**Developer guide** Launch, connect, upgrade](https://meetrix.io/blogs/postgresql-developer-guide/)
-   [**PostgreSQL backup automation** Scheduling and retention on AWS](https://meetrix.io/blogs/effortless-postgresql/)
-   [**Video walkthrough** Watch the deployment on YouTube](https://www.youtube.com/watch?v=DYI7jqyBaHw)

 [Launch on AWS](https://aws.amazon.com/marketplace/pp/prodview-5plmww2vmivds)

## PostgreSQL server ports

Restrict both ports to the IP ranges that need them.

| Service | Ports | Protocol |
| --- | --- | --- |
| PostgreSQL | 5432 | TCP |
| SSH (administration) | 22 | TCP |

Server size: t3.small to start. Size the instance to your database and workload.

## Video: deploy PostgreSQL on AWS

## PostgreSQL FAQ

What is PostgreSQL?

A free, open-source object-relational database that supports both SQL and JSON queries.

How do I connect?

Use the PublicIp from the stack outputs as the host, port 5432, and the PostgresqlUser and PostgresqlPassword you set, for example in pgAdmin.

Where do backups go?

To the S3 bucket you name when creating the stack, inside your own AWS account.

Should I leave access open to 0.0.0.0/0?

No. Restrict the database and SSH source ranges to the addresses that need them.

Does self-hosting help with GDPR?

It lets you choose exactly which region your database and backups live in. You still need your own access controls and processing records.

Which instance size should I choose?

t3.small is the recommended starting point; size up with your data and workload.

How do I upgrade?

Back up your data, remove the old stack and launch the new version from AWS Marketplace.

## PostgreSQL guides and articles

### [PostgreSQL Automatic Backup Tool on AWS](https://meetrix.io/blogs/effortless-postgresql/)

Scheduled backups and retention for PostgreSQL.

### [PostgreSQL: Developer Guide](https://meetrix.io/blogs/postgresql-developer-guide/)

Launch the stack and connect to your database.

### [Self-Hosted Business Intelligence on AWS](https://meetrix.io/blogs/self-hosted-business-intelligence/)

Put dashboards on top of your PostgreSQL data.

## Need a hand with PostgreSQL?

We build and run self-hosted databases every day, from backup strategy to performance tuning. Tell us what you need.

[Contact us](https://meetrix.io/contact-us/)
