Mosh on Amazon Lightsail


Amazon Lightsail is great for getting something up quickly, but the default firewall rules preclude using mosh. I can’t imagine accessing remote availability zone instances without mosh’s sanity-maintaining buffer.

Opening the right ports

  1. Log into your AWS portal and choose Lightsail. I include this as a discrete step, though if you need to be told this, you may need more coffee.

  2. Click the dropdown menu for the VM and choose Manage, then choose the Networking tab.

  3. Under the Firewall heading, click Add another. Choose Custom for the Application, UDP for the Protocol, and a Port from 60000 to 61000 inclusive. And hit Save.

Installing mosh

Now you can install mosh as you would normally. I use Colin Percival’s excellent FreeBSD AMI on the server, because I’m a gentleman:

# pkg install www/mosh

And then on my macOS clients:

# brew install mosh

Author bio and support


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person in bios. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.