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 v2

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

  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.
    The Subnet is deleted.

Deleting a Subnet Using OSC CLI

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

The DeleteSubnet command deletes a specified Subnet.
Before deleting the Subnet, you need to delete all resources associated with the Subnet:

  • Virtual machines (VMs)

  • Network Interface Cards (NICs)

  • NAT services

  • Load balancers

Request sample
$ osc-cli api DeleteSubnet --profile "default" \
    --SubnetId "subnet-12345678"

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

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • SubnetId: The ID of the Subnet you want to delete.

The DeleteSubnet command returns the following elements:

  • ResponseContext: Information about the context of the response.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Deleting a Subnet Using AWS CLI

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

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 Methods

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