CLI tool for managing Google Cloud Managed Instance Groups
Project description
migs - Google Cloud MIG CLI Tool
A command-line tool that wraps the gcloud CLI to provide an easier experience for managing Google Cloud Managed Instance Groups.
Features
- List MIGs in your project
- Spin up/down VMs with custom names
- Track your personal VMs
- Automatic SSH config management for VS Code Remote Explorer
- Easy file/directory uploads
Installation
pip install -e .
Prerequisites
- Python 3.8+
- gcloud CLI installed and authenticated (
gcloud auth login) - SSH keys configured for Google Compute Engine
Usage
List all MIGs
migs list
Spin up a VM
migs up my-mig --name my-dev-vm
migs up my-mig --name my-dev-vm --async # Don't wait for creation
migs up my-mig --name my-dev-vm -d 2h # Auto-delete after 2 hours
migs up my-mig --name my-dev-vm --duration=2h # Alternative syntax
List your VMs
migs vms
Sync VM state
migs sync # Sync local VM list with GCP state
migs sync --discover # Also discover and claim untracked VMs
Check VM connectivity
migs check my-dev-vm # Test SSH connectivity
SSH into a VM
migs ssh my-dev-vm
migs ssh my-dev-vm -- tmux attach # Pass additional SSH arguments
Run scripts
migs run my-dev-vm ./setup.sh # Runs in tmux session
migs run my-dev-vm ./deploy.sh --session deploy # Custom session name
migs run my-dev-vm ./script.sh arg1 arg2 # Pass arguments to script
Environment Variables (.env files)
Both ssh and run commands automatically detect and use .env files from your current directory:
# If .env exists in current directory, it will be uploaded and sourced
migs ssh my-dev-vm # Variables from .env available in shell
migs run my-dev-vm ./app.sh # Script runs with .env variables
The .env file is uploaded to /tmp/.env on the VM and sourced using set -a; source /tmp/.env; set +a to export all variables.
Upload files
migs upload my-dev-vm ./myfile.txt
migs upload my-dev-vm ./mydir/ /home/user/
Download files
migs download my-dev-vm /remote/file.txt
migs download my-dev-vm /remote/dir/ ./local/
Spin down a VM
migs down my-dev-vm
SSH Config
The tool automatically updates your ~/.ssh/config file with entries for your VMs, making them accessible in VS Code Remote Explorer.
Release Instructions
- Test
python3 -m build
twine upload --repository testpypi dist/* # may take a second to index
pip uninstall migs
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple migs
- Deploy
twine upload dist/*
git tag v0.1.x
git push origin v0.1.x
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file migs-0.1.3.tar.gz.
File metadata
- Download URL: migs-0.1.3.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abaabb8cec33ad371d78325d0a20dfa1a8a76fdcf8bccd8189ac0936fb093e88
|
|
| MD5 |
e2c0745305d92d0737104af71ff55326
|
|
| BLAKE2b-256 |
0174084c0c657307f0ffe5978018fc21245eb166e3e3aaf7159cf2f1c8a04145
|
File details
Details for the file migs-0.1.3-py3-none-any.whl.
File metadata
- Download URL: migs-0.1.3-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ded88c70f450b81280035837f09072015882e5471e07941aae67855310c26adf
|
|
| MD5 |
4bb60e9a1766ef0df0f7c616127c693d
|
|
| BLAKE2b-256 |
ac802a0285a370d38fef005926e1f4ea978be58078433b964a86cc4d3513163a
|