Implemented the getInstanceByHostname functionality