Why can't I delete my Amazon Virtual Private Cloud (Amazon VPC) that's shared with another AWS account?
Short description
When deleting a VPC that's shared with another AWS account, it's a best practice to review any dependencies and active components within the shared resources before deleting the VPC. The most common errors that occur when deleting shared VPCs are:
- "Unable to delete, the VPC contains one or more in-use network interfaces."
- "Network interface associated - Delete the network interface, or associate with a different security group."
Resolution
To verify shared subnets and active resources, do the following:
- Open the AWS Resource Access Manager (AWS RAM) console on the participant account.
- Under Shared with me, select Resource shares.
- Verify that the Resource shares ID matches the shared resources in the parent VPC.
- Review the resource type and verify that the resource is in the Available state.
- After identifying the resources, select Leave resource share. This un-shares the resources from the parent VPC.
- Delete the shared VPC.
Un-sharing subnets doesn't have a direct impact on the active resources. However, you must terminate all active resources within the shared or un-shared VPC to delete the parent VPC. To verify active resources, do the following:
- Open the Amazon Elastic Compute Cloud (Amazon EC2) console.
- Under Network and Security, choose Network interfaces.
- Review the list of active elastic network interfaces and then delete the active resources associated with them.
- Delete the VPC.
Note: It might take 30 to 60 seconds for the elastic network interface to be removed from the account after you terminate the resources.
Related information
VPC sharing: A new approach to multiple accounts and VPC management
I tried to delete my Amazon VPC, and I received a dependency error. How can I delete my Amazon VPC?