aws-sg-ip-updater.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:AWS-SG-IP-Updater 作者: prasket 项目源码 文件源码
def add_ip(current_ip, sg_id, port, protocol):
    """Add current IP to the security group"""

    # setup client for ec2
    client = boto3.client("ec2")

    # execute security group ingress Boto3 commands
    # TODO: Add in try for graceful error handling
    response = client.authorize_security_group_ingress(
        GroupId=sg_id,
        IpProtocol=protocol,
        FromPort=port,
        ToPort=port,
        CidrIp=current_ip
    )
    print response
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号