Point Heroku AWS RDS Database Application

I need to point my Heroku application to my AWS RDS database. My RDS database is running and has a security group with access 0.0.0.0/0.

I have currently uninstalled my postgreSQL Heroku database, and I am trying to point the Heroku application to my RDS database. For some reason, my application crashes. The step that I think I find sets my DATABASE_URL on the Heroku side.

Say my credentials are in the database:

db instance: mydb
dbname: mydb
user: wcronyn
pass: password

I tried:

heroku config: set DATABASE_URL = postgres: // wcronyn: password@mydb.XXXXXXX.us-east-1.rds.amazonaws.com : 5432 / mydb

and I tried to set permissions by uploading the .pem file to my config folder and then referring to it:

DATABASE_URL = Postgres: // wcronyn: password@mydb.XXXXXXX.us-east-1.rds.amazonaws.com : 5432 / MYDB sslca = configuration / Amazon-RDS-cha-cert.pem & sslmode = & requires an amplifier; encrypt = true

I tried these two database URLs, but my application continues to crash.

Can someone outline the steps I need to take to successfully host my RDS database and point my application to it?

+4
source share
2 answers

The following steps worked for me (February 2017), given the following setup:

  • AWS RDS eu-west-2 ( VPC, DB )
  • Postgres 9.6
  • Heroku, Flask (, appname: heroku-app-stage)
  • Git Heroku (, remote: stage)
  • DATABASE_URL postgresql://username:password@awsrdshost:5432/dbname

:

  • Amazon RDS SSL Heroku.
  • Heroku
  • SSL RDS-
  • RDS, IP- .

SSL Amazon RDS

  • .pem Amazon RDS .
  • ( , .py )
  • git Heroku (git push stage master)
  • , ( heroku run bash --app heroku-app-stage, dyno)

Heroku

  • Heroku heroku-app-stage, "" " "
  • DATABASE_URL, ?sslrootcert=rds-combined-ca-bundle.pem&sslmode=require. postgresql://username:password@awsrdshost:5432/dbname?sslrootcert=rds-combined-ca-bundle.pem&sslmode=require

, ; , , , SO:

PostgreSQL Python

SSL RDS-

  • RDS ,
  • , , .
  • force_ssl, 1 .
  • , SSL RDS. psql postgres -h awsrdshost -p 5432 -U username, SSL

RDS, IP

  • RDS
  • EC2 ( Compute > EC2)
  • ( 1) "" . PostgreSQL, . "", .

. , RDS, VPC.

!

:

Amazon SSL Postgres http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html#PostgreSQL.Concepts.General.SSL

Heroku ( ) Amazon RDS https://devcenter.heroku.com/articles/amazon-rds

+5

, heroku AWS RDS. , Amazon . @pseudopeach ( ).

, . RDS Heroky, , AWS.

  • AWS

a) . , , . US EAST ()

b), rds

c) db ts micro ( , )

d) rds, " "

e) db, dbname, endpoint ( URL-, [dbname]. [randomstring].us-east-1.rds.amazon.com) . , db .

  1. Heroku

a) heroku heroku.com, b) showconfig

heroku :

DATABASE_URL xxxxxx

HEROKU_POSTGRESQL_VIOLET_URL xxxxxx

LANG xxxxxx

RACK_ENV

RAILS_ENV

SECRET_KEY_BASE xxxxxx

DATABASE_URL [: URL- , ]

Postgres://

[- ]:

[ db]

@[ ]:

[ db]/

[ db]

? Sslca = /---cert.pem

& sslmode =

& =

URL:
Postgres://JDoe: supersecretpassword@mydb.coua7574xvna.us-east-1.rds.amazonaws.com: 5432/MYDB sslca = /---cert.pem & sslmode = & = True

EXTERNAL_DATABASE amazon-rds-ca-cert.pem

EXTERNAL_DATABASE_CA amazon-rds-ca-cert.pem

LANG ( )

RACK_ENV ( )

RAILS_ENV ( )

RDS_DB_PASS [ db]

RDS_DB_PORT [ db, 5432]

RDS_READS_DB_NAME [ db]

RDS_HOST [URL ]

RDS_USER [db-username]

, RDS 10 000 (, , ). postgreSQL , postgres.

+2

Source: https://habr.com/ru/post/1627608/


All Articles