Skip to content

EC2  >  Operations  >  revoke_security_group_ingress

revoke_security_group_ingress

Operation

revoke_security_group_ingress async

revoke_security_group_ingress(request: RevokeSecurityGroupIngressInput | RevokeSecurityGroupIngressInputDict, /, *, plugins: list[Plugin] | None = None) -> RevokeSecurityGroupIngressOutput
revoke_security_group_ingress(*, plugins: list[Plugin] | None = None, **kwargs: Unpack[RevokeSecurityGroupIngressInputDict]) -> RevokeSecurityGroupIngressOutput

Removes the specified inbound (ingress) rules from a security group.

You can specify rules using either rule IDs or security group rule properties. If you use rule properties, the values that you specify (for example, ports) must match the existing rule's values exactly. Each rule has a protocol, from and to ports, and source (CIDR range, security group, or prefix list). For the TCP and UDP protocols, you must also specify the destination port or range of ports. For the ICMP protocol, you must also specify the ICMP type and code. If the security group rule has a description, you do not need to specify the description to revoke the rule.

For a default VPC, if the values you specify do not match the existing rule's values, no error is returned, and the output describes the security group rules that were not revoked.

For a non-default VPC, if the values you specify do not match the existing rule's values, an InvalidPermission.NotFound client error is returned, and no rules are revoked.

Amazon Web Services recommends that you describe the security group to verify that the rules were removed.

Rule changes are propagated to instances within the security group as quickly as possible. However, a small delay might occur.

Parameters:

Name Type Description Default
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
RevokeSecurityGroupIngressOutput

An instance of RevokeSecurityGroupIngressOutput.

Input

Pass the input fields as keyword arguments, or pass a model or dictionary as the first positional argument. Pass plugins separately as a keyword argument.

Model

RevokeSecurityGroupIngressInput dataclass

Bases: _SerdeShape

Dataclass for RevokeSecurityGroupIngressInput structure.

Attributes
cidr_ip class-attribute instance-attribute
cidr_ip: str | None = ...

The CIDR IP address range. You can't specify this parameter when specifying a source security group.

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.

from_port class-attribute instance-attribute
from_port: int | None = ...

If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP, this is the ICMP type or -1 (all ICMP types).

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 must specify either the security group ID or the security group name in the request. For security groups in a nondefault VPC, you must specify the security group ID.

ip_permissions class-attribute instance-attribute
ip_permissions: list[IpPermission] | None = ...

The sets of IP permissions. You can't specify a source security group and a CIDR IP address range in the same set of permissions.

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

The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers). Use -1 to specify all.

security_group_rule_ids class-attribute instance-attribute
security_group_rule_ids: list[str] | None = ...

The IDs of the security group rules.

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

[Default VPC] The name of the source security group. You can't specify this parameter in combination with the following parameters: the CIDR IP address range, the start of the port range, the IP protocol, and the end of the port range. The source security group must be in the same VPC. To revoke a specific rule for an IP protocol and port range, use a set of IP permissions instead.

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

Not supported.

to_port class-attribute instance-attribute
to_port: int | None = ...

If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP, this is the ICMP code or -1 (all ICMP codes).

Dictionaries

RevokeSecurityGroupIngressInputDict

Bases: TypedDict

Dictionary form of RevokeSecurityGroupIngressInput.

Attributes
cidr_ip instance-attribute
cidr_ip: str | None

The CIDR IP address range. You can't specify this parameter when specifying a source security group.

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

from_port instance-attribute
from_port: int | None

If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP, this is the ICMP type or -1 (all ICMP types).

group_id instance-attribute
group_id: str | None

The ID of the security group.

group_name instance-attribute
group_name: str | None

[Default VPC] The name of the security group. You must specify either the security group ID or the security group name in the request. For security groups in a nondefault VPC, you must specify the security group ID.

ip_permissions instance-attribute
ip_permissions: Sequence[IpPermission | IpPermissionDict] | None

The sets of IP permissions. You can't specify a source security group and a CIDR IP address range in the same set of permissions.

ip_protocol instance-attribute
ip_protocol: str | None

The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers). Use -1 to specify all.

security_group_rule_ids instance-attribute
security_group_rule_ids: Sequence[str] | None

The IDs of the security group rules.

source_security_group_name instance-attribute
source_security_group_name: str | None

[Default VPC] The name of the source security group. You can't specify this parameter in combination with the following parameters: the CIDR IP address range, the start of the port range, the IP protocol, and the end of the port range. The source security group must be in the same VPC. To revoke a specific rule for an IP protocol and port range, use a set of IP permissions instead.

source_security_group_owner_id instance-attribute
source_security_group_owner_id: str | None

Not supported.

to_port instance-attribute
to_port: int | None

If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP, this is the ICMP code or -1 (all ICMP codes).

Output

RevokeSecurityGroupIngressOutput dataclass

Bases: _SerdeShape

Dataclass for RevokeSecurityGroupIngressOutput structure.

Attributes

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.

revoked_security_group_rules class-attribute instance-attribute
revoked_security_group_rules: list[RevokedSecurityGroupRule] | None = ...

Details about the revoked security group rules.

unknown_ip_permissions class-attribute instance-attribute
unknown_ip_permissions: list[IpPermission] | None = ...

The inbound rules that were unknown to the service. In some cases, unknownIpPermissionSet might be in a different format from the request parameter.