Deleting a Subnet

You can delete an empty subnet that you no longer need. This action does not delete the route table and security groups used for this subnet.

Deleting a Subnet Using Cockpit v1

Before you begin: Terminate all instances in the subnet. For more information, see Terminating Instances.

  1. Click VPC > VPCs.

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

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

  4. Click Delete to validate.
    The subnet is deleted and no longer appears on the VPCs page.

Deleting a Subnet Using Cockpit v2-beta

Before you begin: Delete all virtual machines (VMs) in the Subnet. For more information, see Terminating Instances.

  1. In the Nets dashboard, click the ID of the Net where the Subnet you want to delete is.
    The Subnet panel appears.

  2. Click inside the Subnet panel to make checkboxes appear.

  3. Check the box of the Subnet you want to delete.
    The Subnet is selected and an action menu is displayed.

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

  5. Click Delete Subnet to validate.
    The Subnet is deleted.

Deleting a Subnet Using AWS CLI

Before you begin: Terminate all instances in the subnet. For more information, see Terminating Instances.

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

Request sample
$ aws ec2 delete-subnet \
    --profile YOUR_PROFILE \
    --subnet-id subnet-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.

  • subnet-id: The ID of the subnet.

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

The subnet 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.