I want to delete VPC through CLI. But get an error:
A client error (DependencyViolation) occurred when calling the DeleteVpc operation: The vpc 'vpc-xxx' has dependencies and cannot be deleted.
How can I list all dependencies that prevent me from deleting this VPC?
here's what finally worked for me, using the AWS CLI. I'm aware there are other dependencies besides subnets, but this is a start:
OK, so that didn't work on all of mine. here's another one:
I believe there is no CLI function that will return what is causing the DependencyViolation error, so you have two choices:
I just found this script: https://aws.amazon.com/premiumsupport/knowledge-center/troubleshoot-dependency-error-delete-vpc/
that helped me to find the issue. Maybe it will be useful.
Here is an AWS article that lists all items that must be deleted before deleting the VPC.
https://aws.amazon.com/premiumsupport/knowledge-center/troubleshoot-dependency-error-delete-vpc/
In principle this one works if it is re-run several times ... with some 5s between the runs ... Yet I am sure that it has some bugs ... so feel free to edit / suggest additional functionalities ...