How do I view the RDS_ prefixed environment variables in AWS ElasticBeanstalk?

Here's how to do it.

First ssh into the eb instance.

eb ssh

Then un the following command

sudo /opt/elasticbeanstalk/bin/get-config environment --output YAML

Alternatively --output YAML can be --output json.

Or if you want you can pipe the variables into a node command like this:

#!/usr/bin/env node
var strings = []
process.stdin.resume()
process.stdin.setEncoding('utf8')
process.stdin.on('data', function(data) {
  var json = JSON.parse(data)
  for (var key in json) {
    var val = json[key]
    strings.push(key + '="' + val + '"')
  }
})
process.stdin.on('end', function() {
  var output = strings.join('\n')
  process.stdout.write(output)
})

And use source to have .ebextension scripts get access to the env variables.


Just Simple.

You should go to environment configurations of the current application being running over your elastic beanstalk.

First ssh into the elastic beanstalk instance like the above answer.

ssh eb

If you wanna show the environment variables related to RDS (like RDS_DB_NAME), then

cat /opt/python/current/env

You will also see some variables of aws:elasticbeanstalk:application:environment in option_settings together, typed before.

Additionally, if you want to apply that environment variables,

source /opt/python/current/env

And you can see those variables by scripting env