This sequence works for me, in deploying Rails 5.1.4 to Elastic Beanstalk using PostgreSQL:
- Deploy your code to EB. I use the EB console but you might use the CLI instead.
- SSH to the EC2 app server
- Change to the app directory: cd /var/app/current/
BTW, I needed to close pgAdminIII which I was using to examine the RDS database. Since I was connected, this locks the database and prevents the last step.
I also had RAILS_SKIP_MIGRATIONS set to TRUE in the EB console (under Configuration > Software). Presumably if you left this on its default value of FALSE, the deployment would run any migrations required.
So in answer to the original question, you run the rails db:reset (or rails db:migrate) on the app server. You don't (and can't) SSH to the RDS server.