Getting started with AWS RDS and PostgreSQL

Robiuddin Robi
5 min readNov 10, 2023

AWS or Amazon Web Services is a subsidiary created by Amazon itself to help tech companies, and developers by providing lots of cloud computing, data storage, data warehouse to handle a large number of queries, etc. Big companies are now shifting to AWS so that they can perform cloud work on it for reliable and trusted support.

AWS RDS is a service provided by AWS for RDBMS (ex. MySQL, PostgreSQL). In the case of software development if software needs constant database support and also from remote, then RDS comes handy. One can create the database in RDS and then use that database from anywhere in the world using the internet as the database remains online 24/7 with very high uptime.

Now let’s see how we can create a PostgreSQL in AWS RDS very easily within 5–6 minutes. Plus how can we make the DB public on the internet?

Step — 1 :

First Log in to the AWS console using https://aws.amazon.com/ this link by providing “Account ID”, “IAM username”, and “password”.

Login Screen of AWS console

Step — 2 :

Now in the services search box search for RDS.

Service Search Box
Search Result

Select RDS from the search result which says managed relational database service.

Step — 3:

Now press “Create database” to start creating the database and wait for the next page.

Create database

Step — 4:

From the “Engine options” select PostgreSQL and then choose the desired version that you need from the “Version” drop-down menu.

Select the type of database and its version.

Step — 5:

From the “Template” option choose “Dev/Test” if you want to make this database for testing purposes. However, you can choose “Production” when your software is ready to use and you want to use a database for the software(s) you are going to launch.

Choosing the right template.

Step — 6:

From the “Settings” option, you first need to give your database a name. It can be any name for testing purposes. However, try to give a meaningful name for the “Production” version. Here, I have used “test-database” as my database name. After that, you need to provide a “Master username”. As I was saying before, it can be any name. Finally, you have to give a “Password” for your “Master username”.

Step — 7:

The next part is “DB instance class”. From the checkboxes, you can select “Burstable classes” for low-tier usage. However, for production-level usage, one can use “Standard classes” and “Memory-optimized classes”.

Step — 8:

From “Storage”, select the “Storage type” as per need. You can choose how much storage you need from “Allocated storage”. You can enable “Enable storage autoscaling” if you think that the storage capacity that you have put in the “Allocated storage” might be fully used. In that case, this option will help you to get extra storage when your “Allocated storage” limit exceeds. Good thing is, you can also type threshold as needed from “Maximum storage threshold”. For example, If you choose 20 GiB for “Allocated storage”, you have enabled the “Enable storage autoscaling” option and you have set the “Maximum storage threshold” to 1 GiB, then when 20GiB becomes full you will 1 extra GiB for future use.

Step — 9:

Now for the connectivity part as we need to access this DB from anywhere in the world so we definitely need to consider this step carefully so that it doesn’t get anything wrong in the process.

Default Connectivity

Choose yes for the “Public access” field otherwise, the DB won’t be available in the internet. keeps everything as they are in default. 😁

Step — 10:

The next step keep password authentication enabled.

Finally, create the database and wait it will take some time

And then it will be available to access from the database dashboard.

Click to open your newly created database. It will open into a new page.

The endpoint will be the host address to use to connect with the database. we need to add some inbound rules which will allow us to connect the DB from anywhere from the internet.

Press the above-marked permalink it will take you to security groups.

press the above-marked permalink and it will take you to a page from where you will be able to add inbound rules.

Press edit inbound rules and add the following rules.

  • Type — PostgreSQL; protocol — TCP; source — Anywhere IPv4

N.B: This is the most important part without this rule you will not be able to access your database through the Internet.

How to use this host and connect with Python you can read it here

Thanks to Md. Abu Zehad Antu & Kazi Ferdous Mahin for collaborating to write this blog.

--

--