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:
Click on the “Create database” button from the RDS dashboard:
Choose the “Standard Create” option as the database creation method:
Select “PostgreSQL” to run the database:
Select the version of the PostgreSQL engine and choose the “Free Tier” template:
Configure the database by providing the name of the database and specifying its master name as well:
Enter the password for the master user and confirm it by typing it twice:
Configure the storage section as the minimum storage allocation is 20GB and also select the maximum storage threshold:
Select VPC for the database and allow its public accessibility:
Keep the rest of the configuration default for the “Connectivity” section:
Select the password authentication to use the password set for the master user and configure the Monitoring section:
Once the configurations are complete for RDS, simply click on “Create database” to confirm its creation:
Click on the name of the database once it is created:
Head into the “Connectivity & security” section:
Copy the “Endpoint” for the database provided by the platform:
Head into the “pgAdmin 4” dashboard from the local system and right-click on the server to register server:
Type the name of the server and then head into the “Connection” tab by clicking on it:
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:
Once the AWS RDS is connected, simply right-click on the user to click on the “Query Tool” button:
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:
After the creation of the table, simply right-click on the table to click on the “Import/Export Data…” button:
Select the “Import” option and enter the path for the file and click on the “Save” button:
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.