Skip to content

Instantly share code, notes, and snippets.

@dwwoelfel
Created August 1, 2014 21:05
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save dwwoelfel/b859cee4b5f41af37ffd to your computer and use it in GitHub Desktop.
Save dwwoelfel/b859cee4b5f41af37ffd to your computer and use it in GitHub Desktop.
Rough notes for setting up elastic beanstalk on CircleCI

In your repo's root directory, check in a requirements.txt with

boto==2.30.0

Then, from the project's Project Settings > Environment Variables page, add the two env vars: AWS_ACCESS_KEY_ID and AWS_SECRET_KEY, with an IAM key that can deploy to eb.

Then create a bash script to set up eb:

setup-eb.sh:

#!/usr/bin/env bash

set -x
set -e

wget https://s3.amazonaws.com/elasticbeanstalk/cli/AWS-ElasticBeanstalk-CLI-2.6.3.zip -O /home/ubuntu/AWS-ElasticBeanstalk-CLI-2.6.3.zip
cd /home/ubuntu && unzip AWS-ElasticBeanstalk-CLI-2.6.3.zip
echo 'export PATH=$PATH:/home/ubuntu/AWS-ElasticBeanstalk-CLI-2.6.3/eb/linux/python2.7/' >> ~/.circlerc

cd /home/ubuntu/$CIRCLE_PROJECT_REPONAME && bash /home/ubuntu/AWS-ElasticBeanstalk-CLI-2.6.3/AWSDevTools/Linux/AWSDevTools-RepositorySetup.sh

# set up credentials

touch /home/ubuntu/.aws-credentials
chmod 600 /home/ubuntu/.aws-credentials
echo "AWSAccessKeyId=$AWS_ACCESS_KEY_ID" > /home/ubuntu/.aws-credentials
echo "AWSSecretKey=$AWS_SECRET_KEY" >> /home/ubuntu/.aws-credentials
echo 'export AWS_CREDENTIAL_FILE=/home/ubuntu/.aws-credentials' >> ~/.circlerc

And then, in the deployment section of your circle.yml add the following:

deployment:
  production:
    branch: master
    commands:
      - bash ./setup-eb.sh
      - git aws.push
@gthorsen
Copy link

gthorsen commented Nov 7, 2014

How did you get this running without initializing elastic beanstalk via "eb init", followed by application specific prompts?

@RobertoSchneiders
Copy link

@dwwoelfel Thanks for sharing, this really helped me. I created a gist explaining how to deploy using the new EB Cli with eb deploy. https://gist.github.com/RobertoSchneiders/9e0e73e836a80d53a21e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment