GCPMate is a tool that helps you manage your Google Cloud Platform (GCP) resources. It uses OpenAI's powerful language models to understand what you want to do, and then generates GCP command-line instructions for you to execute. If you like the proposed outcome, GCPMate can also execute the commands for you!
To use GCPMate, you'll need to have Python 3.x and an OpenAI API key. To install GCPMate, simply run:
pip install gcpmate
In current version program expects to find API key in env
variable OPENAI_API_KEY
. You can obtain the API key at https://platform.openai.com/account/api-keys. Once ready, you can set up env
variable by running:
export OPENAI_API_KEY=<your-api-key>
GCPMate will use OpenAI's language models to understand your query, and then generate a series of GCP command-line instructions for you to execute. If you like the proposed outcome, GCPMate can also execute the commands for you! To use GCPMate, simply run:
gcpmate "<your query>"
Where <your query>
is a description of what you want to achieve in GCP.
To get an explanation for a command, error or even a custom query, you can use the following command:
gcpmate --explain "your query"
Replace "your query" with the text you want to explain. Be sure to use single quotes if your query contains double quotes, and vice versa.
Here are some example queries you can use with GCPMate:
gcpmate "create a new GCP project called my-superb-new-project"
gcpmate "create ubuntu VM called superbvm in us-central1-a in project <xyz>"
You can also use GCPMate to ask queries, or paste error messages, or ask to explain a command:
gcpmate --explain "Why I cannot connect to my VM over ssh?"
gcpmate -e " gcloud compute instances create newvm --project superproject324 --zone us-central1-a --image-family ubuntu-1804-lts --image-project ubuntu-os-cloud"
# this query will return explanation what that command would do.
GCPMate supports several command-line options:
gcpmate -h # Show the help message and exit
gcpmate -m <model> # Specify the OpenAI model to use (default: gpt-3.5-turbo)
gcpmate -s # Skip printing "Fair warning" and runtime info (gcloud account, project, region, zone, OpenAI model)
gcpmate -e # Return explanation to given query, which can be command, error message, etc.
If you find a bug or have a feature request, please open an issue on the GCPMate GitHub repository: https://github.com/ontaptom/gcpmate
Pull requests are also welcome! If you want to contribute to GCPMate, please fork the repository, create a new branch, and then submit a pull request. Please ensure that your code passes the existing tests and linting rules.
This project is licensed under the terms of the Apache License 2.0. See the LICENSE
file for more details.