更新时间:2026-05-21 GMT+08:00
分享

身份策略授权参考

云服务在IAM预置了常用的权限,称为系统身份策略。如果IAM系统身份策略无法满足授权要求,管理员可以根据各服务支持的授权项,创建IAM自定义身份策略来进行精细的访问控制,IAM自定义身份策略是对系统身份策略的扩展和补充。

除IAM服务外,Organizations服务中的服务控制策略(Service Control Policy,以下简称SCP)也可以使用这些授权项元素设置访问控制策略。

SCP不直接进行授权,只划定权限边界。将SCP绑定到组织单元或者成员账号时,并没有直接对组织单元或成员账号授予操作权限,而是规定了成员账号或组织单元包含的成员账号的授权范围。IAM身份策略授予权限的有效性受SCP限制,只有在SCP允许范围内的权限才能生效。

IAM服务与Organizations服务在使用这些元素进行访问控制时,存在着一些区别,详情请参见:IAM服务与Organizations服务权限访问控制的区别

本章节介绍IAM服务身份策略授权场景中自定义身份策略和组织服务中SCP使用的元素,这些元素包含了操作(Action)、资源(Resource)和条件(Condition)。

操作(Action)

操作(Action)即为身份策略中支持的授权项。

  • “访问级别”列描述如何对操作进行分类(List、Read和Write等)。此分类可帮助您了解在身份策略中相应操作对应的访问级别。
  • “资源类型”列指每个操作是否支持资源级权限。
    • 资源类型支持通配符号*表示所有。如果此列没有值(-),则必须在身份策略语句的Resource元素中指定所有资源类型(“*”)。
    • 如果该列包含资源类型,则必须在具有该操作的语句中指定该资源的URN。
    • 资源类型列中必需资源在表中用星号(*)标识,表示使用此操作必须指定该资源类型。

    关于AgentArts定义的资源类型的详细信息请参见资源类型(Resource)

  • “条件键”列包括了可以在身份策略语句的Condition元素中支持指定的键值。
    • 如果该授权项资源类型列存在值,则表示条件键仅对列举的资源类型生效。
    • 如果该授权项资源类型列没有值(-),则表示条件键对整个授权项生效。
    • 如果此列条件键没有值(-),表示此操作不支持指定条件键。

    关于AgentArts定义的条件键的详细信息请参见条件(Condition)

  • “别名”列包括了可以在身份策略中配置的策略授权项。通过这些授权项,可以控制支持策略授权的API访问。详细信息请参见身份策略兼容性说明

您可以在身份策略语句的Action元素中指定以下AgentArts的相关操作。

表1 AgentArts支持的授权项

授权项

描述

访问级别

资源类型(*为必须)

条件键

别名

agentarts:runtime:createCoreRuntime

授予权限以用户创建运行时。

Write

CoreRuntime *

-

-

-

agentarts:runtime:listCoreRuntimes

授予权限以用户查看运行时列表。

List

CoreRuntime *

-

-

agentarts:runtime:showCoreRuntime

授予权限以用户查看运行时详情。

Read

CoreRuntime *

g:ResourceTag/<tag-key>

-

agentarts:runtime:updateCoreRuntime

授予权限以用户更新运行时。

Write

CoreRuntime *

g:ResourceTag/<tag-key>

-

-

agentarts:runtime:deleteCoreRuntime

授予权限以用户删除运行时。

Write

CoreRuntime *

g:ResourceTag/<tag-key>

-

agentarts:runtimeEndpoint:createCoreRuntimeEndpoint

授予权限以用户创建运行时访问方式。

Write

CoreRuntimeEndpoint *

-

-

-

agentarts:runtimeEndpoint:listCoreRuntimeEndpoints

授予权限以用户查看运行时访问方式列表。

List

CoreRuntime *

-

-

CoreRuntimeEndpoint *

-

agentarts:runtimeEndpoint:showCoreRuntimeEndpoint

授予权限以用户查看运行时访问方式详情。

Read

CoreRuntimeEndpoint *

