Search code examples
pythongoogle-compute-enginegcloudgcloud-pythongoogle-cloud-python

How to use gcloud commands programmatically via Python


The Google documentation is a little generic on this topic and I find it hard to get around the different APIs and terms they're using, so I'm wondering if someone could point me to the right direction.

I'm looking for a way to call the gcloud command directly from Python. I've installed gcloud in my Python environment and as an example to follow, I'd like to know how to do the following from Python:

gcloud compute copy-files [Source directory or file name] [destination directory of file name]

Solution

  • There's nothing magic about uploading files to a Computer Engine VM. I ended up using paramiko to upload files.