21

I have an Elastic Beanstalk app and environment already setup. I've just downloaded the Dev Tools CLI/eb on Windows, and would like to use eb to push to said environment.

If I use eb init, I have to create a new EB app and environment.

How do I initialize the git repo to an existing EB app and environment?

starball
  • 20,030
  • 7
  • 43
  • 238
Dan Hoerst
  • 6,222
  • 2
  • 38
  • 51

4 Answers4

40

The way I ended up doing this was:

1) Download AWSDevTools from http://aws.amazon.com/developertools/AWS-Elastic-Beanstalk/6752709412171743

2) Move to your git repo on the CLI

3) Run /Downloads/elasticbeanstalk-cli/AWSDevTools/[Linux or Windows]/AWSDevTools-RepositorySetup.sh

EDIT: 3a) git aws.config

4) Enter AWS Access Key, AWS Secret Key, AWS Region, and enter the existing name of your AWS Application and AWS Environment.

5) Now you can git add, git commit as usual, and use git aws.push to push to your EB environment

7) You can follow the steps above to add other environments. For example if you had production and staging environments, and then use git aws.push --environment to use the same repo to push to both environments.

If you come across the error The specified module 'AWSDevTools' was not loaded on Windows, this is most likely because the AWSDevTools module is not at C:\Users\ USER \Documents\WindowsPowerShell\AWSDevTools\AWSDevTools.ps1.

Dan Hoerst
  • 6,222
  • 2
  • 38
  • 51
  • 4
    then you missed an important step. After 3), you need to enter "git aws.config" before step 4). Answer is incomplete as that is an important step – frostymarvelous Nov 23 '13 at 11:10
  • I have an existing environment. I created a blank repo and ran awsdevtools and aws.config. Is there a way to pull the existing environment? – kapitanluffy Jun 28 '14 at 03:18
  • 4
    Keep in mind this is for an older eb cli version. If you run the newest EB CLI 3.X you can simply do 'eb init', select the region and then it will prompt you to choose one of your existing applications or to create a new one if you so desire. – lbrandao Dec 22 '14 at 18:39
  • FYI: The question assumes you already have an EB environment, but if not, before step 3) you need to run `AWSDevTools-OneTimeSetup.bat` first. – Michael Currie Jan 27 '15 at 22:01
9
  1. Install DevTools
  2. Run the repository setup
  3. git aws.config
aldrinleal
  • 3,559
  • 26
  • 33
6

If you installed with brew install aws-elasticbeanstalk you can find the script at /usr/local/Cellar/aws-elasticbeanstalk/2.5.1/libexec/AWSDevTools/Linux/AWSDevTools-RepositorySetup.sh.

After you ran it you need to run git aws.config.

webjay
  • 5,358
  • 9
  • 45
  • 62
4

Install the EB CLI version 3 or later:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html

Then run

eb init

Version 3 of the CLI lets you attach a git repo to an existing environment via init.

Zags
  • 37,389
  • 14
  • 105
  • 140