Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can the RDS_DB_NAME setting for an Elastic Beanstalk environment be changed

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?

like image 387
Bill Noble Avatar asked Dec 18 '15 13:12

Bill Noble


People also ask

How do you update environment variables in Elastic Beanstalk?

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.

Where are Elastic Beanstalk environment variables stored?

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.


1 Answers

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.

like image 100
Tal Avatar answered Oct 01 '22 04:10

Tal