ssh – permission denied (publickey) AWS: Ec2 Connection Error

Some time ago, I was able to connect to my server with the help of SSH and suddenly it stopped working.

I'm trying to order: ssh -i "mykey.pem" ubuntu @ server-ip and Ec2 rejects an exception

Permission denied (publickey). When I tried to attempt the connection using the SFTP, the error was returned.

Error: Server Disconnect Message Sent
Error: type 2 (protocol error):
Error: "Too many authentication failures"
Error could not connect to the server

I was then using the command in -v mode and here is the output. Can you help me, please, to solve this problem? I totally burn with heat about it.

OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data / etc / ssh / ssh_config
debug1: / etc / ssh / ssh_config line 48: Applying options for *
debug1: connection to x.x.x.x [x.x.x.x] port 22.
debug1: connection established.
debug1: mykey.pem-type identity file
debug1: mykeypem-cert-type identity file
debug1: local version string SSH-2.0-OpenSSH_7.9
debug1: Remote Protocol Version 2.0, Remote Software Version OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 pat OpenSSH_7.0 *, OpenSSH_7.1 *, OpenSSH_7.2 *, OpenSSH_7.3 *, OpenSSH_7.4 *, OpenSSH_7.5 *, OpenSSH_7.6 *, OpenSSH_7. 6 *, OpenSSH_7.6 *, OpenSSH_7.5 *, OpenSSH_7.5 *, OpenSSH_7.6 *, OpenSSH_7.5 *, OpenSSH_7.5 *, OpenSSH_7.5 *, OpenSSH_7.5 *, OpenSSH_7.5 *, OpenSSH_7. 5 *, OpenSSH_7.5 *, OpenSSH_7.6 7 * compat 0x04000002
debug1: Authentication on x.x.x.x: 22 as "Ubuntu"
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server-> client number: chacha20-poly1305@openssh.com MAC:  compression: none
debug1: kex: client-> server encryption: chacha20-poly1305@openssh.com MAC:  compression: none
debug1: wait for SSH2_MSG_KEX_ECDH_REPLY
debug1: server host key: ecdsa-sha2-nistp256 SHA256: 6NiTFBw2gv2t9lxZJlAxMbNJ7Ih2WcEmp2S3McfuFe0
debug1: the host x.x.x.x & # 39; is known and corresponds to the ECDSA host key.
debug1: key found in /Users/myuser/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: waiting for SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: will try the key: mykey.pem explicitly
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs =
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: authentications that can continue: publickey
debug1: The following authentication method: publickey
debug1: private key attempt: mykey.pem
debug1: authentications that can continue: publickey
debug1: more authentication methods to try.
ubuntu@x.x.x.x: permission denied (publickey).