How to Import Data into PostgreSQL on AWS RDS Database

Amazon Relational Database Service or RDS is used to create databases on the cloud from the AWS platform dashboard. It allows the user to create the database using multiple engines like MySQL, PostgreSQL, Aurora, etc. The user can connect to the local client using the AWS RDS database created on the cloud.

This guide will explain how to import data into PostgreSQL on the AWS RDS database.

How to Import Data into PostgreSQL on AWS RDS Database?

To import data into PostgreSQL on the AWS RDS database, visit the Amazon RDS service dashboard:

img

Click on the “Create database” button from the RDS dashboard:

img

Choose the “Standard Create” option as the database creation method:

img

Select “PostgreSQL” to run the database:

img

Select the version of the PostgreSQL engine and choose the “Free Tier” template:

img

Configure the database by providing the name of the database and specifying its master name as well:

img

Enter the password for the master user and confirm it by typing it twice:

img

Configure the storage section as the minimum storage allocation is 20GB and also select the maximum storage threshold:

img

Select VPC for the database and allow its public accessibility:

img

Keep the rest of the configuration default for the “Connectivity” section:

img

Select the password authentication to use the password set for the master user and configure the Monitoring section:

img

Once the configurations are complete for RDS, simply click on “Create database” to confirm its creation:

img

Click on the name of the database once it is created:

img

Head into the “Connectivity & security” section:

img

Copy the “Endpoint” for the database provided by the platform:

img

Head into the “pgAdmin 4” dashboard from the local system and right-click on the server to register server:

img

Type the name of the server and then head into the “Connection” tab by clicking on it:

img

Paste the Endpoint for the AWS RDS in the “Host name/address” column, provide the password for the user, and click on the “Save” button:

img

Once the AWS RDS is connected, simply right-click on the user to click on the “Query Tool” button:

img

Create a table in the AWS RDS database using the following command in the Query Tool:

CREATE TABLE persons (
  id SERIAL,
  name VARCHAR(30),
  date_of_birth DATE,
  email VARCHAR(255)
   )

SideNote: Table creation is necessary to import data from the local database to the Amazon RDS PostgreSQL database:

img

After the creation of the table, simply right-click on the table to click on the “Import/Export Data…” button:

img

Select the “Import” option and enter the path for the file and click on the “Save” button:

img

That’s all about importing data into PostgreSQL on the AWS RDS database.

Conclusion

To import the data into PostgreSQL on the AWS RDS database, create an RDS database on the AWS dashboard. Once the database is created, simply use the Endpoint provided by the platform for connecting to the local PostgreSQL client on the local system. Once the AWS RDS is connected to the PostgreSQL client, create a table and import data from the local directory. This guide has explained the process of importing data into PostgreSQL on the AWS RDS database.