Deleting a Security Group
You can delete a custom security group that is no longer used for any virtual machine (VM) or in any security group rule, and that does not contain any rule.
You cannot delete default security groups.
Deleting a Security Group Using Cockpit v2
Before you begin: Ensure that the security group you want to delete:
For more information, see Getting Information About Your Security Groups and Removing Rules from a Security Group. |
-
In the Security Groups dashboard, check the box of the security group you want to delete.
Multiselection is available.
The security group is selected.
-
Click Delete.
A confirmation dialog box appears. -
Click Delete.
The security group is deleted.
Deleting a Security Group Using OSC CLI
Before you begin: Ensure that the security group you want to delete:
For more information, see Getting Information About Your Security Groups and Removing Rules from a Security Group. |
The DeleteSecurityGroup command deletes a specified security group.
You can specify either the name of the security group or its ID.
This action fails if the specified group is associated with a virtual machine (VM) or referenced by another security group.
$ osc-cli api DeleteSecurityGroup --profile "default" \
--SecurityGroupId "sg-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. -
SecurityGroupId
: (optional) The ID of the security group you want to delete. -
SecurityGroupName
: (optional) The name of the security group.
The DeleteSecurityGroup 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 Security Group Using oapi-cli
Before you begin: Ensure that the security group you want to delete:
For more information, see Getting Information About Your Security Groups and Removing Rules from a Security Group. |
The DeleteSecurityGroup command deletes a specified security group.
You can specify either the name of the security group or its ID.
This action fails if the specified group is associated with a virtual machine (VM) or referenced by another security group.
$ oapi-cli --profile "default" DeleteSecurityGroup \
--SecurityGroupId "sg-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. -
SecurityGroupId
: (optional) The ID of the security group you want to delete. -
SecurityGroupName
: (optional) The name of the security group.
The DeleteSecurityGroup 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 Security Group Using AWS CLI
Before you begin:
For more information, see Getting Information About Your Security Groups and Removing Rules from a Security Group. |
To delete a security group, use the delete-security-group command following this syntax:
$ aws ec2 delete-security-group \
--profile YOUR_PROFILE \
--group-id sg-12345678 \
--group-name my-security-group \
--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. -
(optional)
group-id
: The ID of the security group. -
(optional)
group-name
: The name of the security group.-
In a Virtual Private Cloud (VPC), you need to specify the
group-id
attribute. -
In the public Cloud, you can specify the
group-id
or thegroup-name
attribute.
-
-
endpoint
: The endpoint corresponding to the Region you want to send the request to. For more information, see Installing and Configuring AWS CLI.
The specified security group 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.