Windows servers enable winrm over http by default, but have no certificate to encrypt it over https. Only port 5985 will be listening on a fresh install.
That’s a fairly deep subject. Ideally, you would use Group Policy and a CA server to issue trusted certificates from AD and enable winrm over https automatically. If you don’t have AD infrastructure to provide that, then you might be able to get away with a handful of commands:
As for http, you can use it if you feel secure enough about it. WinRM uses its own encryption that Microsoft feels comfortable enough to enable WinRM over http for servers out of the box, but it doesn’t protect the initial handshake. So for a very brief moment, your sessions will be insecure. Enabling winrm over https will protect that intial handshake.
The main thing you would need to do is include the 5985 port in your AWS security rule, and then dumb down the ansible config to use http instead of https.
ansible_user=Administrator
ansible_password=kw=VPi*L)I4uzTp;
ansible_port=5985
ansible_connection=winrm
#ansible_winrm_server_cert_validation=ignore
ansible_winrm_transport=ntlm # please don't use basic if you can help it
My guess at this point is that you have a routing issue between your ubuntu host and windows host. Unfortunately, I don’t know enough about AWS to point you in the right direction.
You can test from your ubuntu vm though:
nmap -p 5985-5986 -Pn 34.235.160.152
Edit: This is a public IP address, and I would think you would want to connect to an internal IP address. Probably through a VPN, possibly through a bastion (which would mean either configuring powershell over ssh instead of WinRM or configuring a socks5 proxy).