Skip to content

Instantly share code, notes, and snippets.

@kkemple
Forked from dwwoelfel/gist:b859cee4b5f41af37ffd
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkemple/b1aa0ce612330b5028cf to your computer and use it in GitHub Desktop.
Save kkemple/b1aa0ce612330b5028cf 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment