如何将角色绑定添加到特定的 memorystore 实例?

How to add a role binding to a specific memorystore instance?

我想添加一个角色 (Cloud Memorystore Redis Editor) 绑定到 memorystore 中的特定 redis 或 memcached 实例。

我通常使用实例信息页面上的绑定向导来执行此操作。它根本不显示在 memorystore 实例页面上。

除了在 IAM 页面上添加有条件的成员之外,还有其他方法可以做到这一点吗?

此外,当我尝试列出具有 gcloud iam list-grantable-roles <resource_name> 的实例的可授予角色时,它 returns 对于 memcached 实例为空,并为 redis 实例提供 invalid argument name 错误。

谢谢


编辑:

我想将具有特定角色的成员添加到 redis 资源。 我要添加的角色是Cloud Memorystore Redis Editor

我添加了来自 Bigtable 实例的屏幕截图。我没有在 redis 实例的第二个屏幕截图中看到面板。没有打开该面板的选项。


选择实例会在“权限”选项卡下显示“添加成员”按钮


此面板允许我 select 一个成员并授予可授予此资源的角色

我认为 Redis 无法实现基于每个实例的权限。我从 Google 的 Memorystore for Redis (source) 的访问控制和权限页面得到了这句话。

Note: To call a method, you must also have the required scopes as described in the method's reference page, in addition to the permissions below. For more information, see Authorizing requests with OAuth 2.0. All permissions are applied to the project. You cannot apply different permissions based on the instance or other lower-level object.

如果您确实需要在访问管理方面隔离实例,我有一些建议:

  1. 如果 Redis 实例具有完全不同的用途,请将它们放在单独的项目中。
  2. 如果可行,您可以将 reader 和写入权限分开到不同的服务帐户下。
  3. 不要授予 roles/owner 权限,而是使用 roles/redis.editorroles/redis.viewerroles/redis.admin

第三点可能看起来很明显,但我看到很多人(甚至在 Whosebug 上)建议有人应该将所有者权限授予服务帐户才能使某些东西正常工作。它确实有效,但从安全角度来看,这是非常糟糕的做法。