Search code examples
postgresqlamazon-web-servicesspring-bootintellij-ideaamazon-rds

I cannot connect aws postgresql through my spring boot application


I have this ongoing shopping app project . I downloaded and I was using a database I created locally . Our teacher asked us to use aws and connect to a database we will create there . I created the database but I am encountering the error below when I try to connect to it through intellij ide :

DBMS: PostgreSQL (no ver.) Case sensitivity: plain=mixed, delimited=exact The connection attempt failed.

and it shows a link specify version just below the error . When I click it , it asks me to enter database version . In class , intellij did not give an error like this to my teacher , and I am sure I`m entering the correct endpoint for hostname , correct db name and password .

I thought it might be because I was using postgres locally on the same project before we were asked to use a postgres instance from aws . So I changed my datasource url`s , passwords in my application.yml files thinking this might resolve the problem but it did not .


Solution

  • AWS Postgres is an option when you setup an RDS database. Connecting to an RDS database from a Spring app is a valid use case.

    To connect to an RDS database, you must set up an inbound rule for the security group to connect to the database from your development environment. Setting up an inbound rule essentially means enabling an IP address to use the database. After you set up an inbound rule, you can connect to the database from a client such as MySQL Workbench. For more information, see Controlling Access with Security Groups.