How can I delete my VPC that is shared with another AWS account?

2 minute read
0

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:

  1. Open the AWS Resource Access Manager (AWS RAM) console on the participant account.
  2. Under Shared with me, select Resource shares.
  3. Verify that the Resource shares ID matches the shared resources in the parent VPC.
  4. Review the resource type and verify that the resource is in the Available state.
  5. After identifying the resources, select Leave resource share. This un-shares the resources from the parent VPC.
  6. 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:

  1. Open the Amazon Elastic Compute Cloud (Amazon EC2) console.
  2. Under Network and Security, choose Network interfaces.
  3. Review the list of active elastic network interfaces and then delete the active resources associated with them.
  4. 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?

AWS OFFICIAL
AWS OFFICIALUpdated 2 years ago