47

I get a message when I am trying to deploy my php app on EC2 using Elastic Beanstalk.

Environment named *** is in an invalid state for this operation. Must be Ready.

I am unable to deploy. The server status is running, no warnings.

My experience is very limited at this point. How can I resolve this?

Tim
  • 33,870
  • 7
  • 56
  • 84

14 Answers14

15

Usually, there's no way to recover from an invalid state for a given environment.

In such cases, you need to go to the current environment page, click on the Actions button, select Clone Environment, and then wait for the clone environment to be created. Once it's ready, you can go to the application page, click on the Actions button and then select SWAP URLs.

Finally, you can go to the inconsistent environment page and choose to terminate it.

anderson
  • 301
9

I solved this problem by going to Elastic Beanstack, my app was GRAY status/health, from the app overview I accessed the Actions button and Aborted the current operation.

Then I got the health status GREEN, and managed to deploy.

4

This happened to me. If this is a newly created app you should wait a few moments for the environment to come online, then try again. It should work.

4

Go to Actions -> Rebuild Environment. That solved the problem for me. Hope it helps! AWS Elasticbeanstalk Menu: Actions -> Rebuild

2

It happened when I aborted when it was in

INFO: Environment update is starting.

state (right after "Uploading").

It returned back to Ready after a few minutes, I just had to wait.

2

In my case, I couldn't execute any action on the Elastic Beanstalk. I had to rebuild the entire Elastic Beanstalk Application with a new Load Balancer.

kimy82
  • 121
1

last time it happened i was able to clone using cli but now I'm having worst issue, I created new ami then I did update the environment then I aborted the update, but the old AMI is already deleted, now I'm stuck and cloning the environment doesn't help because the old AMI is no longer exists

I also tried to update the AMI using awscli and still getting the same message!

this question is now 4 years old and still no solution provided by AWS..!

1

If you use autoscaling, set your min and max instances to 0. Wait for the environment to update, then revert back to your original values.

digout
  • 111
1

Mine was in pending state, it wouldn't let me change the configuration and I couldn't abort current operation.
I saved the configuration and launched a new environment using the saved configuration. Right before creating a new environment, I was able to change the configuration.

Jun
  • 121
1

Rebuilding environment worked for me, but it does incur a downtime if the application is already running. As mentioned Blue Green deployment is the correct way out of it.

0

Also had this problem recently while testing permissions. I set up an IAM policy to test tagging environments that were not prod. The tag creation failed as the policy was lacking a few related permissions (ec2, autoscaling) but this failed attempt to add a tag completely destroyed the environment leaving no choice but to rebuild it. Way to go AWS!

J99
  • 101
0

in my case that happened because i start creating an RDS Database without waiting the creation of environment. to correct this you need to rebuild environment

0

In my case I had first deleted the RDS instance, then tried deleting the Environment so Elastic Bean was looking for my RDS instance which it couldn't find.

So I went to RDS and restored the database associated with my Elastic Bean environment.

It worked!

ahcyT
  • 101
-1

Só consegui resolver clonando o ambiente e removendo o anterior. Não aceitava nem recriar, clonei e depois exclui o antigo.

Agradeço o conselho de vocês ajudou muito.