Your cart is currently empty!
Category: Amazonrds
-
Khóa học miễn phí Amazon RDS – PostgreSQL Connecting to DB nhận dự án làm có lương
Amazon RDS – PostgreSQL Connecting to DB
To connect to Amazon RDS PostgreSQL DB we need a client software. In this case we use pgAdmin. Install it using the link .
After it is successfully installed we follow the steps below to connect it to the Amazon RDS.
Step-1
From the DB instance details get the end point.
Step-2
As it is a browser based interface, choose the add server option as shown in the below diagram.
Step-3
Use the end point and the master user credentials as the connection details.
Step-4
Once connected, we get the following window.
Khóa học lập trình tại Toidayhoc vừa học vừa làm dự án vừa nhận lương: Khóa học lập trình nhận lương tại trung tâm Toidayhoc
Khóa học miễn phí Amazon RDS – PostgreSQL Data Import nhận dự án làm có lương
Amazon RDS – PostgreSQL Data Import
Amazon RDS PostgreSQL provides easy ways of importing data into the DB and exporting data from the DB. After we are able to successfully connect to the PostgreSQL database we can use CLI tools to run the import and export commands to get the data from other sources in and out of the RDS database.
Below are the steps through which the PostgreSQL data migration happens using the export and import mechanisms.
Importing from an Amazon EC2 Instance
When there is a PostgreSQL server on an Amazon EC2 instance and it needs to be moved to a RDS – PostgreSQL DB instance, we use the below steps to do that.
Export The Data
Create a file using pg_dump that contains the data to be loaded. A dump file containing data and all the meta data of the database is created using the pg_dump utility. The following command in the psql utility cerates the dump file from the database named mydbname.
pg_dump dbname=mydbname -f mydbnamedump.sql
Create Target DB Instance
Next, we create the target DB instance and restore the data into it using the pg_restore command.
createdb [new database name] pg_restore -v -h [endpoint of instance] -U [master username] -d [new database name] [database].dump
Create Target Database
Use psql to create the database on the DB instance and load the data.
psql -f mydbnamedump.sql --host awsdbpginstance.d34f4mnfggv0.us-west-2.rds.amazonaws.com --port 8199 --username awsdbuser --password awsdbpassword --dbname mynewdb
Khóa học lập trình tại Toidayhoc vừa học vừa làm dự án vừa nhận lương: Khóa học lập trình nhận lương tại trung tâm Toidayhoc