How to configure Elastic Beanstalk for RDS

2019-05-19 17:44发布

I have a requirement to deploy both a production and staging application using AWS Elastic Beanstalk.

I would like the production environment to use an independently created RDS database so I can rebuild my environment without tearing down my RDS database.

I would like the staging environment to create a brand new RDS database each time it is deployed.

After initialising my environment with

eb init

one of the questions ask

Create an RDS DB Instance? [y/n]:

The result of this configuration appears to be stored in a file "config" within the .elasticbeanstalk directory. This directory is added to .gitignore.

How then can I have two git branches, production and staging, configured so that one creates an RDS database when started, and the other does not?

1条回答
▲ chillily
2楼-- · 2019-05-19 18:09

I suggest removing the config file from .gitignore and storing two different versions of this file in the two branches - one with RDS and one without.

Update

Your usecase can be satisfied with 'eb branch'. You can then have multiple environments with different configurations. Just select 'n' for the question that asks if you want to copy settings from environment to another. You should then be able to create an environment without an RDS and an environment with an RDS. You can switch between different environments using git checkout then. That way you don't have to remove the file from .gitignore.

More documentation on eb branch here.

查看更多
登录 后发表回答