Use Windows and WSL to develop Node.js / AWS applications
You're a web developer or full-stack / DevOps engineer. You are writing applications that will run in Node.js, will likely run in a Docker container, deploy to AWS and connect to other AWS services, and probably need local services such as MongoDB, Redis, Postgres, etc. The production environment / Docker container will be some flavor of Linux. What's your ideal working environment?
macOS is very common. It's sort of like Linux. It runs Docker, it has a Bash shell and most common bash utilities. But macOS isn't for everyone. It has its quirks. Some dev tools require XCode just to install. And it requires Apple hardware. (You can maybe tell I'm not a fan of macOS. I tried for years to like it.)
You could use Linux. In 2024, the Linux desktop and app ecosystem are about as quirky as 10 years ago. Most software is available for Ubuntu as either a .deb or .snap package - sometimes both! KDE mishandles URLs in a way that makes it impossible to log in to a Slack organization. Most quirks have workarounds, but you have work to do.
What about Windows? Most apps work in Windows, but it's not a Linux dev environment. Can we get the best of both worlds? I'm not totally sure, and feedback is welcome on this setup, but here's a quick guide.
Install Ubuntu in WSL2
wsl --install
That's it. After that, you should have a WSL-Ubuntu install on your Windows machine. Ubuntu is now an "app" on your Windows computer that takes you to an Ubuntu shell. It has most non-GUI software you would expect.
Terminal - MobaXTerm
The free version of MobaXTerm is a better terminal than what you get with WSL by default.
Tip: Go to the default settings for the WSL session type, and disable using PATH. This will prevent it from overriding some Linux executables with its own.
Running GUI Apps from Ubuntu - generally avoid
You can GUI apps in Ubuntu and possibly launch them from the CLI, but don't expect it to run well. Launching the app from the WSL-Ubuntu shell should work - it provides an X Server. MobaXTerm provides its own shell, so graphical apps may look different when launched from MobaXTerm.
VSCode - install on the Windows, then the WSL extension
Install the normal VSCode for Windows, and then install the WSL extension.
Chances are you'll end up using its terminal more often than a standalone terminal anyway.
Node.js - install on Ubuntu
The recommended installation method is to run the nvm
installer first and then install node.
I would take a similar approach for Python - use venv or another Python version manager.
Use dev containers when you can
Add a dev container configuration to your repositories when you can.
Install tools like Terraform or pre-commit
in as dev container features or in a dev container's Dockerfile. Later, you won't have to think about whether to install tools on the host machine or in windows if it is already in the container. This also makes your dev environment portable, and may even work in GitHub Codespaces.
Docker Desktop - install on Windows
Install Docker Desktop. You will be prompted (recommended) to use the WSL backend. Once installed, you can run docker ps
in the Ubuntu shell, and it should show the same containers running in Docker Desktop.
AWS CLI - install on Ubuntu
Install the AWS CLI on Ubuntu. Follow the Linux instructions.
Leapp or AWS Vault
If you log in to multiple AWS accounts, and you need to assume a role after signing in with IAM or SSO, then a credential manager helps a lot.
Leapp is very handy, but it's a bit tricky. The GUI does not run from inside WSL-Ubuntu. One suggestion is to use the Windows version of Leapp, and then create a symlink for the credentials file from the Ubuntu path to the mounted Windows path.
aws-vault is purely a CLI tool, so you can use it purely in Ubuntu if it works for you.
git and github
Install git in Ubuntu. Generate your SSH key in Ubuntu.
VPN software such as OpenVPN - Windows
Install VPN software on the Windows host, not Ubuntu
Slack, Zoom, etc
Team meeting, chat, and productivity software can use the windows version. This is one of the major benefits of using Windows. Outside of writing code, you just need the same software as any other Windows user.
Conclusion
You now have a working Linux-based dev environment in Windows.
You are using the Windows version of VSCode and your favorite web browser (and other productivity tools)
You have less worry about installing (non-development) apps that are either quirky or don't run in Linux.
You are using a real Linux OS to write and run code
Any more tips? Better ways to do this?