How to Create and Connect to a PostgreSQL Database – AWS

Written by Alex

How to Create and How to Connect to a PostgreSQL Database – AWS

How to Connect to a PostgreSQL Database? To create a DB Instance Running the PostgreSQL DB Engine and also you would know to Create Postgresql database.

  1. Sign in to the AWS Management Console and open the Amazon RDS console at
  2. In the top right corner of the AWS Management Console, choose the region where you want to create the DB instance.
  3. In the navigation pane, choose Instances.
  4. Choose the Launch DB Instance option to start the Launch DB Instance Wizard.
  5. The wizard opens on the Select Engine page.

How to Connect to a PostgreSQL Database

6. On the Choose use case page, choose Dev/Test – Postgresql and then choose Next.

7. On the Specify DB details page, shown following, set these values:

  • License model: Use the default value.
  • DB engine version: Use the default value.
  • DB instance class: db.t2.small
  • Multi-AZ deployment: No
  • Storage type: General Purpose (SSD)Allocated storage: 20 GiB
  • Allocated storage: 20 GiB

How to Connect to a PostgreSQL Database

How to Create and How to Connect to a PostgreSQL Database – AWS

  • DB instance identifier: tutorial-db-instance
  • Master username: tutorial_user
  • Master password: Choose a password.
  • Confirm password: Retype the password.

8. Choose Next and set the following values in the Configure advanced settings page:

  • Note
  • The VPC must have subnets in different availability zones.
  • Subnet group: The DB subnet group for the VPC, the tutorial-db-subnet-group created in Create a DB Subnet Group
  • Public accessibility: NoAvailability zone: No Preference
  • Availability zone: No Preference
  • VPC security groups: Choose an existing VPC security group that is configured for private access, such as the tutorial-db-security group created in Create a VPC Security Group for a Private Amazon RDS DB Instance
  • Remove other security groups like default security groups. Database name: sample

Leave the default settings for the other options.

9. Next option you will see a backup of RDS. Use all default options.

10. To create Amazon RDS MySQL DB instance, choose Launch DB instance.

11. On the next page, choose View DB instances details to view your RDS MySQL DB instance.

12. Wait for the DB instance status of your new DB instance to show as available. Then scroll to the Connect section, shown following.

Create Postgresql database

Make note of the endpoint and port for your DB instance. You will be using this information to connect your webserver to your RDS DB instance.

How to Connect to a PostgreSQL Database & Create Postgresql database and access RDS

Login to your EC2 instance makes sure the 5432 port should be open for the EC2 instance.To connect your Postgres rds instance using the command line

psql --host --port 5432 --username root-user --dbname database-name

It will ask for the root user password please enter:

Run Below command one by one:- 

  1. CREATE DATABASE database_name;
  2. CREATE USER my_username WITH PASSWORD ‘my_password’;
  3. GRANT ALL PRIVILEGES ON DATABASE “database_name” to my_username;


Now you are able to launch an instance and known How to Connect to a PostgreSQL Database create a database in the AWS RDS service.

We hope you are like this article and this is useful for you. If you learn more about Linux, AWS Tips, and Tricks Please Bookmark this Website. We are Daily Publish New Article in this Website WWW.BPMTECHGURU.IN and all post in this website is practically tested and 100% Work if you have any Problem Please Drop a Comment we are trying to resolve your problem.


About the author


Leave a Comment