Create a PostgreSQL Server Using AWS EC2
  • Introduction
  • AWS EC2: Launching Instance
    • Overview
    • Create Security Group
    • Create Launch Template
    • Option 1: Create Auto Scaling Group
    • Option 2: Create a Single Instance
    • Attach Elastic IP Address
  • Ubuntu 20.04: Configuring PostgreSQL
    • Overview
    • Install PostgreSQL
    • Add Role to PostgreSQL Server
    • Allow Remote Connection
  • Remote Server: Accessing Server on Local Computer
    • Overview
    • Connect with pgAdmin4
    • Connect with Python API
  • AWS EC2: Backup Server
    • Overview
    • Configuring Automatic Backups
  • Next Steps
Powered by GitBook
On this page

Was this helpful?

  1. Ubuntu 20.04: Configuring PostgreSQL

Overview

Install and configure PostgreSQL on our Ubuntu instance

PreviousAttach Elastic IP AddressNextInstall PostgreSQL

Last updated 4 years ago

Was this helpful?

Now that our Ubuntu instance is running on AWS EC2, we will now SSH into our instance and configure PostgreSQL (Version 12.4).

In this chapter, I will give instructions and rationale on how to do the following:

  1. Install PostgreSQL

  2. Create roles for PostgreSQL

  3. Allow for remote connections

Be sure to SSH into your instance before following the instructions.

References

Guides

(1) TecMint, How to Install PostgreSQL and pgAdmin4 in Ubuntu 20.04,

(2) DigitalOcean, How To Install and Use PostgreSQL on Ubuntu 20.04,

(3) Better Programming (Medium), How to Provision a Cheap PostgreSQL Database in AWS EC2,

(4) The Geek Stuff, How to Allow Remote Connection to PostgreSQL Database using psql,

Documentations

(5) PostgreSQL 12 Documentation, Chapter 20. Client Authentication,

(6) PostgreSQL 12 Documentation, 20.1. The pg_hba.conf File,

(7) PostgreSQL 12 Documentation, 20.5. Password Authentication,

(8) PostgreSQL 12 Documentation, 19.3 Connections and Authentications,

Forums

(9) StackExchange, Difference between sudo user and root user,

(10) StackOverflow, How do I exit the vim editor?,

(11) AskUbuntu, How to install updates via command line?,

(12) AskUbuntu, Is there a command to list all users? Also to add, delete, modify users, in the terminal?,

(13) Unix StackExchange, What is the difference between su username and su - username?,

(14) AskUbuntu, 'sudo su -' vs 'sudo -i' vs 'sudo /bin/bash' - when does it matter which is used, or does it matter at all?,

(15) Stack Overflow, How to configure PostgresSQL postgresql.conf listen_addresses for multiple ip addresses

(16) AskUbuntu, What does -y mean in apt get -y install command,

https://www.tecmint.com/install-postgresql-and-pgadmin-in-ubuntu/
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-20-04
https://medium.com/better-programming/how-to-provision-a-cheap-postgresql-database-in-aws-ec2-9984ff3ddaea
https://www.thegeekstuff.com/2014/02/enable-remote-postgresql-connection/
https://www.postgresql.org/docs/13/client-authentication.html
https://www.postgresql.org/docs/12/auth-pg-hba-conf.html
https://www.postgresql.org/docs/12/auth-password.html
https://www.postgresql.org/docs/12/runtime-config-connection.html
https://unix.stackexchange.com/questions/291454/difference-between-sudo-user-and-root-user
https://stackoverflow.com/questions/11828270/how-do-i-exit-the-vim-editor
https://askubuntu.com/questions/196768/how-to-install-updates-via-command-line
https://askubuntu.com/questions/410244/is-there-a-command-to-list-all-users-also-to-add-delete-modify-users-in-the
https://unix.stackexchange.com/questions/384700/what-is-the-difference-between-su-username-and-sudo-su-username
https://askubuntu.com/questions/376199/sudo-su-vs-sudo-i-vs-sudo-bin-bash-when-does-it-matter-which-is-used
https://stackoverflow.com/questions/9764126/how-to-configure-postgresql-postgresql-conf-listen-addresses-for-multiple-ip-add
https://askubuntu.com/questions/672892/what-does-y-mean-in-apt-get-y-install-command