当您使用资源组对资源进行分组管理时,可以结合访问控制(RAM),在单个阿里云账号内实现资源的隔离和精细化权限管理。本文总结了云原生API网关对资源组的支持情况,以及资源组级别的授权操作步骤。
-
只有支持资源组的资源类型和支持资源组级别授权的操作,资源组级别授权才能生效。
-
对于不支持资源组的资源类型,授予资源组范围的权限将无效。在选择资源范围时,请选择账号级别,进行账号级别授权。具体操作,请参见不支持资源组级别授权的操作。
资源组授权的工作原理
您可以使用资源组(Resource Group)对阿里云账号内的资源进行分组管理。例如,为不同的项目创建对应的资源组,并将资源转移到对应的组中,以便集中管理各项目的资源。更多信息,请参见什么是资源组。
在完成资源分组后,您可以为不同的RAM授权主体(RAM用户、RAM用户组或RAM角色)授予指定资源组范围的权限,从而限定这个授权主体只能管理该资源组内的资源。更多信息,请参见资源分组和授权。
这种授权方式的优点有:
-
权限精细化:确保每个身份能获得最准确的资源访问权限,避免账号下的多个项目的资源混合管理。
-
良好的扩展性:后续新增资源时,只需将其加入该资源组,RAM身份便会自动获得新资源的相应权限,无需再次授权。
为RAM用户授予资源组级别的权限
下面以RAM用户为例,介绍授予指定资源组内云原生API网关资源权限的操作步骤。
1. 前置步骤
2. 进行资源组级别授权
您可以通过以下任一方式进行资源组级别授权。
方式一:在资源管理控制台中授权
通过资源组的权限管理功能为指定 RAM 用户授权。详情操作可参见为RAM身份授予资源组范围的权限。
方式二:在 RAM 控制台中授权
通过RAM控制台为指定 RAM 用户进行资源组级别授权。详细操作可参见为RAM用户授权。
支持资源组的资源类型
云原生API网关支持资源组的资源类型如下表所示:
|
云服务 |
云服务代码 |
资源类型 |
|
云原生API网关 |
apig |
domain : 域名 |
|
云原生API网关 |
apig |
environment : 环境 |
|
云原生API网关 |
apig |
gateway : 实例 |
|
云原生API网关 |
apig |
httpapi : API |
|
云原生API网关 |
apig |
service : 服务 |
|
云原生API网关 |
apig |
source : 服务来源 |
对于暂不支持资源组的资源类型,如有需要,您可以在资源组控制台提交反馈。

不支持资源组级别授权的操作
云原生API网关中不支持资源组级别授权的操作(Action)如下:
|
操作(Action) |
操作描述 |
|
apig:BatchDeleteConsumerAuthorizationRule |
批量解除消费者授权规则 |
|
apig:CancelAiGenerateTask |
- |
|
apig:CheckCommodityStatus |
- |
|
apig:CheckRegularExpressions |
- |
|
apig:CreateAiGenerateWebIde |
- |
|
apig:CreateAndAttachPolicy |
- |
|
apig:CreateConsumer |
创建消费者。 |
|
apig:CreateConsumerAuthorizationRule |
创建消费者授权规则。 |
|
apig:CreateConsumerAuthorizationRules |
创建消费者授权规则 |
|
apig:CreateMcpServer |
创建一个模型上下文协议(MCP)服务器。 |
|
apig:CreateMigrationTask |
- |
|
apig:CreatePluginAttachment |
挂载插件 |
|
apig:CreatePluginClass |
- |
|
apig:CreatePluginRepository |
- |
|
apig:CreatePluginWorkspace |
- |
|
apig:CreatePolicy |
创建策略。 |
|
apig:CreatePolicyAttachment |
创建策略资源挂载。 |
|
apig:CreateSecret |
- |
|
apig:CreateWebIde |
- |
|
apig:DeleteConsumer |
删除消费者。 |
|
apig:DeleteConsumerAuthorizationRule |
删除消费者授权规则。 |
|
apig:DeleteMcpServer |
- |
|
apig:DeleteMigrationTask |
- |
|
apig:DeletePluginAttachment |
删除插件挂载 |
|
apig:DeletePluginClass |
- |
|
apig:DeletePolicy |
删除策略。 |
|
apig:DeletePolicyAttachment |
删除策略资源挂载。 |
|
apig:DeleteSecret |
- |
|
apig:DeleteWebIde |
- |
|
apig:DeployDomain |
- |
|
apig:DeployMcpServer |
- |
|
apig:DetachAndDeletePolicy |
- |
|
apig:ExportCodeFile |
- |
|
apig:ExportWasmFile |
- |
|
apig:GetAiGenerateTaskStatus |
- |
|
apig:GetConsumer |
获取消费者。 |
|
apig:GetConsumerAuthorizationRule |
获取消费者授权规则。 |
|
apig:GetHttpApiAttachment |
- |
|
apig:GetHttpApiInstanceByEnvId |
- |
|
apig:GetMcpServer |
- |
|
apig:GetMigrationNamespacedServices |
- |
|
apig:GetMigrationTask |
- |
|
apig:GetPluginAttachment |
- |
|
apig:GetPluginClass |
- |
|
apig:GetPluginWorkspace |
- |
|
apig:GetPolicy |
获取策略。 |
|
apig:GetPolicyAttachment |
查询策略资源挂载。 |
|
apig:GetResourceOverview |
获取资源概览信息。 |
|
apig:GetSecret |
- |
|
apig:GetSecretValue |
- |
|
apig:InstallPlugin |
安装插件 |
|
apig:InvokeAIAgent |
- |
|
apig:ListConsumerAuthorizationRules |
- |
|
apig:ListConsumers |
获取消费者列表。 |
|
apig:ListEvents |
- |
|
apig:ListGatewayErrorAccessLogs |
- |
|
apig:ListGatewayUpgradableVersions |
- |
|
apig:ListGlobalPolicies |
- |
|
apig:ListInstallableGateways |
- |
|
apig:ListLocations |
- |
|
apig:ListMcpServers |
- |
|
apig:ListMigrationTasks |
- |
|
apig:ListPluginAttachments |
获取插件挂载列表 |
|
apig:ListPluginClasses |
- |
|
apig:ListPluginRepositories |
- |
|
apig:ListPluginWorkspace |
- |
|
apig:ListPlugins |
获取插件列表 |
|
apig:ListPolicies |
查询策略列表。 |
|
apig:ListPolicyClasses |
- |
|
apig:ListSecretReferences |
- |
|
apig:ListSecrets |
- |
|
apig:ListServiceQuotas |
- |
|
apig:ListSourcesInner2 |
- |
|
apig:ListSslCerts |
- |
|
apig:ListSyncMCPServer |
- |
|
apig:ListSyncedMCPServer |
- |
|
apig:ListZones |
获取云原生API网关region下的可用区。 |
|
apig:MCPMessaging |
- |
|
apig:MCPSSETransport |
- |
|
apig:ModifyQuotaLimitValue |
- |
|
apig:ModifyServiceQuota |
- |
|
apig:QueryConsumerAuthorizationRules |
查询消费者授权规则列表 |
|
apig:QueryTestClusterData |
- |
|
apig:QueryTestDBData |
- |
|
apig:RefreshPluginOAuthCode |
- |
|
apig:RemoveConsumerAuthorizationRule |
删除消费者授权规则 |
|
apig:RetryCreateGateway |
- |
|
apig:RunPluginPipeline |
- |
|
apig:SyncMCPServer |
- |
|
apig:SyncMCPServers |
- |
|
apig:UnDeployMcpServer |
- |
|
apig:UninstallPlugin |
卸载插件 |
|
apig:UpdateAndAttachPolicy |
更新并挂载策略。 |
|
apig:UpdateAuthorizationRule |
- |
|
apig:UpdateConsumer |
更新消费者。 |
|
apig:UpdateConsumerAuthorizationRule |
更新消费者授权规则。 |
|
apig:UpdateEnvironment |
更新环境。 |
|
apig:UpdateMcpServer |
- |
|
apig:UpdateMigrationTask |
- |
|
apig:UpdatePluginAttachment |
更新插件挂载 |
|
apig:UpdatePolicy |
更新策略。 |
|
apig:UpdateSecret |
- |
|
apig:UpdateServiceVersion |
更新服务版本。 |
|
apig:UploadCodeFile |
- |
|
apig:VerifyMigrationTask |
- |
|
apig:test |
- |
对于不支持资源组授权的操作,授权时资源范围选择资源组级别将无效。如果仍需要RAM用户有上述操作权限,您需要创建自定义权限策略,授权时资源范围选择账号级别。
以下是两个自定义权限策略示例,您可以根据实际需要调整策略内容。
-
允许不支持资源组级别授权的全部只读操作:
Action中列举不支持资源组级别授权的所有只读操作。{ "Version": "1", "Statement": [ { "Effect": "Allow", "Action": [ "apig:CheckCommodityStatus", "apig:CheckRegularExpressions", "apig:ExportCodeFile", "apig:ExportWasmFile", "apig:GetAiGenerateTaskStatus", "apig:GetConsumer", "apig:GetConsumerAuthorizationRule", "apig:GetHttpApiAttachment", "apig:GetHttpApiInstanceByEnvId", "apig:GetMcpServer", "apig:GetMigrationNamespacedServices", "apig:GetMigrationTask", "apig:GetPluginAttachment", "apig:GetPluginClass", "apig:GetPluginWorkspace", "apig:GetPolicy", "apig:GetPolicyAttachment", "apig:GetResourceOverview", "apig:GetSecret", "apig:GetSecretValue", "apig:ListConsumerAuthorizationRules", "apig:ListConsumers", "apig:ListEvents", "apig:ListGatewayErrorAccessLogs", "apig:ListGatewayUpgradableVersions", "apig:ListGlobalPolicies", "apig:ListInstallableGateways", "apig:ListLocations", "apig:ListMcpServers", "apig:ListMigrationTasks", "apig:ListPluginAttachments", "apig:ListPluginClasses", "apig:ListPluginRepositories", "apig:ListPluginWorkspace", "apig:ListPlugins", "apig:ListPolicies", "apig:ListPolicyClasses", "apig:ListSecretReferences", "apig:ListSecrets", "apig:ListServiceQuotas", "apig:ListSourcesInner2", "apig:ListSslCerts", "apig:ListSyncMCPServer", "apig:ListSyncedMCPServer", "apig:ListZones", "apig:QueryConsumerAuthorizationRules", "apig:QueryTestClusterData", "apig:QueryTestDBData" ], "Resource": "*" } ] } -
允许不支持资源组级别授权的全部操作:
Action中列举不支持资源组级别授权的全部操作。{ "Version": "1", "Statement": [ { "Effect": "Allow", "Action": [ "apig:BatchDeleteConsumerAuthorizationRule", "apig:CancelAiGenerateTask", "apig:CheckCommodityStatus", "apig:CheckRegularExpressions", "apig:CreateAiGenerateWebIde", "apig:CreateAndAttachPolicy", "apig:CreateConsumer", "apig:CreateConsumerAuthorizationRule", "apig:CreateConsumerAuthorizationRules", "apig:CreateMcpServer", "apig:CreateMigrationTask", "apig:CreatePluginAttachment", "apig:CreatePluginClass", "apig:CreatePluginRepository", "apig:CreatePluginWorkspace", "apig:CreatePolicy", "apig:CreatePolicyAttachment", "apig:CreateSecret", "apig:CreateWebIde", "apig:DeleteConsumer", "apig:DeleteConsumerAuthorizationRule", "apig:DeleteMcpServer", "apig:DeleteMigrationTask", "apig:DeletePluginAttachment", "apig:DeletePluginClass", "apig:DeletePolicy", "apig:DeletePolicyAttachment", "apig:DeleteSecret", "apig:DeleteWebIde", "apig:DeployDomain", "apig:DeployMcpServer", "apig:DetachAndDeletePolicy", "apig:ExportCodeFile", "apig:ExportWasmFile", "apig:GetAiGenerateTaskStatus", "apig:GetConsumer", "apig:GetConsumerAuthorizationRule", "apig:GetHttpApiAttachment", "apig:GetHttpApiInstanceByEnvId", "apig:GetMcpServer", "apig:GetMigrationNamespacedServices", "apig:GetMigrationTask", "apig:GetPluginAttachment", "apig:GetPluginClass", "apig:GetPluginWorkspace", "apig:GetPolicy", "apig:GetPolicyAttachment", "apig:GetResourceOverview", "apig:GetSecret", "apig:GetSecretValue", "apig:InstallPlugin", "apig:InvokeAIAgent", "apig:ListConsumerAuthorizationRules", "apig:ListConsumers", "apig:ListEvents", "apig:ListGatewayErrorAccessLogs", "apig:ListGatewayUpgradableVersions", "apig:ListGlobalPolicies", "apig:ListInstallableGateways", "apig:ListLocations", "apig:ListMcpServers", "apig:ListMigrationTasks", "apig:ListPluginAttachments", "apig:ListPluginClasses", "apig:ListPluginRepositories", "apig:ListPluginWorkspace", "apig:ListPlugins", "apig:ListPolicies", "apig:ListPolicyClasses", "apig:ListSecretReferences", "apig:ListSecrets", "apig:ListServiceQuotas", "apig:ListSourcesInner2", "apig:ListSslCerts", "apig:ListSyncMCPServer", "apig:ListSyncedMCPServer", "apig:ListZones", "apig:MCPMessaging", "apig:MCPSSETransport", "apig:ModifyQuotaLimitValue", "apig:ModifyServiceQuota", "apig:QueryConsumerAuthorizationRules", "apig:QueryTestClusterData", "apig:QueryTestDBData", "apig:RefreshPluginOAuthCode", "apig:RemoveConsumerAuthorizationRule", "apig:RetryCreateGateway", "apig:RunPluginPipeline", "apig:SyncMCPServer", "apig:SyncMCPServers", "apig:UnDeployMcpServer", "apig:UninstallPlugin", "apig:UpdateAndAttachPolicy", "apig:UpdateAuthorizationRule", "apig:UpdateConsumer", "apig:UpdateConsumerAuthorizationRule", "apig:UpdateEnvironment", "apig:UpdateMcpServer", "apig:UpdateMigrationTask", "apig:UpdatePluginAttachment", "apig:UpdatePolicy", "apig:UpdateSecret", "apig:UpdateServiceVersion", "apig:UploadCodeFile", "apig:VerifyMigrationTask", "apig:test" ], "Resource": "*" } ] }
获得账号级别权限的RAM用户或RAM角色,能够操作整个账号范围内的相关资源。请务必确认所授予的权限是否符合预期,遵从最小授权原则谨慎分配权限。
常见问题
如何查看当前资源属于哪个资源组?
-
方式一:单击资源名称,进入资源的详情页面,即可查看到当前资源的资源组。
-
方式二:登录资源管理控制台,单击,在左侧选择目标资源所属账号(默认为当前账号),通过筛选条件定位目标资源,即可查看其所属资源组。
如何查看当前产品在某个资源组下的所有资源?
如何批量修改多个资源的资源组?
登录资源管理控制台,单击,在目标资源组所在行的操作列下,单击资源管理以进入资源管理页面。通过筛选条件定位多个目标资源,批量勾选第一列的复选框后单击下方转移资源组,并按页面提示完成资源组修改。