Skip to content

EC2  >  Operations  >  delete_security_group

delete_security_group

Operation

delete_security_group async

delete_security_group(input: DeleteSecurityGroupInput, plugins: list[Plugin] | None = None) -> DeleteSecurityGroupOutput

Deletes a security group.

If you attempt to delete a security group that is associated with an instance or network interface, is referenced by another security group in the same VPC, or has a VPC association, the operation fails with DependencyViolation.

Parameters:

Name Type Description Default
input DeleteSecurityGroupInput

An instance of DeleteSecurityGroupInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
DeleteSecurityGroupOutput

An instance of DeleteSecurityGroupOutput.

Input

DeleteSecurityGroupInput dataclass

Bases: _SerdeShape

Dataclass for DeleteSecurityGroupInput structure.

Attributes

dry_run class-attribute instance-attribute
dry_run: bool | None = ...

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 is UnauthorizedOperation.

group_id class-attribute instance-attribute
group_id: str | None = ...

The ID of the security group.

group_name class-attribute instance-attribute
group_name: str | None = ...

[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.

Output

DeleteSecurityGroupOutput dataclass

Bases: _SerdeShape

Dataclass for DeleteSecurityGroupOutput structure.

Attributes

group_id class-attribute instance-attribute
group_id: str | None = ...

The ID of the deleted security group.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.

return_ class-attribute instance-attribute
return_: bool | None = ...

Returns true if the request succeeds; otherwise, returns an error.