I'm a bit confused as to how to setup ElasticBeanstalk such that different branches of a repository can deploy to different environments, or even possibly different accounts.
For example, I have a repository which has a development and production branch. On development we might have features which get tested locally and merged to development. Stable development gets deployed to production.
Our AWS account structure is setup similarly - we have a production account and a development account only.
What I want to be able to do is exclusively use one repository to deploy to both accounts, just by switching branches. However, I don't know how to write the .elasticbeanstalk/config.yml file in order to do that properly, or whether it is even possible since the two accounts are separate.
I know that you can do something like
branch-defaults:
dev:
environment: "dev-environment"
But then there's a global setting which corresponds to the actual AWS key pair. Not sure what that does.
The other confusing part is how the ebcli works.
If I want to use different profiles I'm used to doing a command like eb list --profile user1 or eb list --profile user2 where the different profiles are setup in ~/.aws/credentials, however this doesn't seem to allow me to access different environments on different accounts. For example, if I have a development and production account, eb list will still only show the production account environments because I'm guessing that's where I did eb init in the first place. When I switch branches, however, I would like to be able to switch to the AWS development account environnents so that my deployments are always synced.
It is also worth mentioning that when I first created the git repository there was only a development branch and a master branch, and the eb initialization was made with that in mind. I want to add a production branch now to the current repository and shift everything over, basically.
Is this possible to accomplish? Let me know if any clarity is needed.