| Did this page help you? Yes No Tell us about it... |
Deletes a security group. This action applies to both EC2 security groups and VPC security groups. For information about VPC security groups and how they differ from EC2 security groups, go to Security Groups in the Amazon Virtual Private Cloud User Guide.
![]() | Note |
|---|---|
If you attempt to delete a security group that contains instances, or attempt to delete a security group that is referenced by another security group, an error is returned. For example, if security group B has a rule that allows access from security group A, security group A cannot be deleted until the rule is removed. The fault returned is |
The short version of this command is ec2delgrp.
ec2-delete-group {
group_name | group_id
}
| Name | Description | Required |
|---|---|---|
|
|
Name of the EC2 security group to delete. Type: String Default: None Condition: Either the group name or the group ID is required. Example: websrv |
Conditional |
|
|
ID of the security group to delete. Type: String Default: None Condition: Required for a VPC security group. For an EC2 security group, either the group name or the group ID is required. Example: sg-32fa9d3e |
Conditional |
| Option | Description |
|---|---|
|
|
Overrides the Region specified in the Default: The Example: |
|
|
Default: The Example: |
|
|
The private key to use when constructing requests to Amazon EC2. Default: The value of the Example: |
|
|
The X.509 certificate to use when constructing requests to Amazon EC2. Default: The value of the Example: |
|
|
Specifies a connection timeout (in seconds). Example: --connection-timeout 30 |
|
|
Specifies a request timeout (in seconds). Example: --request-timeout 45 |
|
|
Displays verbose output by showing the SOAP request and response on the command line. This is particularly useful if you are building tools to talk directly to our SOAP API. |
|
|
Displays column headers in the output. |
|
|
Shows empty columns as |
|
|
Do not display tags for tagged resources. |
|
|
Prints internal debugging information. This is useful to assist us when troubleshooting problems. |
|
|
Displays Help. |
|
|
If Example: |
The command returns a table that contains the following information:
Boolean true or false
Amazon EC2 command line tools display errors on stderr.
This example deletes the EC2 security group called webserv.
PROMPT>ec2-delete-group websrvRETURN true
This example deletes the VPC security group with ID sg-43eeba92.
PROMPT>ec2-delete-group sg-43eeba92RETURN true