How to make two Elastic Beanstalk environments share one database instance

I have a rails elastic beanstalk application with two environments, staging and production. When creating the application and staging environment with eb init i created a database instance. I used the eb console to create the production environment and created a new database instance which i perceive is obviously a wrong move.

How do i make my two environments share the same database instance? If that happens, how about when i update the database migrations in my app and deploy to the staging; it means my users would see it because the same database is used by staging environment.

How to i handle this issue?

I also noticed git aws.push doesn't overwrite my database but it doesn't remove rolled back migrations. Am i missing something?


I would recommend to you following option: Create rds instance outside of the elastic beanstalk environment. Create separate schemas for production and staging. Pass connections strings to your EBS application. Shared rds instance between EBS environments will help to you:

  • Decrease cost of your environment, because to have several rds instances running is expensive.

  • Help to you isolate production and staging environments.

  • 链接地址: http://www.djcxy.com/p/71310.html

    上一篇: 我可以使用gcc编译一个函数,然后在clang中使用它吗?

    下一篇: 如何使两个Elastic Beanstalk环境共享一个数据库实例