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:

  1. Click inside the Security Groups dashboard to make checkboxes appear.

  2. Check the box of the security group you want to delete.

    Multiselection is available.

    The security group is selected and an action menu appears.

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

  4. 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:

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.

Request sample
$ 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.

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

Deleting a Security Group Using AWS CLI

Before you begin: Ensure that the security group you want to delete:

To delete a security group, use the delete-security-group command following this syntax:

Request sample
$ 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 the group-name attribute.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

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.