Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add --all-dependencies option to ec2 delete-vpc #1721

Closed
meonkeys opened this issue Jan 13, 2016 · 68 comments
Closed

add --all-dependencies option to ec2 delete-vpc #1721

meonkeys opened this issue Jan 13, 2016 · 68 comments
Labels
ec2 feature-request A feature should be added or improved.

Comments

@meonkeys
Copy link

Feature request

support aws ec2 delete-vpc --all-dependencies --vpc-id vpc-deadbeef

Details

The AWS web console will delete a VPC along with all its dependencies. The aws cli tool says (when trying to delete a VPC with any dependencies): A client error (DependencyViolation) occurred when calling the DeleteVpc operation: The vpc 'vpc-deadbeef' has dependencies and cannot be deleted.

  1. Subnets
  2. Security Groups
  3. Network ACLs
  4. VPN Attachments
  5. Internet Gateways
  6. Route Tables
  7. Network Interfaces
  8. VPC Peering Connections

Maybe also add --vpn-connection.

@JordonPhillips JordonPhillips added feature-request A feature should be added or improved. ec2 labels Jan 13, 2016
@JordonPhillips
Copy link
Member

Something like this might be handy, but it requires more magic smoke than I'm really comfortable with. I would suggest making this request on the EC2 forums. If they add it to their API, we'll be able to pick it up immediately.

@meonkeys
Copy link
Author

@jrozansk
Copy link

I am in need for this feature, also.
👍 from me

@bzz
Copy link

bzz commented Sep 22, 2016

@JordonPhillips is not it all about just listing dependencies and removing them one by one, or is it something more than that?

@ghost
Copy link

ghost commented Feb 20, 2017

+1 Is there any progress with this feature?

@lianghong
Copy link

+1 frome me

@samfrances
Copy link

A definite +1

@erickfaustino
Copy link

+1

@stormyk
Copy link

stormyk commented May 2, 2017

+1 I have bunches of vpc's to be deleted.

@setevoy2
Copy link

setevoy2 commented May 3, 2017

+1

6 similar comments
@nicksuckling
Copy link

+1

@ale93p
Copy link

ale93p commented May 11, 2017

+1

@joejulian
Copy link

👍

@oyyblin
Copy link

oyyblin commented Jun 29, 2017

+1

@apsferreira
Copy link

+1

@seancurran157
Copy link

+1

@chankongching
Copy link

+1000

@snowsky
Copy link

snowsky commented Jul 24, 2017

+1

3 similar comments
@cwitte4191
Copy link

+1

@taylorsmithgg
Copy link

+1

@scollier
Copy link

+1

@freshyogurt
Copy link

+10000000

@lerkasan
Copy link

+1

5 similar comments
@serant
Copy link

serant commented Oct 20, 2017

+1

@rpaquito
Copy link

+1

@iasinDev
Copy link

+1

@shdobxr
Copy link

shdobxr commented Nov 7, 2017

+1

@PAgrawal16
Copy link

+1

@zukeru
Copy link

zukeru commented Jun 10, 2019

+99999999999999999

If anyone wants I can provide a nodejs script I utilize for doing just this when I delete a eks cluster with eksctl since it can't clean the vpc for some reason because of dependencies. :)

@munishase
Copy link

for doing just this when I delete a eks cluster with eksctl since it can't clean the vpc for some reason because of dependencies. :)

can yo share it?

@AkiraKane
Copy link

+99999999999999999

If anyone wants I can provide a nodejs script I utilize for doing just this when I delete a eks cluster with eksctl since it can't clean the vpc for some reason because of dependencies. :)

HAHAHA boss, I am trying the same thing !!

@scottstensland
Copy link

scottstensland commented Jul 25, 2019

Of course Amazon drags their feed in giving a cleanup tool
why should they since its a revenue generator to leave all these dangling unwanted resources running ... this has been an issue for MANY years ... since the beginning I dare say ... so sad

as a big fat band-aid it would be reasonable if the vps delete command ( along with all similar aws cli commands ) had a verbose mode which showed offending still attached resources which are preventing the delete - D'oh

@gregohardy
Copy link

This might help. It's in ruby, but it shows the ordering you need to delete VPC's. You will have to have tagged your resources to use this out of the box, but the order seem's to be key for a few of you. Resource order is a pain across the major Cloud's. We suffer daily. Hope this helps. If you have VPN gateways and peering you will just have to delete those before the rest of the resources in the script.

Opens the musty tome

https://gist.github.com/gregohardy/ef026eef3beddae49eb05ea0fe5993e0

@mjbright
Copy link

Of course Amazon drags their feed in giving a cleanup tool
why should they since its a revenue generator to leave all these dangling unwanted resources running ... this has been an issue for MANY years

So true unfortunately

@anjneeksharma
Copy link

is there any way i can get what are the dependency attached to particular resource so before deleting main resource i will delete dependency first.
for example i want to delete network interface but i am getting operation not allowd error.
can any one suggest me what the things i need to delete before deleting network interface.

@anjneeksharma
Copy link

i stuck in my task i want to delete all unused resource from my aws endvironment

@creslinux
Copy link

Seriously need this - can spend an entire day easily running around in circles trying to remove a VPC - its the most annoying nonsense.

@alexandrejuma
Copy link

This is a basic feature everyone needs. It took me days to implement a VPC resource crawler to remove everything.

+100000000000

@thscheer
Copy link

+1

@lianghong
Copy link

It's my script to delete a VPC with all dependencies
https://github.com/lianghong/delete_vpc

@TryTryAgain
Copy link

Similarly, I've used https://github.com/toddm92/vpc-delete in the past.

@paschalidi
Copy link

paschalidi commented Dec 4, 2020

@lianghong thanks you legend that worked like a charm!!

@kennyworkman
Copy link

@lianghong u charming devil

@cjobeili
Copy link

@lianghong THANK YOU !

@memark
Copy link

memark commented Aug 9, 2021

Any update on this? Still really needed.

@roeera
Copy link

roeera commented Nov 24, 2021

+1

4 similar comments
@wanghui17
Copy link

+1

@mayk0gan
Copy link

+1

@sebastianserrano
Copy link

+1

@matiassilverocfa
Copy link

+1

@twpayne
Copy link

twpayne commented Jul 14, 2022

I wrote a tool to delete a VPC and all of its dependencies: https://github.com/isovalent/aws-delete-vpc

@paololazzari
Copy link

The AWS cli functionality should reflect that which is available in the AWS console. This issue should be reopened

@voycey
Copy link

voycey commented Jul 6, 2023

Awful that this doesnt exist still

@tobiasparaiso
Copy link

We need this functionality to handle IaC!

@hyperfraise
Copy link

+1

@benbenben-be
Copy link

bump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ec2 feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests