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 IconView details icon of the Net where the Subnet you want to delete is.
    The Subnet panel appears.

  2. Check the box of the Subnet you want to delete.
    The Subnet is selected.

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

  4. Click Delete.
    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.

    • RequestId: The ID of the request.

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

Deleting a Subnet Using oapi-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
$ oapi-cli --profile "default" DeleteSubnet \
    --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.

    • RequestId: The ID of the request.

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

Deleting a Subnet Using AWS CLI

Before you begin:

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:

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.