Gsutil config for google-cloud-storage

google-cloud-platform

I was trying to run a telemetry test case in google chrome, which requires some test files to be downloaded from google-cloud-storage. When I run the test case, I get the following error. The error says I have to configure gsutil before accessing but even after configuring gsutil with the given steps I end up with the same error. There is a ".boto" file created after configuring gsutil.
So I am clueless why I am getting the same error.

PermissionError: Attempted to access a file from Cloud Storage but you don't have permission. To configure your credentials:
  1. Run "tools/telemetry/third_party/gsutil/gsutil config" and follow its instructions.
  2. If you have a @google.com account, use that account.
  3. For the project-id, just enter 0.

Locals:
  args        : ['cp', 'gs://chrome-partner-telemetry/da1c09dd48dcd2eb76449d97c4fa38460d3a1e8d', '/home/sriram/android/chromeopensource/androidbuild/src/tools/perf/page_sets/tough_video_cases/crowd1080.mp4']
  gsutil      : <subprocess.Popen object at 0x30807d0>
  gsutil_env  : None
  gsutil_path : 'tools/telemetry/third_party/gsutil/gsutil'
  stderr      : 'AccessDeniedException: 403 Forbidden\n'
  stdout      : ''

Best Answer

gsutil will use the ~/.boto file. By default, gsutil will look for the configuration file in /etc/boto.cfg and ~/.boto.

If these files do not exist, it will use the legacy_credentials instead.

You can change all of this behavior by modifying the the BOTO_PATH and BOTO_CONFIG environment parameters.

Here is the documentation on how to use those environment variables.

BOTO_PATH: gsutil will load each configuration file found in the path in order. You may want to use this environment variable if you want to share a boto config amongst users. An example would be something like this :

BOTO_PATH=/etc/group/.boto.cfg:/home/user/.boto 

BOTO_CONFIG: Use this variable to set the preference order. An example would be something like this :

BOTO_CONFIG=~/testa/.boto:~/testb/.boto . 

This would put the preference on testa's boto file. If that is not there then gsutil would load the testb boto.