本文为您介绍API网关 - 集成微服务(ApiGateway - IntegrateWithMicroservices)的服务关联角色,ApiGateway - IntegrateWithMicroservices使用此角色来访问您在其他云产品中的资源。
背景信息
API网关 - 微服务集成服务关联角色(ApiGateway - IntegrateWithMicroservices)是API网关为了访问您在企业级分布式应用服务(EDAS)和微服务引擎(MSE)下的资源,而提供的RAM角色。更多关于服务关联角色的信息请参见服务关联角色。
应用场景
创建EDAS类型的后端服务/批量导入EDAS类型的后端服务/批量导入EDAS类型的API时,API网关会提示用户创建服务关联角色,用户创建后,系统会自动创建一个名称为AliyunServiceRoleForApiGatewayIntegrateWithMicroservices的服务关联角色,并为该角色添加名称为AliyunServiceRolePolicyForApiGatewayIntegrateWithMicroservices的权限策略,以授予API网关访问其他云资源的权限。
AliyunServiceRoleForApiGatewayIntegrateWithMicroservices 介绍
角色名称:AliyunServiceRoleForApiGatewayIntegrateWithMicroservices 角色权限策略:AliyunServiceRolePolicyForApiGatewayIntegrateWithMicroservices 权限说明:
{
  "Version": "1",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "edas:ReadApplication",
        "edas:ReadNamespace",
        "edas:ReadService"
      ],
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": [
        "mse:ListAnsServices",
        "mse:ListAnsInstances",
        "mse:ListClusters",
        "mse:QueryInstancesInfo",
        "mse:QueryClusterInfo"
      ],
      "Resource": "*"
    },
    {
      "Action": "ram:DeleteServiceLinkedRole",
      "Resource": "*",
      "Effect": "Allow",
      "Condition": {
        "StringEquals": {
          "ram:ServiceName": "microservice-integration.apigateway.aliyuncs.com"
        }
      }
    }
  ]
}删除服务关联角色
如果您需要删除AliyunServiceRoleForApiGatewayIntegrateWithMicroservices(服务关联角色),需要先删除依赖这个服务关联角色的后端服务。操作步骤如下:
常见问题
为什么我的RAM用户无法自动创建API网关服务关联角色(AliyunServiceRoleForApiGatewayIntegrateWithMicroservices)?
您需要拥有指定的权限,才能自动创建或删除API网关服务关联角色(AliyunServiceRoleForApiGatewayIntegrateWithMicroservices)。因此,在RAM用户无法自动创建API网关服务关联角色(AliyunServiceRoleForApiGatewayIntegrateWithMicroservices)时,您需为其添加以下权限策略。
{
{
    "Statement": [
        {
            "Action": "ram:CreateServiceLinkedRole",
            "Resource": "*",
            "Effect": "Allow",
            "Condition": {
                "StringEquals": {
                    "ram:ServiceName": "microservice-integration.apigateway.aliyuncs.com"
                }
            }
        }
    ],
    "Version": "1"
}