AWS Elastic Beanstalk : the command eb list shows no environments

10,744

Solution 1

The message itself is clear. You haven't set an environment for the branch you are working on.

You can either switch to the branch it's configure, but this means the changes you have in the current branch won't be available on deploy, unless you merge thos changes or you can set an environment for the branch you currently are using the command eb use name-of-your-env. This last can also be configured in the Elastic Beanstalk configuration file of your application.

Hope this helps.

Solution 2

Did you forgot to run eb create --single after eb init?

This command creates a new environment. See EB CLI Command Reference »

Solution 3

Perhaps this may help others. I already had an existing environment on Beanstalk and was setting up a new Mac.

For some reason, the eb init did create a file in ~/.aws/config. However, it only have key and secret. To get it to work, I need to add the region as well.

# ~/.aws/config 
[profile eb-cli]
aws_access_key_id = XXX
aws_secret_access_key = XXX
region=us-west-2

Next, I find my beanstalk config file in my application (i.e. project/.ebelasticbeanstalk/config.yml) and ensure that under global, it has profile: eb-cli

# project/.ebelasticbeanstalk/config.yml
global:
  default_region: us-west-2
  profile: eb-cli
  sc: git
  workspace_type: Application

After making those edits, eb list shows the environment I am expecting and I can do eb deploy again.

Share:
10,744
Ash Singh
Author by

Ash Singh

Updated on July 25, 2022

Comments

  • Ash Singh
    Ash Singh over 1 year

    I am using Elastic Beanstalk and I have created 3 different environments. I used awsebcli. All of a sudden the command eb list doesn't show me my enviroments because of which I am unable to deploy the environment. The error I am getting is ERROR: This branch does not have a default environment. You must either specify an environment by typing "eb status my-env-name" or set a default environment by typing "eb use my-env-name". I tried eb status 'my-env-name', again I got an error : ERROR: The environment name 'my-env-name' could not be found. In short: I am unable to use any eb command.

  • Ash Singh
    Ash Singh about 7 years
    Thank @apineda , but I already tried eb use name-of-my-env . It says that my environment doesn't exist. I already know why its giving this error. Its because eb is on the wrong branch (application). I have to take eb on another application and I don't know how to do it.
  • pinedax
    pinedax about 7 years
    Oh with "wrong branch" you really mean wrong repository. It's a totally different application?
  • Ash Singh
    Ash Singh about 7 years
    yeah I am in a different application. I want to switch to another application.
  • pinedax
    pinedax about 7 years
    run eb init from the root of your app. Here's a link that gives you detail explanation of how to configure the deploy docs.aws.amazon.com/elasticbeanstalk/latest/dg/….
  • naXa stands with Ukraine
    naXa stands with Ukraine about 5 years
    I see that hathlogic says he created 3 environments. I hope my answer will help other searchers who visit this page.
  • frei
    frei almost 4 years
    i don't understand why this comand is not referenced at all in the amazon documentation. someone needs to tell them
  • Iran R
    Iran R about 2 years
    It was missing IAM permission in my case. This helped: stackoverflow.com/questions/33038941/…