def get_instance_id()

in NodePortController/src/main.py [0:0]


def get_instance_id(node_name):
    node = api_instance.read_node(node_name)
    node_metadata = node.metadata
    node_labels = node_metadata.labels
    instance_id = node_labels['alpha.eksctl.io/instance-id']
    ec2 = boto3.resource('ec2', region_name='us-west-2')
    instance = ec2.Instance(instance_id)
    public_ip = instance.public_ip_address
    #TODO use the nodeName to get the labels from the node.
    #The label alpha.eksctl.io/instance-id is the instance ID of the instance
    #Return instance ID and public IP address of instance
    logging.debug(instance_id, public_ip)
    return instance_id, public_ip