Deleting an NSG
Delete a network security group (NSG) from a virtual cloud network (VCN).
To delete an NSG, it must not contain any VNICs or parent resources. When a parent resource (or a compute instance VNIC) is deleted, it's automatically removed from the NSGs it was in. You might not have permission to delete a particular parent resource. Contact your administrator to determine who owns a given resource.
The Console displays a list of parent resources that are in an NSG, with a link to each parent resource. If the parent resource is a compute instance, the Console also displays the instance's VNIC or VNICs that are in the NSG.
To remove a parent resource from its NSGs without deleting the resource, first view the parent resource's details in the Console. There you can see a list of the NSGs that the resource belongs to. From there, you can click Edit and remove the resource from all NSGs. If you're instead working with a compute instance, view the details of the specific VNIC that you want to remove from the NSGs.
- Open the navigation menu, click Networking, and then click Virtual cloud networks.
- Click the name of the VCN you're interested in.
- Under Resources, click Network Security Groups.
- For the NSG that you want to delete, click the to the right side of it, and then select Terminate.
- Confirm when prompted.
If you're using the REST API, the
ListNetworkSecurityGroupVnicsoperation lists the parent resources and VNICs in an NSG. Use the resource's Update operation to remove the resource from the NSGs. For example, for a Compute instance, use the
UpdateVnicoperation . For a load balancer, use the
UpdateNetworkSecurityGroupsoperation, and so on.
Run the DeleteNetworkSecurityGroup operation to delete an NSG.