EC2 / Client / delete_security_group
delete_security_group#
- 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 network interface or is referenced by another security group, the operation fails with
DependencyViolation
.See also: AWS API Documentation
Request Syntax
response = client.delete_security_group( GroupId='string', GroupName='string', DryRun=True|False )
- Parameters:
GroupId (string) – The ID of the security group.
GroupName (string) – [Default VPC] The name of the security group. You can specify either the security group name or the security group ID. For security groups in a nondefault VPC, you must specify the security group ID.
DryRun (boolean) – Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation
. Otherwise, it isUnauthorizedOperation
.
- Returns:
None
Examples
This example deletes the specified security group.
response = client.delete_security_group( GroupId='sg-903004f8', ) print(response)
Expected Output:
{ 'ResponseMetadata': { '...': '...', }, }