0
'''
import pandas as pd
import numpy as np
! pip install google-cloud
! pip install google-cloud-vision
! pip install gcsfs
df= pd.read_excel('gs://bank-modelling-project//training_data.xlsx')
df
'''

Error: HttpError: Anonymous caller does not have storage.objects.get access to the Google Cloud Storage object., 401

  1. Im using free trial account
  2. I made the bucket as Public

Still im gettting the above error , Anybody can save my time here?

  • 3
    Does this answer your question? [gsutil ServiceException: 401 Anonymous caller does not have storage.objects.list access to bucket even though I'm loggedin in gcloud](https://stackoverflow.com/questions/49302859/gsutil-serviceexception-401-anonymous-caller-does-not-have-storage-objects-list) – abhigyanj Feb 11 '21 at 08:49

1 Answers1

0

According to the documentation, in order to be able to read from an Object stored in Google Cloud Storage, you need to have the proper permissions. In your case it is the: storage.objects.get.

In GCP, service accounts are by between services to communicate between each other in the cloud with the right permissions. Thus, the Jupyter notebook uses a service account to access the object gs://bank-modelling-project//training_data.xlsx in GCS. So it needs the storage.objects.get permission to read the object.

Below are the steps to assign this permission to your service account:

  1. Go to your notebooks instance page and click on the instance you are using;
  2. Under Instance properties, check the Service account;
  3. Now go to IAM & ADMIN and find the service account you saw in the previous step;
  4. On the same line as its name, click on the Pencil icon to edit the member;
  5. Add the pre-defined role Storage Object Viewer, because this role has the permission you need, such as described here.
  6. Re-open your notebook instance and you will be able to read the GCS object you desire.

Please note that you won't be able to create any object in GCS with only this permission.

Alexandre Moraes
  • 3,892
  • 1
  • 6
  • 13