This is a simple CLI tool based on cobra to query Google Cloud to fetch information about VirtualMachines and store it locally to have offline and quick access to it.
Using gcloud compute instances list
every time you want to check something about a VM
is not very efficient. And add the convenience of fuzzy finding to it
You can download the binaries from the release page
wget https://github.com/MansoorMajeed/gcq/releases/latest/download/gcq-amd64-linux
sudo mv gcq-amd64-linux /usr/local/bin/gcq
wget https://github.com/MansoorMajeed/gcq/releases/latest/download/gcq-amd64-osx
sudo mv gcq-amd64-osx /usr/local/bin/gcq
git clone https://github.com/MansoorMajeed/gcq.git
cd gcq
go build
sudo mv gcq /usr/local/bin/gcq
You should have gcloud
installed and configured
Create ~/.gcq.yaml
config file with projects you want to track
projects:
- project1
- project2
Run gcq update
so that it fetches project data from Google Cloud
- Quickly fuzzy find a VM
instance-a-25
in the projectinfrastructure-prod
gcq ls infraprod inst25
Pass --ssh
to show the ssh command
gcq searches the name, status, internal and external IP addresses. So you can make use of any string matching any of those
- Find which VM has IP address 10.50.1.1
gcq ls infrapr 10.50.1.1