add associate_key_to_machine function and route