@get_or_create(get_security_group)
def create_security_group(client, group_name, vpc, description, rules):
    'Method to create a security group based on the group_name and authorize ingress with\n    the rules provided.\n    Args:\n        client (boto client): Region specific boto client\n        group_name (str): security group name\n        description (str): description of the security group\n        vpc (VPC Object): VPC object to create the security group\n        rules (dict): List of rules to add to security group.\n    '
    sg = vpc.create_security_group(GroupName=group_name, Description=description)
    try:
        for rule in rules:
            sg.authorize_ingress(IpProtocol=rule['ip_protocol'], CidrIp=rule['cidr_ip'], FromPort=rule['from_port'], ToPort=rule['to_port'])
    except Exception as e:
        logging.error('Authorize Security Group Ingress failed: {}'.format(e))
        sg.delete()
        raise YBOpsRuntimeError('Security Group creation failed.')
    return sg
Method to create a security group based on the group_name and authorize ingress with
the rules provided.
Args:
    client (boto client): Region specific boto client
    group_name (str): security group name
    description (str): description of the security group
    vpc (VPC Object): VPC object to create the security group
    rules (dict): List of rules to add to security group.
@get_or_create(get_security_group)
def create_security_group(client, group_name, vpc, description, rules):
    'Method to create a security group based on the group_name and authorize ingress with\n    the rules provided.\n    Args:\n        client (boto client): Region specific boto client\n        group_name (str): security group name\n        description (str): description of the security group\n        vpc (VPC Object): VPC object to create the security group\n        rules (dict): List of rules to add to security group.\n    '
    sg = vpc.create_security_group(GroupName=group_name, Description=description)
    try:
        for rule in rules:
            sg.authorize_ingress(IpProtocol=rule['ip_protocol'], CidrIp=rule['cidr_ip'], FromPort=rule['from_port'], ToPort=rule['to_port'])
    except Exception as e:
        logging.error('Authorize Security Group Ingress failed: {}'.format(e))
        sg.delete()
        raise YBOpsRuntimeError('Security Group creation failed.')
    return sg