move enumerateInstanceIds to a common file