g:ResourceTag/<tag-key>

-

agentarts:runtimeEndpoint:updateCoreRuntimeEndpoint

授予权限以用户更新运行时访问方式。

Write

CoreRuntimeEndpoint *

g:ResourceTag/<tag-key>

-

-

agentarts:runtimeEndpoint:deleteCoreRuntimeEndpoint

授予权限以用户删除运行时访问方式。

Write

CoreRuntimeEndpoint *

g:ResourceTag/<tag-key>

-

agentarts:runtime:listCoreRuntimeVersions

授予权限以用户查看运行时版本列表。

List

CoreRuntime *

g:ResourceTag/<tag-key>

-

agentarts::createCoreSubscription

授予权限以用户开通AgentRun服务。

Write

-

-

-

agentarts::showCoreSubscription

授予用户查看AgentRun开通状态的权限。

Read

-

-

-

AgentArts的API通常对应着一个或多个授权项。表2展示了API与授权项的关系,以及该API需要依赖的授权项。

表2 API与授权项的关系

API

对应的授权项

依赖的授权项

POST /v1/core/runtimes

agentarts:runtime:createCoreRuntime

  • iam:agencies:pass
  • vpc:nativePorts:create
  • vpc:routeTables:update
  • eip:publicIps:associateInstance

GET /v1/core/runtimes

agentarts:runtime:listCoreRuntimes

-

GET /v1/core/runtimes/{runtime_id}

agentarts:runtime:showCoreRuntime

-

PUT /v1/core/runtimes/{runtime_id}

agentarts:runtime:updateCoreRuntime

  • iam:agencies:pass
  • vpc:nativePorts:create
  • vpc:routeTables:update
  • eip:publicIps:associateInstance

DELETE /v1/core/runtimes/{runtime_id}

agentarts:runtime:deleteCoreRuntime

  • vpc:routeTables:update
  • vpc:nativePorts:delete
  • eip:publicIps:disassociateInstance

POST /v1/core/runtimes/{runtime_id}/endpoints

agentarts:runtimeEndpoint:createCoreRuntimeEndpoint

-

GET /v1/core/runtimes/{runtime_id}/endpoints

agentarts:runtimeEndpoint:listCoreRuntimeEndpoints

-

GET /v1/core/runtimes/{runtime_id}/endpoints/{endpoint_id}

agentarts:runtimeEndpoint:showCoreRuntimeEndpoint

-

PUT /v1/core/runtimes/{runtime_id}/endpoints/{endpoint_id}

agentarts:runtimeEndpoint:updateCoreRuntimeEndpoint

-

DELETE /v1/core/runtimes/{runtime_id}/endpoints/{endpoint_id}

agentarts:runtimeEndpoint:deleteCoreRuntimeEndpoint

-

GET /v1/core/runtimes/{runtime_id}/versions

agentarts:runtime:listCoreRuntimeVersions

-

-

agentarts::createCoreSubscription

-

-

agentarts::showCoreSubscription

-

资源类型(Resource)

资源类型(Resource)用于定义身份策略生效的资源范围。如表3中某项操作已指定了对应的资源类型,则在包含该操作的身份策略语句中选择填写对应资源的URN时,身份策略仅对该指定资源生效;未填写对应资源的URN时,身份策略将对指定资源类型下所有资源生效;如未指定资源类型,Resource默认取值为“*”,身份策略将作用于所有资源。此外,您也可在身份策略中设置条件,进一步精细化限定资源类型。

AgentArts定义了以下可以在自定义身份策略的Resource元素中使用的资源类型。

表3 AgentArts支持的资源类型

资源类型

URN

CoreRuntimeEndpoint

agentarts:<region>:<account-id>:runtimeEndpoint:<runtime_name>/<endpoint-name>

CoreRuntime

agentarts:<region>:<account-id>:runtime:<runtime_name>

条件(Condition)

AgentArts服务不支持在身份策略中的条件键中配置服务级的条件键。AgentArts可以使用适用于所有服务的全局条件键,请参考全局条件键

相关文档