Issue
First time using AWS services with Django.
Was wondering how to configure the Django app running in a EC2 instance to a Postgres database in RDS?
the EC2 is running ubuntu 14.04
Any special configuration required?
Solution
All you need to do before doing the normal migration documented in the official tutorial is to be sure to have your RDS instance available and accessible to your EC2 instance.
Then, what you need to do is to modify the settings.py
file of your app in the DATABASES
section in the following way:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': '<name defined upon RDS creation>',
'USER': '<username defined upon RDS creation>',
'PASSWORD': '<password defined upon RDS creation>',
'HOST': '<this can be found in "Endpoint" on your RDS dashboard, exclude the ":" and the port number>',
'PORT': '5432',
}
}
Following this, continue to migrate normally and all should work well.
Answered By - bluesummers Answer Checked By - Clifford M. (WPSolving Volunteer)