Deleting a VPC

You can delete an empty Virtual Private Cloud (VPC) that you no longer need. With Cockpit, you can choose to delete the VPC only, or to delete it and all its associated resources at the same time.

Deleting a VPC Using Cockpit v1

Deleting a VPC Only

Before you begin: Delete or detach all resources associated with the VPC:

  1. Disassociate External IPs (EIPs) from resources in the VPC. For more information, see Disassociating an EIP from an Instance or a Network Interface.

  2. Terminate instances in the VPC. For more information, see Terminating Instances.

    This action automatically deletes BSU volumes with the DeleteOnTermination attribute set to true that are attached to the instances.

    To prevent data loss, you can:
    - Create backups of the volumes using snapshots. For more information, see Creating a Snapshot of a Volume.
    - Set the DeleteOnTermination attribute to false for each volume to prevent its deletion. For more information, see Modifying an Instance Attribute.

  3. Delete:

    1. VPC peering connections. For more information, see Deleting a VPC Peering Connection.

    2. Custom route tables. For more information, see Deleting a Route Table.

    3. Internet gateways, virtual private gateways, and NAT gateways. For more information, see Deleting an Internet Gateway, Deleting a Virtual Private Gateway, and Deleting a NAT Gateway.

    4. Load balancers and VPC endpoints. For more information, see Deleting a Load Balancer and Deleting a VPC Endpoint.

    5. Security groups. For more information, see Deleting a Security Group.

    6. Flexible network interfaces (FNIs) created in the subnets. For more information, see Deleting an FNI.

    7. Subnets in the VPC. For more information, see Deleting a Subnet.

  1. Click VPC > VPCs.

  2. Click the VPC you want to delete.
    The VPC is selected.

  3. Click Delete .
    A confirmation dialog box appears.

  4. Click Delete to validate.
    The VPC is deleted.

Deleting a VPC and its Associated Resources

  1. Click VPC > VPCs.

  2. Click the VPC you want to delete.
    The VPC is selected.

  3. Click Teardown .
    A confirmation dialog box appears.

  4. Click Teardown to validate.
    The External IPs (EIPs) and DHCP options set associated with resources in the VPC are disassociated.
    The following resources are deleted with the VPC:

    • Instances

      This action automatically deletes BSU volumes with the DeleteOnTermination attribute set to true that are attached to the instances.

      To prevent data loss, you can:
      - Create backups of the volumes using snapshots. For more information, see Creating a Snapshot of a Volume.
      - Set the DeleteOnTermination attribute to false for each volume to prevent its deletion. For more information, see Modifying an Instance Attribute.

    • Internet gateways, virtual private gateways, and NAT gateways

    • Custom route tables and their routes

    • Flexible network interfaces (FNIs)

    • Load balancers

    • Security groups

    • Subnets

    • VPC peering connections

      Routes in the route tables of the peered VPC are not deleted.

      A summary of the deleted resources and their IDs appears.

Deleting a Net Using Cockpit v2-beta

Deleting a Net Only

Before you begin: Delete or unlink all resources associated with the Net:

Some prerequisite actions might not be available using Cockpit v2-beta yet. You can still perform those actions using Cockpit v1 or the APIs.

  1. Unlink public IPs from resources in the Net. For more information, see Disassociating an EIP from an Instance or a Network Interface.

  2. Delete virtual machines (VMs) in the Net. For more information, see Terminating Instances.

    This action automatically deletes BSU volumes with the DeleteOnVmDeletion attribute set to true that are attached to the virtual machines.

    To prevent data loss, you can:
    - Create backups of the volumes using snapshots. For more information, see Creating a Snapshot of a Volume.
    - Set the DeleteOnVmDeletion attribute to false for each volume to prevent its deletion. For more information, see Modifying an Instance Attribute.

  3. Delete:

    1. Net peering connections. For more information, see Deleting a VPC Peering Connection.

    2. Custom route tables. For more information, see Deleting a Route Table.

    3. Internet services, virtual gateways, and NAT services. For more information, see Deleting an Internet Gateway, Deleting a Virtual Private Gateway, and Deleting a NAT Gateway.

    4. Load balancers and Net access points. For more information, see Deleting a Load Balancer and Deleting a VPC Endpoint.

    5. Security groups. For more information, see Deleting a Security Group.

    6. Network interface cards (NICs) created in the Subnets. For more information, see Deleting an FNI.

    7. Subnets in the Net. For more information, see Deleting a Subnet.

  1. Click inside the Nets dashboard to make checkboxes appear.

  2. Check the box of the Net you want to delete.
    The Net is selected and an action menu appears.

    You can delete multiple Nets by selecting several at a time.

  3. Click IconTerminate Delete.
    A confirmation dialog box appears.

  4. Click Delete Net to validate.
    The DHCP options set associated with the Net is disassociated and the Net is deleted.

Deleting a Net and its Associated Resources

  1. Click inside the Nets dashboard to make checkboxes appear.

  2. Check the box of the Net you want to tear down.
    The Net is selected and an action menu appears.

  3. Click IconTeardown Tear Down Net.
    A confirmation dialog box appears.

  4. Click Tear Down Net to validate.
    The DHCP options set associated with the Net is disassociated.
    The following resources are deleted with the Net:

    • Virtual machines (VMs)

      This action automatically deletes BSU volumes with the DeleteOnVmDeletion attribute set to true that are attached to the virtual machines.

      To prevent data loss, you can:
      - Create backups of the volumes using snapshots. For more information, see Creating a Snapshot of a Volume.
      - Set the DeleteOnVmDeletion attribute to false for each volume to prevent its deletion. For more information, see Modifying an Instance Attribute.

    • Internet services, virtual gateways, and NAT services

    • Custom route tables and their routes

    • Network interface cards (NICs)

    • Load balancers

    • Security groups

    • Subnets

    • Net peering connections

    • Net access points

    • VPN connections

    • Public IPs

      A summary of the deleted resources and their IDs appears.

Deleting a VPC Using AWS CLI

Before you begin: Delete or detach all resources associated with the VPC:

  1. Disassociate External IPs (EIPs) from resources in the VPC. For more information, see Disassociating an EIP from an Instance or a Network Interface.

  2. Terminate instances in the VPC. For more information, see Terminating Instances.

    This action automatically deletes BSU volumes with the DeleteOnTermination attribute set to true that are attached to the instances.

    To prevent data loss, you can:
    - Create backups of the volumes using snapshots. For more information, see Creating a Snapshot of a Volume.
    - Set the DeleteOnTermination attribute to false for each volume to prevent its deletion. For more information, see Modifying an Instance Attribute.

  3. Delete:

    1. VPC peering connections. For more information, see Deleting a VPC Peering Connection.

    2. Custom route tables. For more information, see Deleting a Route Table.

    3. Internet gateways, virtual private gateways, and NAT gateways. For more information, see Deleting an Internet Gateway, Deleting a Virtual Private Gateway, and Deleting a NAT Gateway.

    4. Load balancers and VPC endpoints. For more information, see Deleting a Load Balancer and Deleting a VPC Endpoint.

    5. Security groups. For more information, see Deleting a Security Group.

    6. Flexible network interfaces (FNIs) created in the subnets. For more information, see Deleting an FNI.

    7. Subnets in the VPC. For more information, see Deleting a Subnet.

To delete a VPC, use the delete-vpc command following this syntax:

Request sample
$ aws ec2 delete-vpc \
    --profile YOUR_PROFILE \
    --vpc-id vpc-12345678 \
    --endpoint https://fcu.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • vpc-id: The ID of the VPC.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The specified VPC is deleted.

Related Pages

Corresponding API Method

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.