Error Uploading CSV to Google Cloud Storage through Cloud SQL API

你离开我真会死。 提交于 2019-12-08 02:58:16

问题


I have some data in Google Cloud SQL, which I am trying to transfer to Google Cloud Storage using Cloud SQL API(beta) (export) function. For this, I have installed jupyter notebook on google compute engine and I am running the python code (to connect to cloud sql API and export the date to cloud storage in a csv file) on that.

The python code does not throw any error and also there is no error body in API response. However, the API's response says "u'status': u'PENDING'" and I see the following error (in logs of Cloud SQL Dashboard) : error uploading CSV file to GCS: gs://[BUCKET_NAME]/[FILE_NAME].csv: Access denied for account [SERVICE_ACCOUNT_NAME]@speckle-umbrella-11.iam.gserviceaccount.com (permission issue?)

How do I ensure I have all the relevant access for the account ([SERVICE_ACCOUNT_NAME]@speckle-umbrella-11.iam.gserviceaccount.com) ? I am unable to locate this account or give myself access to this .


回答1:


By default Google Compute Engine instances have read only scope for Google Cloud Storage.

You should confirm that the Google Compute Engine instance scope is set to read/write.




回答2:


You need to grant the Cloud SQL instance service account access to your bucket. Visit the export documentation and click the GCLOUD (2ND GEN) tab which will show you the commands you need to use.

The command to grant the service account access to the bucket is

gsutil acl ch -u [SERVICE_ACCOUNT_ADDRESS]:W gs://[BUCKET_NAME]


来源:https://stackoverflow.com/questions/48759815/error-uploading-csv-to-google-cloud-storage-through-cloud-sql-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!