Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 206255

Connecting Rstudio with PostgreSQL in AWS EC2

$
0
0

I am currently running PostgreSQL server in AWS EC2 (Ubuntu) and having trouble accessing it from local server. How can I access remote database from local RStudio?

Code in R:

library(RPostgreSQL)
library(DBI)

drv <- dbDriver("PostgreSQL")

con <- dbConnect(drv, user='postgres', password='password', dbname='dvd', host='ec2-xx-xxx-xxxx-xxxx.ap-northeast-2.compute.amazonaws.com',port=5432)

dbListTables(con)

Result:

Error in postgresqlNewConnection(drv, ...) : 
  RS-DBI driver: (could not connect postgres@ec2-xx-xxx-xxxx-xxxx.ap-northeast-2.compute.amazonaws.com:5432 on dbname "dvd": FATAL:  no pg_hba.conf entry for host "130.17.152.1”, user "postgres", database "dvd", SSL off
)
Calls: <Anonymous> ... eval -> dbConnect -> dbConnect -> postgresqlNewConnection
Execution halted

For AWS security group, I have added an inbound for PostgreSQL with its source set it to anywhere with port range 5432.


Viewing all articles
Browse latest Browse all 206255

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>