EC2.Client.
delete_security_group
(**kwargs)¶Deletes a security group.
If you attempt to delete a security group that is associated with an instance, or is referenced by another security group, the operation fails with InvalidGroup.InUse
in EC2-Classic or DependencyViolation
in EC2-VPC.
Note
We are retiring EC2-Classic. We recommend that you migrate from EC2-Classic to a VPC. For more information, see Migrate from EC2-Classic to a VPC in the Amazon Elastic Compute Cloud User Guide .
See also: AWS API Documentation
Request Syntax
response = client.delete_security_group(
GroupId='string',
GroupName='string',
DryRun=True|False
)
DryRunOperation
. Otherwise, it is UnauthorizedOperation
.None
Examples
This example deletes the specified security group.
response = client.delete_security_group(
GroupId='sg-903004f8',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}