36

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?

2
  • 1
    Did you solve the problem? I had the same problem. My environment is green and healthy but I can´t apply any change on it. I waited days and nothing changed. Mar 31, 2016 at 20:01
  • This issue will also occur if you try to run two deploys against the same environment simultaneously.
    – skeggse
    Jul 1, 2016 at 19:03

13 Answers 13

14

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.

6
  • Presumably if you want to retain the environment name, you'll have to do this twice (first to switch to a temporary environment name). Alternatively, if you can afford the downtime, there's an option to 'Rebuild Environment', which seems to fix this issue. Apr 30, 2016 at 14:33
  • "Rebuild Environment" doesnt help when AWS provisions you one with too small of a DB instance for the RDS instance type chosen :(
    – Todd
    Dec 14, 2016 at 21:40
  • I think this is a bit drastic, considering I had a similar issue and simply restarted the server to get it working again
    – Jad S
    Jan 15, 2018 at 12:50
  • 12
    AWS won't let me clone an environment if it's not "ready"
    – posit labs
    Feb 13, 2019 at 22:33
  • 1
    If you can't clone the environment on the EB dashboard (per @positlabs), try cloning via the CLI. Sep 19, 2019 at 21:18
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.

1
  • This worked for me too, even though my application doesn't respond to the health check URL I configured (/health). Note that you may need to be patient! Since triggering the abort, it took 17 minutes before EB was happy enough for me to perform my next action.
    – stwr667
    Sep 7, 2021 at 13:21
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

1

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.

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.

1
  • how you do blue/green with beanstalk ?
    – jah
    Feb 28, 2019 at 15:43
1

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.

1
  • Mine was caused by an invalid cert in the load balancer. The mechanism to change the bad cert requires the cert to be valid. Ope
    – jws
    Jun 11, 2020 at 16:16
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..!

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!

0

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.

0

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.

1
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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.