Connecting PSQL and Rails Console to Elastic Beanstalk In this post, we explore a solution to the challenge of running the Rails console against a PostgreSQL database housed in a private subnet for security reasons. While it's a good security practice, it can limit access for bootstrapping users or debugging issues. By tunnelling through a Bastion server, we can establish a connection to the database as if it was running locally. We walk through code examples of SSH tunneling, database connection, and how to run Rails console. A key point is to ensure the Bastion server is shut down after use. 21 May 2017