I have a ssh private key in a key.json
file, and I want to use this credential to access a storage bucket using gsutil.
I can't seem to find anything about how to include json keys as a authentication method, only "private" and "secret" fields.
The file structure is:
{
"private_key_id":
"private_key": "-----BEGIN PRIVATE KEY-- ...
"client_email":
"client_id":
"type": "service_account"
}
How do I use gsutil
with that file?
As of today,
gsutil config -e
is still in the doc when you dogsutil help config
, but does not work.gsutil help creds
tells to first dogcloud auth activate-service-account
So i did:
It filled
~/.config/gcloud/
andgsutil
now works.From the docs:
The short version is to run the following command and follow instructions:
The gsutil tool has built-in help which can be consulted for all kinds of options and modes of operation. When running
gsutil help creds
, one of the help options recommended when runninggsutil
alone, we can read the section on "OAuth2 Service Account
" to see the instructions for using a service account's json key file: