Elastic Beanstalk "eb" command not recognized upgrading to version 2.0

config-translation

#1

We can successfully build and deploy or elastic beanstalk application in Version 1.0. In Version 2.0, we can build the image, deploy it to the repository and build the container, however, when we use the “eb” command to deploy into our elastic beanstalk environment, we get an error “/bin/sh: eb: not found”

I believe there is something in by .circleci/config.yml that is not configured correctly. I’ve tried installing all the dependencies I can find. The relevant snippet is:
- run:
environment:
DEPLOY_TYPE: dev-1
name: build image and deploy
command: |
chmod +x deploy_development.sh
apk add --update python python-dev py-pip build-base jq zip
pip install --upgrade --user awsebcli
sh ./deploy_development.sh
eb deploy pray-dev-1 --stage -v --label $CIRCLE_BRANCH-$CIRCLE_BUILD_NUM

The output I get is:
ALPHA-dev-1-1772: digest: sha256:35c26b13b579058710870da1a4c1bb725730e1d6d8b362087783e51dbdc2a93d size: 3062
adding: Dockerrun.aws.json (deflated 34%)
adding: .ebextensions/01_nginx.config (deflated 53%)
/bin/sh: eb: not found
Exited with code 127


#2

hey i have encounter the same issue with you.
Have you already find the solution?


#3

Yes, I did find a solution. The awsebcli had to be installed in the .circleci/config.yml file, not just in the deploy.sh script. So the config entry looks like:

      command: |
        chmod +x deploy-eb.sh
        #Installing pip and jq to facilitate ebs build in deploy-eb.sh
        apk add --update python python-dev py-pip build-base jq zip
        pip install --upgrade awsebcli
        sh ./deploy-eb.sh
        eb deploy pray-dev --stage -v --label $CIRCLE_BRANCH-$CIRCLE_BUILD_NUM

Also, it’s important that the “–user” flag is NOT included. The reason is that if the “–user” flag is used, it’ll install the awsebcli in the ~/.local directory and that directory is not in the PATH, so it will not be found. If the flag isn’t there, the awsebcli will be installed in the PATH.

I hope this helps and sorry it took me so long to see your question.


#4

For a full tutorial how to deploy to Beanstalk using CircleCI 2.0, you can checkout this repo: https://github.com/kgoedecke/circleci-beanstalk-example


#5