Running Postgres In The Cloud With Docker

This video goes through each step and explains a few things along the way.

Step 1 - Start an EC2 instance on AWS

Step 2 - SSH into the EC2 instance

Step 3 - Install Docker on EC2 instance

Step 4 - Run a PostgreSQL docker container

The following command will download and run a docker image containing PostgreSQL 13.1.

docker container run --name postgresdb -p 5432:5432 -v pgdata -e POSTGRES_PASSWORD='mypass12345' postgres:13.1

Let’s break it down:

Step 5 - Connect to PostgreSQL

At this point, if you have PSQL on your computer, you can connect to the database by using PSQL.

We’re going to go use the PSQL that was automatically installed in the Docker container from our first tutorial - this makes it so we don’t have to install anything else on our computer.

Let’s break that one down:

Step 4 - Do some data stuff!

That’s it! Hope this helps you. Check out the previous video on running Postgres locally.