Search code examples
amazon-web-servicesamazon-elastic-beanstalk

How to change the AWS account using the Elastic Beanstalk CLI


I deployed an app using elastic beanstalk to my personal AWS account..Now I want to change the AWS credentials so the eb cli knows to deploy to a different account. But it does not ask me for the AWS keys when I type "eb init". Where do I specify this?


Solution

  • I had to add a new profile to this file ~/.aws/config. Example of the file with 2 profiles:

    [profile eb-cli]
    aws_access_key_id = XXXXXXXXXXXXX
    aws_secret_access_key = XXXXXXXXXXXX
    
    [profile eb-cli2]
    aws_access_key_id = XXXXXXXXXX
    aws_secret_access_key = XXXXXXXXXXXX
    

    Also make sure to update the profile value in your application .elasticbeanstalk/config.yml

    To init using the new profile, use:

    eb init --profile [profilename]