def get_public_ip()

in backend/lambda_function.py [0:0]


def get_public_ip(eni_id):

    # This function will retrive the fqdn of the servers
    # InvalidNetworkInterfaceID.NotFound as error:

    try:
        eni = ec2.NetworkInterface(eni_id)
        fqdn = eni.association_attribute['PublicDnsName']
        return fqdn
    except: 
        print('The Network Interface does not exist! This lambda function will finish here')
        return None