permssion denied if i want to conncet to aws servers : I launched two Ubuntu free-tier servers in different regions on AWS. I was ping one server to another server but it displayed one error message that was connection timed out.can you please fix the problem as soon as possible.

This is the error :

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/ubuntu/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Permission denied (publickey).


    172.31.94.158 | UNREACHABLE! => {
        "changed": false, 
        "msg": "Failed to connect to the host via ssh: ssh: connect to host 172.31.94.158 port 22: Connection timed out\r\n", 
        "unreachable": true
    }

I tried below commands
1.ssh-copy-id ubuntu@172.31.94.158
2.sudo ansible webserver -m ping
