Attempting to export Cloud SQL db from GCE instance throws permission error

1,014 views
Skip to first unread message

rcun...@jobutrax.com

unread,
Jan 5, 2016, 6:53:27 PM1/5/16
to Google Cloud SQL discuss
I am trying to export my Cloud SQL database to my storage bucket when executing from a GCE instance, however I always seem to get the error "ERROR: (gcloud.sql.instances.export) Insufficient Permission". My command:

gcloud sql instances export my_cloudsql_name gs://my_bucket/backup.sql.gz --database my_db

I have enabled the Google Cloud Storage API and the Cloud SQL API and added the scopes compute-rw, sql-admin, storage-full. I have even gone as far as giving full access on all available scopes, but I still get the error. However, it seems to work ONLY if I use the cloud-platform scope, which is the "Allow API access to all Google Cloud services in the same project" checkbox. But it has to be that...I have no success manually selecting any scope permissions.

Is this intended or is there an issue here? I would be great to be able to export the database without exposing access to every API.

Vadim Berezniker

unread,
Jan 5, 2016, 7:02:28 PM1/5/16
to Google Cloud SQL discuss
Is this a Second Generation instance?

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/4997e8b1-8ecf-4f39-b79f-af87e556f420%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

rcun...@jobutrax.com

unread,
Jan 5, 2016, 7:09:46 PM1/5/16
to Google Cloud SQL discuss
The Cloud SQL instance is First Generation
The GCE instance is running the latest CentOS 6.7



On Tuesday, January 5, 2016 at 5:02:28 PM UTC-7, Vadim Berezniker wrote:
Is this a Second Generation instance?

On Tue, Jan 5, 2016 at 3:53 PM <rcun...@jobutrax.com> wrote:
I am trying to export my Cloud SQL database to my storage bucket when executing from a GCE instance, however I always seem to get the error "ERROR: (gcloud.sql.instances.export) Insufficient Permission". My command:

gcloud sql instances export my_cloudsql_name gs://my_bucket/backup.sql.gz --database my_db

I have enabled the Google Cloud Storage API and the Cloud SQL API and added the scopes compute-rw, sql-admin, storage-full. I have even gone as far as giving full access on all available scopes, but I still get the error. However, it seems to work ONLY if I use the cloud-platform scope, which is the "Allow API access to all Google Cloud services in the same project" checkbox. But it has to be that...I have no success manually selecting any scope permissions.

Is this intended or is there an issue here? I would be great to be able to export the database without exposing access to every API.

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsub...@googlegroups.com.

George

unread,
Jan 7, 2016, 4:27:58 PM1/7/16
to Google Cloud SQL discuss
Hello,

You can check if the service account is the active one on the instance by running the following command:

 gcloud auth list

If it's not the active account on the instance, then this might be causing your issue.

I hope this helps.

Sincerely,
George

rcun...@jobutrax.com

unread,
Jan 7, 2016, 4:42:00 PM1/7/16
to Google Cloud SQL discuss
Yes the service account is the active one in the "Credentialed Accounts". The service account also has full permissions in my project.

George

unread,
Jan 7, 2016, 5:00:12 PM1/7/16
to Google Cloud SQL discuss
Hello,

Is it possible to reply to me privately with the output of the following command from the GCE instance and with your project ID as well?

gcloud compute instances describe INSTANCE_NAME

Sincerely,
George

Tianzhou Chen

unread,
Jan 8, 2016, 1:54:16 PM1/8/16
to Google Cloud SQL discuss
Reply all
Reply to author
Forward
0 new messages