Can you run a rails console or rake command in the elastic beanstalk environment?

None of these solutions mentioned here worked for me, so I cooked up a little script that I put in script/aws-console.

You can run it from the /var/app/current directory as root:

eb ssh
cd /var/app/current
sudo script/aws-console

My script can be found as a Gist here.


Don't know why, but since EBS runs everything as root, this worked for me:

sudo su
bundle exec rails c production

For rails, jump to /var/app/current then as @juanpastas said, run RAILS_ENV=production bundle exec rails c