I want to connect ansible to EC2 via ssh. I created a key pair on my local machine(ubuntu) and copied it to my EC2 instances using ssh-copy-id. The copy was successful, but I get the error below when I want to connect to my instance:
Failed to connect to the host via ssh: root@34.xxx.0x.xxx: Permission denied (publickey)
when I inspected the auth.log file on my remote machine I see the following logs:
invalid user usuario from 187.xx.xx.xx port 47988
Here is my etc/ansible/hosts file
[host1]
github ansible_host=13.xxx.xxx.xx ansible_user=root
Any help will be appreciated. Thank you