Delete Virtual Private Clouds in Amazon Web Services.
VPCs can only be deleted when all of their dependent resources are deleted, and AWS does not provide any tools to do this automatically.
To install the latest aws-delete-vpc
release run:
$ go install github.com/isovalent/aws-delete-vpc@latest
To build aws-delete-vpc
from source please run the following locally:
$ go build .
Syntax:
$ aws-delete-vpc -vpc-id=$VPC_ID
or
$ aws-delete-vpc -cluster-name=$CLUSTER_NAME
This will attempt to delete the specified VPC and its dependent resources. Several attempts may be needed due to limitations of the AWS API.
If the optional -cluster-name
flag is passed then the VPC ID will be
discovered automatically and any EKS cluster with the same name deleted after
the VPC is deleted.
Currently the program is unable to identify AutoScalingGroups associated with
the VPC unassisted. Instead, it looks for and deletes AutoScalingGroups with the
tag key and value specified by the autoscaling-tag-key
and
autoscaling-tag-label
command line flags.
Many AWS API calls return incorrect values that prevent the program from operating correctly. Known problems include:
-
DeleteVpc
will return aDependencyViolation
error when there are no dependent resources, but the VPC will eventually be deleted. -
InstanceTerminatedWaiter
s return that an instance has terminated before it has actually terminated, meaning that deleting related resources (e.g. NetworkInterfaces) will fail. -
There is no API to wait for a NetworkInterface to be detached.
Some resources (e.g. InternetGateways, NetworkInterfaces, and VpnGateways) must be detached before they can be deleted. If the program is interrupted between detachment and deletion these resources will not be deleted the next time the program is run.
Future: may lose resources if program is interrupted between detach and delete.
- I tried to delete my Amazon VPC, and I received a dependency error. How can I delete my Amazon VPC?
- add --all-dependencies option to ec2 delete-vpc
Apache-2.0