DGaffneyDC
DGaffneyDC

Reputation: 162

Deploying multiple branches to separate AWS Elastic Beanstalk applications using AWS Code Commit and Git

I have a repo set up locally to track a remote repo on AWS Code Commit. This repo has two permanent branches: 'master' and 'development'. I am trying to deploy each branch to separate Elastic Beanstalk applications, where one is used for production and the other for testing.

For each branch, I've used the EB CLI tool to create an application instance that tracks the appropriate remote branch in code commit. The first branch I do this with (master) always works, but once I add an application to track the 'development' branch I seem to create a duplicate remote called 'codecommit-origin', which I do not have access to edit. Example:

codecommit-origin   https://git-codecommit.us-region-1.amazonaws.com/v1/repos/some_repo (fetch)
codecommit-origin   https://git-codecommit.us-region-1.amazonaws.com/v1/repos/some_repo (push)
origin  ssh://git-codecommit.us-region-1.amazonaws.com/v1/repos/some_repo (fetch)
origin  ssh://git-codecommit.us-region-1.amazonaws.com/v1/repos/some_repo (push)

I do not have permission to access the 'codecommit-origin' remote, and removing it removes my ability to deploy the application, throwing this error:

ERROR: AttributeError :: 'NoneType' object has no attribute 'split'

For obvious reasons, this makes deploying updates to my application pretty painful. I essentially have to reset my remote with "git remote add origin [url]", push my commits, run "eb init" again, deploy, then remove the "codecommit-origin" it creates every time I want to change something.

Is there a better way to manage this workflow of deploying two elastic beanstalk applications from two branches in a single code commit repo?

Upvotes: 0

Views: 1369

Answers (1)

Marina Liu
Marina Liu

Reputation: 38136

For master branch to deploy a beanstalk application, you can use the way eb init, ed create and eb deply.

To add development branch and environment, you need to use below steps:

git checkout development
# commit some changes
eb create
eb use --source

More detail, you can refer config additional branches and environments.

Upvotes: 2

Related Questions