def remove_ip(current_ip, sg_id, port, protocol):
"""remove current IP from the security group"""
# setup client for ec2
client = boto3.client("ec2")
# execute security group revoke ingress Boto3 commands
response = client.revoke_security_group_ingress(
GroupId=sg_id,
IpProtocol=protocol,
FromPort=port,
ToPort=port,
CidrIp=current_ip
)
print response
# Define the usage of the app
评论列表
文章目录