There are several articles on using elastic beanstalk hooks to create and manage (start|stop|restart) background services (this example uses up-start) that govern rake tasks. This is not one of them; rather it is an amendment to those posts intended to provide you with an updated example. I recently upgraded my Elastic Beanstalk application to use Ruby 2.1 (Puma) and my services stopped working. I made some minor changes to get stuff working again.
Disclaimer: There are better ways to accomplish this (see rails sidekiq), but you may still find this useful. Consider it the "copy/paste path of least resistance" for upgrading older projects.
Put the file in root/.ebextensions/