# Unable to SSH from Ansible AWX to GCP VM Instance

**URL:** <https://forum.ansible.com/t/unable-to-ssh-from-ansible-awx-to-gcp-vm-instance/41795>\
**Category:** Get Help\
**Tags:** gcp, awx\
**Created:** [April 17, 2025, 2:57pm UTC](https://forum.ansible.com/t/unable-to-ssh-from-ansible-awx-to-gcp-vm-instance/41795 "2025-04-17T14:57:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SaravanaSelvaraj](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/saravanaselvaraj/32/2841_2.png) [@SaravanaSelvaraj](https://forum.ansible.com/u/SaravanaSelvaraj)\
**Post date:** [April 17, 2025, 2:57pm UTC](https://forum.ansible.com/t/unable-to-ssh-from-ansible-awx-to-gcp-vm-instance/41795/1 "2025-04-17T14:57:08Z")

</div>

**Unable to SSH from Ansible AWX to GCP VM Instance**.

Dear community,

I am attempting to SSH from my Ansible AWX instance to a VM running on GCP. I have a Service Account created for connecting to the GCP project, but I am encountering the following error:

```auto
Apr 17 13:27:37 XXXX sshd[111041]: Connection closed by invalid user XXXX_root 10.XXX.XX.X port 34462 [preauth]

```

After researching the Google forums, I learned that a Service Account should be used to connect AWX to GCP, and I have followed this approach. However, I also created a regular user account, but I am still unable to connect using it. What could I be missing? Should I be using the Service Account credentials or the Regular User credentials?

Please find the below screenshot FYR,

 ![image](https://us1.discourse-cdn.com/ansible/original/2X/9/9636fb090214575e41b625e58264b9452a3d6669.png)

Any assistance would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![SaravanaSelvaraj](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/saravanaselvaraj/32/2841_2.png) [@SaravanaSelvaraj](https://forum.ansible.com/u/SaravanaSelvaraj)\
**Post date:** [April 17, 2025, 2:57pm UTC](https://forum.ansible.com/t/unable-to-ssh-from-ansible-awx-to-gcp-vm-instance/41795/2 "2025-04-17T14:57:34Z")

</div>

@kurokobo , Please help if you can here !

---

<div class="post-metadata">

**Author:** ![kurokobo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kurokobo/32/182_2.png) [@kurokobo](https://forum.ansible.com/u/kurokobo)\
**Post date:** [April 18, 2025, 2:04pm UTC](https://forum.ansible.com/t/unable-to-ssh-from-ansible-awx-to-gcp-vm-instance/41795/3 "2025-04-18T14:04:04Z")

</div>

I haven’t had a chance to connect AWX to a VM on GCP, so I can’t really share anything until I give it a try myself one day ☹

---

<div class="post-metadata">

**Author:** ![SaravanaSelvaraj](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/saravanaselvaraj/32/2841_2.png) [@SaravanaSelvaraj](https://forum.ansible.com/u/SaravanaSelvaraj)\
**Post date:** [April 18, 2025, 2:44pm UTC](https://forum.ansible.com/t/unable-to-ssh-from-ansible-awx-to-gcp-vm-instance/41795/4 "2025-04-18T14:44:14Z")

</div>

Sure @kurokobo Thanks a lot for your response and I want to share some updates on this.

I have two GCP users :

1. With Regular type (User ID and password) for SSH
2. With Private Key (JSON file) which I have used for Dynamic Inventory sync (And Sync works)

So I can get the hosts from a project and sync them in my inventory but I cannot SSH to the VMs in GCP.

Already made the below changes in my Ubuntu VM for /etc/ssh/sshd\_config.

```auto
PasswordAuthentication yes
ChallengeResponseAuthentication no
UseDNS no
PermitRootLogin yes

```

But still it gives me this error.

`Failed to connect to the host via ssh: Warning: Permanently added 'XX.XXX.XX.XX' (ED25519) to the list of known hosts.\r\awx_root@gcp.XXX.com@ 'XX.XXX.XX.XX' : Permission denied (publickey).`

And Thanks for checking this in advance.

---

<div class="post-metadata">

**Author:** ![SaravanaSelvaraj](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/saravanaselvaraj/32/2841_2.png) [@SaravanaSelvaraj](https://forum.ansible.com/u/SaravanaSelvaraj)\
**Post date:** [April 22, 2025, 12:13pm UTC](https://forum.ansible.com/t/unable-to-ssh-from-ansible-awx-to-gcp-vm-instance/41795/5 "2025-04-22T12:13:39Z")

</div>

Hello , Good day. Were you able to find the way to connect to the VMs in GCP ? Please let me know.

Thanks and Regards  
Saravana Selvaraj

---

<div class="post-metadata">

**Author:** ![filfam](https://avatars.discourse-cdn.com/v4/letter/f/a4c791/32.png) [@filfam](https://forum.ansible.com/u/filfam)\
**Post date:** [April 22, 2025, 6:08pm UTC](https://forum.ansible.com/t/unable-to-ssh-from-ansible-awx-to-gcp-vm-instance/41795/6 "2025-04-22T18:08:35Z")

</div>

You’ll need to input the GCP project where the service account exists that has the permissions to to the compute instance. That service account should have the necessary IAM permissions in GCP (Compute Instance Admin V1, Service Account user etc). You’ll also need to update the Service Account keys so that it can be leveraged to access that project
