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. |
-
In the Nets dashboard, click the ID of the Net where the Subnet you want to delete is.
The Subnet panel appears. -
Click inside the Subnet panel to make checkboxes appear.
-
Check the box of the Subnet you want to delete.
The Subnet is selected and an action menu is displayed. -
Click
Delete.
A confirmation dialog box appears. -
Click Delete Subnet.
The Subnet is deleted.
Deleting a Subnet Using Cockpit v1
Cockpit v1 is no longer fixed nor supported. For more information, see End-of-Life Policy. |
Before you begin: Terminate all instances in the subnet. For more information, see Terminating VMs. |
-
Click VPC > VPCs.
-
Click the VPC in which the subnet you want to delete is.
The VPC is selected. -
Click Delete subnet .
A confirmation dialog box appears. -
Click Delete to validate.
The subnet is deleted and no longer appears on the VPCs page.
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
$ 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.
-
{
"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:
$ 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.