If your SSH connection to an AWS instance is getting disconnected every 5 minutes of idle time, it is likely due to the default timeout settings of the AWS server.
The server is configured to drop your connection afteronly 60 seconds of inactivity .
To avoid this, you can set a keep-alive option in your
~/.ssh/config
file on the client’s home directory. Add the following line to the file: