This repository contains tools for managing SSH connections to multiple CloudLab nodes, particularly useful for VS Code remote development.
Before you begin, ensure you have:
- An active CloudLab account
- SSH keys generated and added to your CloudLab profile
- Visual Studio Code installed with the "Remote - SSH" extension
- Make utility installed on your system
-
Clone or download this repository to your local machine:
git clone https://github.com/Saicasm/cloudlab-vs-code.git cd cloudlab-setup
-
Update the Makefile with your SSH key information:
SSH_KEY_DIR := path_to_your_dir SSH_KEY_NAME := your_key_file # without .pub extension
-
Generate the initial configuration:
make
This will create a
nodes.conf
file with example entries. -
Edit
nodes.conf
to add your CloudLab nodes:# CloudLab Nodes Configuration NODE_1_HOST := rand123.utah.cloudlab.us NODE_1_USER := Username NODE_2_HOST := rand123.utah.cloudlab.us NODE_2_USER := Username
You can add nodes in two ways:
-
Interactively using make:
make add-node
-
Manually by editing
nodes.conf
-
Set up everything (recommended for first time):
make
-
Check SSH key configuration:
make check-key
-
Set up VS Code configuration:
make setup-vscode
-
Test connections to all nodes:
make test-connection
-
Add a new node interactively:
make add-node
-
Clean configuration:
make clean-config
-
Show help:
make help
- Open VS Code
- Press
Ctrl/Cmd + Shift + P
- Type "Remote-SSH: Connect to Host..."
- Select your node (e.g.,
cloudlab-1
,cloudlab-2
, etc.)
.
├── Makefile # Main configuration and automation file
├── nodes.conf # Node configuration file (generated)
└── README.md # This documentation file
-
Permission denied (publickey):
- Verify your SSH key is correctly added to CloudLab
- Check key permissions:
chmod 600
for private key,chmod 644
for public key - Ensure correct username in nodes.conf
-
Connection timeout:
- Verify the hostname is correct
- Check if your CloudLab experiment is still active
- Ensure you're connected to the internet
-
VS Code can't find the host:
- Run
make setup-vscode
again - Check
~/.ssh/vscode/cloudlab-config
exists - Restart VS Code
- Run
-
Check SSH key configuration:
make check-key
-
Test specific connection:
ssh -i /path/to/your/key -vv username@hostname
-
Verify VS Code configuration:
cat ~/.ssh/vscode/cloudlab-config
To use different SSH keys for different nodes, modify nodes.conf
:
NODE_1_HOST := host1.cloudlab.us
NODE_1_USER := user1
NODE_1_KEY := /path/to/key1
NODE_2_HOST := host2.cloudlab.us
NODE_2_USER := user2
NODE_2_KEY := /path/to/key2
To perform operations on specific nodes:
# Test specific node
ssh -i $SSH_KEY_PATH $USER@$(NODE_1_HOST)
# Copy files to all nodes
for node in $(NODES); do
scp -i $SSH_KEY_PATH files $USER@$node:~/
done