Abdul Rehman
Abdul Rehman

Reputation: 5684

How to share single Cloud Storage for Multiple VMs and Project on Google Cloud Platform

I'm working to finalize the setup for my project on Google Cloud Platform. I have multiple projects and VMS in these projects but I want to make a single central storage to store images and other resources.

So, Is that is a right way?

If yes, How can I Use single storage for multiple projects/VMS?

Help me, please!

Thanks in advance!

Upvotes: 1

Views: 457

Answers (1)

ch_mike
ch_mike

Reputation: 1576

Having a single central storage is alright if your use case requires so. Additionally, if you use Google Cloud Storage for that end, you won’t have to worry about replication, backups, encryption, etc.

How to do it:

There gotta be more than one way to achieve it. I can recommend you the following:

  1. Create one or more storage buckets in one of your projects, let’s call it project A. Note that bucket names are global identifiers, so you can reference your bucket from within different projects using the same name.

  2. In your other projects, take note of your Compute Engine Instances Service Accounts. A Service account is the identity that an instance uses to authenticate and gain access to other GCP services. If you didn’t define a custom Service Account for your instances, then they are set up to use the default Compute Engine Service Account. More on this here.

  3. Back to project A, go to IAM & admin and add your other project’s service accounts as members and grant them the Storage related role you require, for example, Object Admin.

  4. Now you can access your bucket in Project A from your instances in other projects using gsutil command line tool or the Cloud Storage API.

Upvotes: 2

Related Questions