Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 775
Femi Avatar asked May 03 '13 21:05

Femi


1 Answers

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:

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

  2. Help to you isolate production and staging environments.

like image 189
Vadym Fedorov Avatar answered Oct 14 '22 07:10

Vadym Fedorov