Last Updated: February 25, 2016
·
3.355K
· freshdroid

Manage multiple AWS accounts with CLI (eb for Elastic Beanstalk)

If you want to be able to push to different accounts in AWS there is a simple way.

First of all you have to install the Command line Tool and follow this instrucctions
Getting started with Eb to deploy your first proyect.

That will create a hidden folder in your proyect named .elasticbeanstalk with two files in it: config and optionsettings.your-env that are useful to change your elasticbeanstalk options.

Now open the config file and look for a line similar to this one (usually the third one):

AwsCredentialFile=YOUR_PATH/.elasticbeanstalk/aws_credential_file

I recommend to change that file name to something like your_proyect_aws_credential_file.

Now go to the path pointed to by AwsCredentialFile YOUR_PATH/.elasticbeanstalk/aws_credential_file and make a copy of that file named as you noted before (your_proyect_aws_credential_file).
You can edit manually that file to add or change your AWS Access Keys:

AWSAccessKeyId=AKIAXXXXXXXXXXXXXX
AWSSecretKey=dgC1XXXXXXXXXXXXXXXXXXXXXXXXXX

Now you can push the proyect as you will normally do with the git aws.push command.

You will have to create a new file called your_proyect_aws_credential_file for each proyect from different accounts that you want to manage with eb.