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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With