Lab setupBeginner
Build a cloud and networking lab on one Linux machine, for $0

Key results
- One Linux machine runs every guide on this site: routers, VPN and mocked AWS are all containers.
- Every tool comes with one check command, so you know right away whether it installed correctly.
- Real AWS is only used for what cannot be mocked, always with a cost warning.
What you need
- A Linux machine (Ubuntu or Debian) with about 4 GB RAM and sudo: a VM, an old PC or a VPS all work.
- You can open a terminal and type commands. No prior Docker knowledge needed.
- Time
- 45 min
- Cost
- $0
- Docker
- containerlab
- FRRouting
- strongSwan
- Moto
- Terraform
- AWS CLI
Trying a network change or an AWS architecture directly on a running system is risky, and creating real AWS resources for every experiment costs money. Every guide on this site uses the same approach instead: build everything as containers on one Linux machine, break things freely, delete and rebuild in seconds.
This guide installs one tool at a time. Each tool has three parts: what it is, why you need it, and a command to check it installed correctly.
The big picture
A few concepts first
- Container
- A program running in its own "box" with its own network and files, isolated from the rest of the machine. Much lighter than a virtual machine.Example: Each router in the VPN guide is a container.
- Image
- A ready-made package used to create containers, like an installer. One image can create many containers.Example: quay.io/frrouting/frr:9.1.0 is the FRRouting router image.
- Mock / emulator
- Software that answers commands like the real service but runs on your machine, costs nothing and never touches real systems.Example: Moto answers "create SQS queue" just like real AWS.
- Infrastructure as Code
- Describe infrastructure in a text file and let a tool create it. Re-running gives the same result every time, and one command removes everything.Example: Terraform reads main.tf and creates SNS and SQS.
Step 1: Install Docker
What Docker is: the tool that runs containers. Everything else in this guide runs inside Docker.
Why you need it: a real router needs its own machine; a container router takes a few seconds and a few dozen MB of RAM.
curl -fsSL https://get.docker.com -o get-docker.shless get-docker.sh # read it before running itsudo sh get-docker.shsudo usermod -aG docker $USER| Command | Why |
|---|---|
| Download the script to a file before running it | Piping a script from the Internet straight into a shell means trusting that source completely. Downloading and skimming it first is a safe habit. |
usermod -aG docker $USER |
Lets your account use Docker without typing sudo every time. Log out and back in for it to take effect. |
Check:
docker run --rm hello-worldIf you see Hello from Docker!, Docker works. --rm deletes the container when it finishes, so nothing is left behind.
Step 2: Install containerlab
What containerlab is: a tool that reads a YAML file saying “these devices exist and are cabled like this”, then creates the containers and the virtual cables between them.
Why you need it: wiring containers together by hand takes long, error-prone Linux commands. With containerlab the whole network diagram is one file, deployed or destroyed with one command.
curl -sL https://get.containerlab.dev -o get-clab.shsudo bash get-clab.shCheck: containerlab version prints a version number.
Step 3: FRRouting virtual routers and strongSwan VPN
What FRRouting is: open-source routing software that runs BGP, OSPF and BFD, with Cisco-like syntax. strongSwan is IPsec VPN software, the same kind of VPN that AWS Site-to-Site VPN uses.
Why there is nothing to install: both run in containers. containerlab pulls the image the first time a lab is deployed. Pull it in advance so the first deploy is faster:
docker pull quay.io/frrouting/frr:9.1.0Step 4: Mock AWS with Moto
What Moto is: open-source software that mocks the AWS APIs: S3, SQS, SNS, IAM and many more.
Why you need it: to learn and try AWS architectures without an account, without cost, and without worrying about forgotten resources.
docker run -d --name moto -p 127.0.0.1:4566:5000 motoserver/motoalias awsl='aws --endpoint-url http://localhost:4566'export AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test AWS_DEFAULT_REGION=us-east-1 # fake keys| Part | Why |
|---|---|
-d |
Runs in the background and gives your terminal back. |
127.0.0.1:4566 |
Only your machine can reach Moto, not other machines on the network. |
alias awsl |
Type awsl instead of aws --endpoint-url ..., and keep mocked commands clearly separate from real AWS ones. |
test keys |
The AWS CLI requires keys; Moto accepts anything. Never put real keys here. |
Check (after installing the AWS CLI in step 5):
awsl s3 mb s3://test-moto && awsl s3 lsIf the bucket test-moto is listed, Moto accepted the command.
Step 5: Terraform and the AWS CLI
The AWS CLI is the command-line tool for calling AWS APIs (or Moto). Terraform is an infrastructure-as-code tool: you describe resources in a file, Terraform creates them exactly, and terraform destroy removes everything.
Why you need both: Terraform to build, the AWS CLI to check and act step by step so you can see what is going on.
Install from the official guides so you always get a current version for your CPU architecture (x86 or ARM):
Check: aws --version prints aws-cli/2... and terraform -version prints a version number.
When you need real AWS
| Works in the lab | Needs real AWS |
|---|---|
| BGP, OSPF, BFD, IPsec VPN (containers) | VPC, subnets, route tables, Internet Gateway |
| SNS, SQS, S3, IAM at API level (Moto) | EC2, Load Balancers, RDS |
| Writing and testing Terraform | Real IAM permission checks, real limits and real costs |
When you do need real AWS:
- Use a separate AWS account for experiments, isolated from anything that runs real workloads.
- Turn on AWS Budgets so you get a cost alert before creating resources.
- Build with Terraform and always run
terraform destroywhen you are done.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
permission denied while trying to connect to the Docker daemon socket |
You have not logged out and back in after usermod |
Log out and in again, or run newgrp docker |
containerlab deploy says it needs root |
containerlab creates virtual network cables, which needs admin rights | Run it with sudo |
Could not connect to the endpoint URL when calling awsl |
The Moto container is not running | docker ps; if moto is missing, run step 4 again |
References

Cloud & Network Engineer · TrungCLN
Designs and runs AWS infrastructure, hybrid networking (VPN, BGP) and cloud security. Every guide on this site is built and run for real before it is written.
Related guides
AWSBeginner35 min
SNS → SQS fan-out and dead-letter queues: decoupling services with Terraform
Build an SNS topic that fans out to several SQS queues, move failing messages to a dead-letter queue after 3 tries, and learn why every Terraform line is there.
NetworkingIntermediate40 min
VPN with 2 tunnels and BGP: how long does failover really take?
Build two BGP routers over two tunnels like AWS Site-to-Site VPN, measure failover for hard and soft failures, and learn why every config line is there.