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

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?


Solution 1:

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.

Solution 2:

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.

Solution 3:

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.

Solution 4:

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

Solution 5:

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.