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?
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?
All you need to do, before doing the normal migration documented in the official tutorial 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 DATABSES
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.
If you are able to use a deployment service, take a look at at AWS Elastic Beanstalk. It combines EC2, RDS and S3 storage into a Docker and helps keep them together. It's really easy to connect your RDS instance to your EC2 instance(s). I just launched a Django project using that a few weeks ago.