I'm trying to upload a file from a Google Cloud VM into a cloud storage bucket.
Expectedly it fails because the service account associated with the VM doesn't have permissions:
$ gsutil cp file.png gs://bucket/
Copying file://file.png [Content-Type=image/png]...
AccessDeniedException: 403 Insufficient Permission
From what I understand there are two ways to fix this:
- modify the scopes from the VM web admin panel
- change the permissions of the bucket and add the service account with write access (I'd prefer this because the other option seems to give access to all buckets in the same project)
However, it seems that both solutions require the VM to be stopped, which is problematic as it is a production server.
Is there any way to fix this without stopping the VM?