Skip to content

Latest commit

 

History

History
80 lines (52 loc) · 2.33 KB

README.md

File metadata and controls

80 lines (52 loc) · 2.33 KB

aws-delete-vpc

Delete Virtual Private Clouds in Amazon Web Services.

Motivation

VPCs can only be deleted when all of their dependent resources are deleted, and AWS does not provide any tools to do this automatically.

Installation

To install the latest aws-delete-vpc release run:

$ go install github.com/isovalent/aws-delete-vpc@latest

Build

To build aws-delete-vpc from source please run the following locally:

$ go build .

Usage

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.

Known limitations

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 a DependencyViolation error when there are no dependent resources, but the VPC will eventually be deleted.

  • InstanceTerminatedWaiters 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.

References

License

Apache-2.0