Seem likes an awfully laboured equivalent of GCP's OSLogin [1]. To SSH into an instance:
gcloud compute ssh <instance_name>
GCP takes care of generating a key pair. The GCP linux images configure OpenSSH and PAM to check you have relevant IAM permissions. IAP [2] is used in place of a bastion if the instance doesn't have an external IP address.[1]: https://cloud.google.com/compute/docs/instances/managing-ins...