Menu
AWS Elastic Beanstalk
Developer Guide (API Version 2010-12-01)

branch

Note

This version of EB CLI and its documentation have been replaced with version 3 (in this section, EB CLI 3 represents version 3 and later of EB CLI). For information on the new version, see The Elastic Beanstalk Command Line Interface (EB CLI).

Description

Maps a Git branch to a new or existing Elastic Beanstalk environment and configures the mapped environment through a series of prompts. You must first create the Git branch. If no branches exist in the Git repository, eb displays a message that prompts you to run the branch command. Eb then attempts to start the application specified in the default settings in the optionsettings file.

To map a Git branch, first run git checkout <branch>, specifying the name of the Git branch you want to map. Then run eb branch. If the branch has never been mapped to an Elastic Beanstalk environment, you'll have the option to copy the most current environment settings to the new environment.

Consider the following additional information about using branch:

  • If you run eb init on an existing repository and change the application name, region, or solution stack, the command resets all existing branch mappings. Run branch again to map each branch to an environment.

  • You can map different Git branches to the same Elastic Beanstalk environment but in most cases maintain one-to-one relationships between branches and environments.

For a tutorial that describes how to use eb to deploy a Git branch to Elastic Beanstalk, see Deploying a Git Branch to a Specific Environment.

Syntax

eb branch

Options

Name

Description

Required

-e

or

--environment name ENVIRONMENT_NAME

The environment to which you want to map the current Git branch. If you do not use this option, you'll be prompted to accept the autogenerated environment name or enter a new one.

Type: String

Default: <Git-branch-name>-env

No

Common options

For more information, see Eb Common Options.

No

Output

None

Example

The following example maps the Git branch master to a new environment called MyApp-env-test, using the same settings as a previously created environment called Myapp-env. Replace the red placeholder text with your own values.

PROMPT> eb branch 

The current branch is "master".
Enter an AWS Elastic Beanstalk environment name (auto-generated value is "MyApp-master-env"): MyApp-env-test
Do you want to copy the settings from environment "MyApp-env" for the new branch? [y/n]: y
PROMPT> eb status
Environment "MyApp-env-test" is not running.