| 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 |
| Name | Description | Required |
|---|---|---|
|
|
Name of the security group to delete. Type: String Default: None Condition: Either |
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 |
Conditional |
The elements in the following table are wrapped in a
DeleteSecurityGroupResponse structure.
| Name | Description |
|---|---|
|
|
The ID of the request. Type: xsd:string |
|
|
Returns true if the request succeeds. Otherwise, returns an error. Type: xsd:boolean |
This example deletes the EC2 security group named websrv.
https://ec2.amazonaws.com/?Action=DeleteSecurityGroup &GroupName=websrv &AUTHPARAMS
This example deletes the VPC security group with ID sg-77d0f5a2.
https://ec2.amazonaws.com/?Action=DeleteSecurityGroup &GroupId=sg-77d0f5a2 &AUTHPARAMS
<DeleteSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/"> <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> <return>true</return> </DeleteSecurityGroupResponse>