Unable to terminate elastic beanstalk environment

0

I deployed beanstalc env and application with terraform to eu-central-1 (Frankfurt). I can't delete it. I tried both Deletion failed with this log:

ERROR	A Service Role is required in this region. Please add a Service Role option to the environment. Refer to the Elastic Beanstalk documentation for more information.
INFO	Finished validating environment's EC2 instances for termination protection.
INFO	Validating environment's EC2 instances have termination protection disabled before performing termination.
INFO	terminateEnvironment is starting.

I'm not sure what's about region. Aren't service roles global?

After multiple attemps to fix permissions (including admin roles), recreate service roles (both customizable and default) etc. I finally decided to "Rebuild environment". Now it fails with following error:

ERROR	You must specify an Instance Profile for your EC2 instance in this region. See [Managing Elastic Beanstalk Instance Profiles](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/iam-instanceprofile.html) for more information.
INFO	Finished validating environment's EC2 instances for termination protection.
INFO	Validating environment's EC2 instances have termination protection disabled before performing termination.
INFO	terminateEnvironment is starting.

I created new role as instructed in the log message, but this error keeps showing.

How can I terminate the environment?

EDIT: I can't add "EC2 instance role" in Environment -> Configuration -> Configure service access due to "Environment named <some-name> is in an invalid state for this operation. Must be Ready". But cli command

aws elasticbeanstalk describe-environments

returns ""Status": "Ready""

Michal
asked 5 months ago203 views
1 Answer
0

Hello.

Isn't termination protection set on EC2?
If it is set, try removing it.

Finished validating environment's EC2 instances for termination protection.
Validating environment's EC2 instances have termination protection disabled before performing termination.

Please check the following document for information on configuring termination protection for EC2.
https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/terminating-instances.html#Using_ChangingDisableAPITermination

Also, CloudFormation is running behind the scenes in Elastic Beanstalk, so if the CloudFormation status is "CREATE_FAILED", the following error may occur.
Therefore, you can understand better by checking which resource creation caused the problem from the CloudFormation console.

Environment named <some-name> is in an invalid state for this operation. Must be Ready

It may also be possible to delete the stack directly from the CloudFormation console.
https://repost.aws/knowledge-center/elastic-beanstalk-deletion-failure

profile picture
EXPERT
answered 5 months ago
  • Thanks for your suggestions. Unfortunately, there are no EC2 instances nor a CloudFormation environment. No application was ever deployed to this environment. Is there something else worth checking?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions