DEV Community

Pritam Pramanik
Pritam Pramanik

Posted on

How to run rails console on elastic beanstalk rails app

  1. Put all you environment variable into .env file root of your project directory.
sudo su - -c "cd /var/app/current; /opt/elasticbeanstalk/bin/get-config --output YAML environment | sed 's/: /=/g' > .env"
Enter fullscreen mode Exit fullscreen mode
  1. Set environment variable from .env file
export $(grep -v '^#' .env | xargs -d '\n')
Enter fullscreen mode Exit fullscreen mode
  1. Run your rails console based rails environment(production/staging/test/development etc).
RAILS_ENV=production bundle exec rails c
Enter fullscreen mode Exit fullscreen mode

Oldest comments (0)