4
votes

How to setup multi-account(project) in GCP, it is possible in AWS by using assume-role, anyone knows how to do it in Google Cloud (GCP)?

I tried to explore AWS equivalent in GCP, but not able to find any document.

2
Google Cloud IAM supports accessing multiple accounts with the same credentials. The AWS AssumeRole method is not required in Google Cloud except for G Suite. Edit your question to clarify what you need to do and I will recommend how to do that. AWS and GCP are so different in how IAM is implemented that it makes no sense to compare them feature by feature.John Hanley

2 Answers

3
votes

As documented, AssumeRole in AWS returns a set of temporary security credentials that you can use to access AWS resources that you might not normally have access to.

In AWS you can create one set of long-term credentials in one account. Then you can use temporary security credentials to access all the other accounts by assuming roles in those accounts.

The equivalent of the above in GCP would be creating short-lived credentials for service accounts to impersonate their identities (Documentation link).

Accordingly, in GCP you have the “caller” and the “limited-privilege service account” for whom the credential is created.

To implement this scenario, first, use handy documentation on Service Accounts and Cloud IAM Permission Roles in GCP, as each account is a Service Account with specific role permissions, in order to understand how accounts work in GCP.

The link I posted above, provides detailed information on the flows that allow a caller to create short-lived credentials for a service account and the supported credential types.

Additionally, this link can assist you in visualizing and understanding the resource hierarchy architecture in GCP and give you examples on how to structure your project according to your organization’s structure.

1
votes

The basic answer is "Service Roles". Limited-time service roles are available.

For assigning permissions across projects (but still in the same organization), you can create a custom role.

For letting any user assume the role of a service account, use the Service Account user role.

For limited-time authorization tokens, you have OAuth 2.0 for server-to-server calls, particularly with JWT where available.