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.

- 3,921
- 2
- 25
- 30
-
i figured at-least one thing that i am on wrong branch of the application. How can i change application i want to work on using eb commands ? – Ash Singh Mar 06 '17 at 01:57
5 Answers
Did you forgot to run eb create --single
after eb init
?
This command creates a new environment. See EB CLI Command Reference »

- 35,493
- 19
- 190
- 259
-
I see that hathlogic says he created 3 environments. I hope my answer will help other searchers who visit this page. – naXa stands with Ukraine Mar 01 '19 at 19:34
-
i don't understand why this comand is not referenced at all in the amazon documentation. someone needs to tell them – frei Jun 09 '20 at 02:59
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.

- 9,246
- 2
- 23
- 30
-
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. – Ash Singh Mar 06 '17 at 02:44
-
Oh with "wrong branch" you really mean wrong repository. It's a totally different application? – pinedax Mar 06 '17 at 02:48
-
yeah I am in a different application. I want to switch to another application. – Ash Singh Mar 06 '17 at 03:14
-
run `eb init` from the root of your app. Here's a link that gives you detail explanation of how to configure the deploy http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html. – pinedax Mar 06 '17 at 03:23
-
1It was missing IAM permission in my case. This helped: https://stackoverflow.com/questions/33038941/elastic-beanstalk-iam-developer-permissions – Iran R Feb 22 '22 at 08:38
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.

- 7,672
- 15
- 65
- 89
I faced the same issue here. It turned out being a region related trick.
In my case, it initially seems like related to the way I created the environment. I used the following command to create the env:
eb create --sample -r ap-southeast-1 -im 2 -ix 4 --vpc.elbpublic --vpc.ec2subnets AppSubA, AppSubB --vpc.dbsubnets DbSubA, DbSubB node-express-dev
Note that I created the env in Singapore region. After that, if I use "eb list", the result is empty. Why? I will touch upon it later.
However, if I use the command like this:
eb create --sample node-express-env
The "eb list" will be able to find the created env.
For the 1st cmd, as I said, it was created in Singapore. However, before the creation, in the "eb init" cmd, I didn't specify region. So, "eb cli" is by default in us-west-2. That's why it cannot list the created env. To fix it, before the creation, the command
eb init -p "64bit Amazon Linux 2 v5.5.3 running Node.js 16" --region ap-southeast-1
should be perfomed.
For the 2nd cmd, it is created in us-west-2, and "eb cli" is also in the same region. Both are in the default region. As a result, it can show it.
Hopefully this can help some cases.

- 1,043
- 2
- 13
- 22
In my case, I've launched EB environment with AWS web console.
- Previous environment A
- New environment B
I was using eb cli with A(previous environment).
- eg.
eb deploy
And I want to change my eb cli environment into B(new environment). However several commands not working for me(Never show environment B).
eb init
eb list
Finally, I removed .elasticbeanstalk
directory and succeeded eb init
.
I think EB has lots of unstable issues for its custom setting.

- 371
- 3
- 14