Zolage
Zolage

Reputation: 573

Amazon Web Service can't delete an Elastic Beanstalk environment

I have a problem with AWS Elastic Beanstalk. I tried to delete an environment. It started the process, but after a few minutes the environment "health bar" went to grey and gave me the following errors:

"Deleting security group named: XXXXX failed Reason: resource YYYYY has a dependent object"
"Stack deletion failed: The following resource(s) failed to delete: [AWSEBSecurityGroup]."

I tried to delete the security group from the error message, but I got this:

"XXXXXX: resource XXXXX has a dependent object"

After this I wanted to delete the dependence from the EB environment, but because it's Grey, it didn't allow me to do that.

I browsed the internet for hours, found a possible solution, where I need to do something at the EC2's Network Interfaces page, but it doesn't say any specific option or information.

Upvotes: 57

Views: 36080

Answers (7)

vaquar khan
vaquar khan

Reputation: 11479

In my case i have white list EBS instance into RDS security group , so deleted from RDS solved problem.

Upvotes: 0

Tyler
Tyler

Reputation: 21

Had this happen where I was using the security group created by EB with a non-eb created RDS instance.

I modified the RDS instance to stop using the EB-created security group and was able to do a successful termination of the environment and application. I used the eb cli 3.x and eb terminate --all --force to get a fresh start on the application.

Upvotes: 2

Mayank
Mayank

Reputation: 1061

Try this, I was suggested by AWS support and it worked for me.

  • You need to go to your CloudFormation console and retry deletion of the CloudFormation stack which the Beanstalk environment used.
  • The deletion may fail, but after retrying it will prompt you if you want to skip the "AWSEBRDSDatabase" resource that failed to delete. You can just confirm that you want to skip deletion (since you have actually already deleted it).
  • This should remove the CloudFormation stack
  • Then you can retry deletion of the Beanstalk environment from the Beanstalk console.

Upvotes: 68

SuperNova
SuperNova

Reputation: 27486

In case this happens due to a similar error but due to RDS attached to this,

Stack deletion failed: The following resource(s) failed to delete: [AWSEBRDSDatabase].

This happens when you terminate the RDS instance manually from RDS listing console. I resolved this by launching another instance with the same DB instance ideIntifier name.

Once this is created, you can terminate the Elastic Beanstalk environment successfully. This works.

Upvotes: 8

Oded Breiner
Oded Breiner

Reputation: 29749

  1. Go to EC2 under AWS console's Compute
  2. Go to Security Groups under NETWORK & SECURITY on the sidebar
  3. Find your misbehaving security group on the page
  4. Check it and choose Delete Security Group from the Actions menu
  5. You will be presented with a link that will lead you to the security group or instances it depends on.
  6. Keep going until you get to the parent Security Group or instances and delete them.

Make sure you don't delete any important Security Groups or Instances!

Upvotes: 13

kaptan
kaptan

Reputation: 3149

Use https://github.com/mingbowan/sgdeps to find your security group dependencies and then break the dependencies.

Upvotes: 6

EFeit
EFeit

Reputation: 2142

Is the security group being referenced by RDS or something in S3? If that is the case, you'll have to delete the dependency in either RDS or S3.

The error message is saying something outside of your environment is still using the security group and it can't be deleted for this reason.

Upvotes: 44

Related Questions