Search code examples
google-app-enginegoogle-cloud-platformbucket

How can I access the GAE's associated bucket from another project?


I have deployed an API on GAE (project A), and recently started using the free bucket that comes with it.

The data populating the bucket has been put there manually, however, I would like for another project (project B) on GCP, a Compute Engine, to populate it. I cannot figure out how to access the bucket from said project (B).

I have to specify that the owners of each project are two different persons, since the project A was made by me and the project B was made by another team of my company.

Even though we didn't quite understand the process, we tried using the gcloud auth activate-service-account [ACCOUNT] --key-file=[KEY] with both the GAE service account of project A and the ComputeEngine service account of project B, to no avail: daemonize.Run: readFromProcess: sub-process: mountWithArgs: mountWithConn: setUpBucket: OpenBucket: Bad credentials for bucket "_name_". Check the bucket name and your credentials.

I also tried accessing the bucket from my GAE project, and it worked perfectly (so atleast the name is OK).

If anyone could provide some help on how to connect the project B to the bucket of project A, we would really appreciate it!


Solution

  • To do that, you must give access to the service account of the Compute Engine in order to edit the storage bucket.

    You can do that by following the instructions here.

    You can easily find the service account of your Compute Engine by going to IAM settings of your project and inspecting the members.

    If it suits your needs, you can even mount the Storage Bucket as a file system to your Compute engine by using FUSE. You can try implementing that by having a look here