I have Python code installed in an AWS Elastic Beanstalk environment. This code uses RDS_DB_NAME (and other related environment variables) in the setttings.py file. E.g.
DATABASES = {}
try:
from local_settings import *
except ImportError, e:
DATABASES = {
'default': {
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
},
'ENGINE': 'django.db.backends.mysql',
'NAME': os.environ['RDS_DB_NAME'],
'USER': os.environ['RDS_USERNAME'],
'PASSWORD': os.environ['RDS_PASSWORD'],
'HOST': os.environ['RDS_HOSTNAME'],
'PORT': os.environ['RDS_PORT'],
}
}
I want to change within the Elastic Beanstalk dashboard where these environment variable point. I.e I want them to point to a different existing RDS database.
Can anyone tell me where in the dashboard these can be changed?
Use option settings You can use Elastic Beanstalk configuration files to set environment properties and configuration options in your source code. To define environment properties, use the aws:elasticbeanstalk:application:environment namespace.
Environment properties are written to the /opt/python/current/env file, which is sourced into the virtualenv stack where the application runs. For more information, see Using the Elastic Beanstalk Python platform.
IU assume you've NOT asked beanstalk to create the RDS for you, which you shouldn't have due to lack of flexibility. If you open the beanstalk console, navigate to your environment => configuration => software configuration => environment properties. There you can set RDS_DB_NAME
and other environment vars.
This works perfectly for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With