This is how I configured the deploy of my rails apps to AWS Elastic Beanstalk through CircleCI 1.0.
If you are using the Circle CI 2.0, take a look at this article from ryansimms
On Project Settings > Environment Variables add this keys:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
The aws user must have the right permissions. This can be hard, maybe, this can help you.
./setup-eb.sh
set -x
set -e
mkdir /home/ubuntu/.aws
touch /home/ubuntu/.aws/config
chmod 600 /home/ubuntu/.aws/config
echo "[profile eb-cli]" > /home/ubuntu/.aws/config
echo "aws_access_key_id=$AWS_ACCESS_KEY_ID" >> /home/ubuntu/.aws/config
echo "aws_secret_access_key=$AWS_SECRET_ACCESS_KEY" >> /home/ubuntu/.aws/config
Add the awsebcli dependency:
dependencies:
pre:
- sudo apt-get update
- sudo apt-get install python-dev
- sudo pip install awsebcli
Add the deployment config:
deployment:
production:
branch: master
commands:
- bash ./setup-eb.sh
- eb deploy
- If your deploy user don't have the
elasticbeanstalk:DescribeEvents
permission, theeb deploy
will run for ever. CircleCI will cancel it after 10 minutes and break the build with timeout.
eb init
will create this file for you. However, if you don't want to run it, you can simply create and configure this file manualy:
./elasticbeanstalk/config.yml
branch-defaults:
master:
environment: you-environment-name
global:
application_name: your-application-name
default_ec2_keyname: ec2-key-pair-name
default_platform: 64bit Amazon Linux 2015.03 v1.4.3 running Ruby 2.2 (Puma)
default_region: sa-east-1
profile: eb-cli
sc: git
@euharrison
I am trying to follow your cue i.e " fill the AWS KEY and SECRET in the CircleCI site, you can remove the bash ./setup-eb.sh and just use the command eb deploy --profile default"
It asks for running eb init and
eb init is stuck without selecting any option, (new to eb commands). What needs to be done here?