Why can't I delete my Amazon Virtual Private Cloud (Amazon VPC) that's shared with another AWS account?
Short description
Before deleting a VPC that's shared with another AWS account, review any dependencies and active components within the shared resources. 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 deactivates the resource sharing from the parent VPC.
- Delete the shared VPC.
Deactivating shared subnets doesn't have a direct impact on the active resources. However, you must terminate all active resources within the activated or deactivated 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: After you terminate the resources, it might take up to a minute to remove the elastic network interface from the account.
Related information
VPC sharing: A new approach to multiple accounts and VPC management
I tried to delete my Amazon VPC, but I received a dependency error. How can I delete my Amazon VPC?