Back
First time using AWS services with Django.
Was wondering how to configure the Django app running in an EC2 instance to a Postgres database in RDS?
the EC2 is running ubuntu
Any special configuration required?
Before starting off with the normal migration part provided in this official documentation, make sure that your RDS instance is available and accessible from your EC2 instance.
The modify settings.py file in the DATABASES section like this:
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', }}
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',
}
Then, continue to migrate as suggested by the documentation.
Learn how we helped 50,000+ professionals like you !
31k questions
32.8k answers
501 comments
693 users