The SSH session kept dying, and the deploy was stuck. That was the moment I switched to Mosh.
AWS access through Mosh is faster, more stable, and survives bad connections. If you work with EC2 over spotty networks, you know the pain of SSH drops mid-command. Mosh solves it by keeping your session alive even when your IP changes, letting you keep typing like nothing happened.
To set up AWS access with Mosh, start with installing Mosh on your local machine and the remote EC2 instance.
For Debian/Ubuntu:
sudo apt-get install mosh
For macOS:
brew install mosh
On your EC2:
sudo yum install mosh
or the equivalent for your OS.
Open UDP ports 60000–61000 in your AWS Security Group rules. These ports let Mosh connect without relying on a single fragile TCP connection. You still authenticate using SSH, so your existing key pairs and IAM controls work the same way.
To connect:
mosh --ssh="ssh -i your-key.pem"ec2-user@your-instance-address
Once connected, you can run updates, build software, or watch logs without your shell freezing if Wi‑Fi drops or you switch networks. Latency feels lighter because Mosh predicts what you type before the server responds. It makes remote work smoother and reduces downtime caused by reconnections.
Security remains in your hands. IAM roles, SSH keys, and monitored network access logs let you control who can connect and from where. UDP traffic for Mosh is encrypted from end to end. Adding MFA to your AWS account makes it even harder for attackers to gain entry.
When your session is your lifeline to production, reliability is not optional. Mosh gives AWS users the power to maintain uninterrupted access, move faster, and spend less time restarting sessions.
You can see this kind of resilience in action right now. With hoop.dev, you can connect to live cloud resources in minutes, using Mosh for that rock-solid persistence. Test it yourself and watch how stable AWS access can be.