| « PreviousNext » | |
![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Deletes a security group.
Important
If you attempt to delete a security group that contains instances, or
is referenced by another security group, the operation fails with InvalidGroup.InUse
for EC2-Classic or DependencyViolation for EC2-VPC.
A security group is for use with instances either in the EC2-Classic platform or in a specific VPC. For more information, see Amazon EC2 Security Groups in the Amazon Elastic Compute Cloud User Guide and Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide.
GroupNameThe name of the security group.
Type: String
Default: None
Required: Conditional
Condition: For EC2-Classic, default VPC, you can specify either GroupName or
GroupId
GroupIdThe ID of the security group.
Type: String
Default: None
Required: Conditional
Condition: Required for a nondefault VPC; for EC2-Classic, default VPC,
you can specify either GroupName or GroupId
The following elements are returned in a
DeleteSecurityGroupResponse element.
requestIdThe ID of the request.
Type: xsd:string
returnReturns true if the request succeeds. Otherwise, returns an error.
Type: xsd:boolean
This example deletes the security group for EC2-Classic named websrv.
https://ec2.amazonaws.com/?Action=DeleteSecurityGroup &GroupName=websrv &AUTHPARAMS
This example deletes the security group for EC2-VPC with the ID
sg-1a2b3c4d.
https://ec2.amazonaws.com/?Action=DeleteSecurityGroup &GroupId=sg-1a2b3c4d &AUTHPARAMS
<DeleteSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/"> <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> <return>true</return> </DeleteSecurityGroupResponse>