Home > Software engineering >  Cannot delete EC2
Cannot delete EC2

Time:04-12

I'm trying to delete my EC2 instances which I believe were created when I used Amplify for my authentication. But everytime I delete my EC2 instance, it spawns another instance. I research and I found out that if it was created using ELB, then I should delete that ELB instance first. So that's what I tried to do, delete the ELB instance. But even that causes an error and won't delete my ELB instance

Now I am stuck, and I am being billed by AWS because of these running instances that I am not able to delete. Please advse,

ERROR

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

ERROR

Deleting security group named: <...> 
failed Reason: resource <...> has a dependent object (Service: AmazonEC2; 
Status Code: 400; 
Error Code: DependencyViolation; 
Request ID: <...>; 
Proxy: null)

ERROR

Deleting security group named: <...>-stack-AWSEBSecurityGroup-<...> 
failed Reason: resource <...> has a dependent object (Service: AmazonEC2; 
Status Code: 400; 
Error Code: DependencyViolation; 
Request ID: <...>; 
Proxy: null)

Is it because I deleted the RDS first before deleting the ELB?

CodePudding user response:

Instances in Elastic Beanstalk run in Autoscaling Group. That's why it spans new ones when you delete them.

You should delete your EB environment. This will take care of deleting the autoscaling group with the instance.

  • Related