Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I provide gcloud commands inside python

I am trying to execute gcloud commands inside python. I have a cloud function that may have different environment variables monthly. I can use command line to change the environment variables in cloud function. But is it possible to use it in python?

Thank you in advance

like image 559
python_interest Avatar asked Nov 06 '22 19:11

python_interest


1 Answers

gcloud which is part of the Google Cloud SDK might not fit into a Google Cloud Functions use case.

With Google Cloud Functions you're given a Python runtime, for example, to work with it.

The OS, or whatever other abstraction this runtime is running on top of, doesn't have Google Cloud SDK installed and it's not possible to change that.

So, bottom-line you can't issue gcloud commands from a Google Cloud Function.

To interact with other Google Cloud Platform Services, you have their respective client libraries in many languages, Python being one of them.

You might want to take a look at this discussion also.

like image 172
fbraga Avatar answered Nov 12 '22 22:11

fbraga