To work comfortably with Terraform, the AWS CLI, and Docker, I set up WSL2 on Windows.
This post walks through the setup steps I actually followed, along with how I fixed the errors I ran into along the way.
Why use WSL?
WSL (Windows Subsystem for Linux) is a mechanism for running a Linux environment on top of Windows.
Since many development tools — AWS, Terraform, Docker, and so on — play nicely with Linux environments, it's common practice to use WSL2 even when developing on Windows.
For this development environment, I'm aiming for the following setup.
- Terraform
- AWS CLI
- Docker
- Git
- Node.js
- Electron
- PostgreSQL
1. Install WSL
Open PowerShell (as Administrator) and run the following.
wsl --install
2. First-time Ubuntu setup
When you start Ubuntu for the first time, it will ask you to set up a Linux username and password.
Example
Enter new UNIX username:
Enter a username of your choice.
Next, set a password.
*While you're typing, no characters will appear on screen — that's expected behavior.
3. Update packages
Once Ubuntu is up, start by updating everything to the latest state.
sudo apt update
sudo apt upgrade -y
4. An error showed up
During the upgrade, the following message appeared.
Failed to connect to system scope bus via local transport: Connection refused
It looks like an error at first glance, but this time it ran all the way through to
Processing triggers...
done.
and the update itself completed successfully.
This kind of warning can show up in WSL due to how systemd-related processing works.
5. Check the WSL status
Run the following in PowerShell.
wsl --status
This time it showed:
既定のディストリビューション: docker-desktop
既定のバージョン: 2
as the result.
6. Docker Desktop vs. Ubuntu — the difference
This is a point that can be a little confusing.
Installing Docker Desktop creates a WSL distribution called docker-desktop.
However, this is only for Docker's internal use, and it's not where you'd do your everyday development.
The setup I'd recommend is as follows.
Windows
│
├── VS Code
├── Docker Desktop
│
├── Ubuntu (WSL2)
│ ├── Git
│ ├── Terraform
│ ├── AWS CLI
│ ├── Node.js
│ └── Docker CLI
│
└── docker-desktop
└── Docker Engine
Do your development inside Ubuntu, and use Docker Desktop purely as the container runtime backend.
7. Make Ubuntu the default distribution
Check which WSL distributions are currently registered.
wsl -l -v
Once you've confirmed Ubuntu is installed, run
wsl --set-default Ubuntu
to set it as the default.
Now, just running
wsl
on its own will launch Ubuntu.
What's next
Going forward, I'll be adding the following to this WSL environment.
- Git
- Node.js
- pnpm
- Docker CLI
- AWS CLI
- Terraform
Building on this environment, I plan to move forward with infrastructure work using AWS Organizations, IAM Identity Center, and Terraform.
Wrap-up
Setting up WSL2 lets you build a development environment on Windows that's nearly identical to Linux.
This is especially useful when working with AWS, Terraform, or Docker — you'll run into far fewer issues than in a native Windows environment, and the gap between your setup and production shrinks too.
If you're starting cloud infrastructure development on Windows, I'd recommend setting up WSL2 with Ubuntu first.