Using Console
Using CLI
<security-group-id>
with the ID of the security group that has the misconfigured port range, and <port-range>
with the range of ports that need to be removed.
For example, if the security group ID is sg-1234567890
and the misconfigured port range is 0-65535
, the command would be:
<security-group-id>
with the ID of the security group that you updated. Verify that the misconfigured port range is no longer listed in the security group rules.
Using Python
authorize_security_group_ingress
and revoke_security_group_ingress
methods of the ec2
client.describe_security_groups
method of the ec2
client to retrieve the security group rules and checking that only the required ports are allowed.