How to Setup a Database with AWS
Tags: Windows, AWS, How To, Mac, Database

What is AWS?

Amazon Web Services (or AWS) is a subsidiary of Amazon that provides on-demand cloud computing platforms and APIs to individuals, companies, and governments. It’s considered the world’s most comprehensive and broadly adopted cloud platform, offering over 174 fully featured services from data centers across the globe

Okay, that’s great. But how do you set up a database with it?

Step 1:

Log on to the site: https://aws.amazon.com/ and go to “My Account” -> “AWS Management Console”.

Step 2:

Scroll down until you see the “Database” section and click on “RDS” for “Relational Database Serve”.

Step 3:

Click on “Create Database”.

Step 4:

Choose Standard Create and PostgreSQL.

Step 5:

Choose the Free tier template.

Step 6:

Change the “DB instance identifier” to whatever you’d like (it must be unique across all DB instances owned by your current AWS region.

Add a master username and master password.

Make sure you save this information for later!

Step 7:

Leave everything in “DB instance size” as is.

Step 8:

Under “Connectivity”, expand the “Additional connectivity configuration” section and set “Publicly accessible” to yes.

Leave the “VPC security group” alone for now since we’ll be editing the default one in just a moment.

Step 9:

Leave “Database authentication” set to Password authentication.

Step 10:

Click “Create database” to start the creation process.

This could take anywhere between 5–10 minutes, so be patient!

Once the database is created, the browser will display a green banner with a “View credential details” button — click this to view your master username, master password, and endpoint.

Make sure you save this information for later!

Step 11:

Now that the database is done, we need to update our “VCP security group”.

This can be done by clicking on your new database (jackie-backend-project in this example).

Step 12:

Search for the “Security” section on the right and click on the default security group (the name will differ for your own database).

Step 13:

Click on the “Inbound rules” tab.

Step 14:

Click on “Edit inbound rules”.

Step 15:

Click “Add rule” and fill in the Type and Source fields.

What needs to go here:

- Any public IP from which you are working from (this also includes the IPs of any developers you are working with).

- The backend server that will be interfacing with the database (like Heroku, Firebase, any other Amazon services). What you could put here to give anyone access to your database, but will be a HUGE security risk:

- `0.0.0.0/0`

- The usage of `0.0.0.0/0` is not recommended outside of test scenarios, because it can give anyone and everyone the opportunity to connect to your database.

- Just...please don't do this (;﹏;) - from a Network Engineer.

TL;DR: Just use 0.0.0.0/0 if you’re feeling lazy and want to leave the worry of fixing the security risk to future you. Don’t say I didn’t warn you though!

Step 16:

Once you’ve added the necessary rules, click “Save rules” in the bottom right-hand corner.

Congratulations! You’ve setup your first AWS database! Now let’s get you connected to Postico/pgAdmin.

For Mac users, skip to Step 17-A. For Windows users, skip to Step 17-B.