全部產品
Search
文件中心

API Gateway:API Gateway-微服務整合服務關聯角色

更新時間:Jul 13, 2024

本文為您介紹API Gateway - 整合微服務(ApiGateway - IntegrateWithMicroservices)的服務關聯角色,ApiGateway - IntegrateWithMicroservices使用此角色來訪問您在其他雲產品中的資源。

背景資訊

API Gateway - 微服務整合服務關聯角色(ApiGateway - IntegrateWithMicroservices)是API Gateway為了訪問您在Enterprise Distributed Application Service(EDAS)和微服務引擎(MSE)下的資源,而提供的RAM角色。更多關於服務關聯角色的資訊請參見服務關聯角色

應用情境

建立EDAS類型的後端服務/大量匯入EDAS類型的後端服務/大量匯入EDAS類型的API時,API Gateway會提示使用者建立服務關聯角色,使用者建立後,系統會自動建立一個名稱為AliyunServiceRoleForApiGatewayIntegrateWithMicroservices的服務關聯角色,並為該角色添加名稱為AliyunServiceRolePolicyForApiGatewayIntegrateWithMicroservices的權限原則,以授予API Gateway訪問其他雲資源的許可權。

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(服務關聯角色),需要先刪除依賴這個服務關聯角色的後端服務。操作步驟如下:

  1. 進入API Gateway控制台,在左側導覽列選擇API 管理>後端服務

  2. 後端服務列表,通過類型欄選擇EDAS搜尋後端服務,然後在右側操作列點擊刪除

  3. 進入RAM控制台,點擊左側菜單身份管理,找到角色AliyunServiceRoleForApiGatewayIntegrateWithMicroservices,然後刪除。

常見問題

為什麼我的RAM使用者無法自動建立API Gateway服務關聯角色(AliyunServiceRoleForApiGatewayIntegrateWithMicroservices)?

您需要擁有指定的許可權,才能自動建立或刪除API Gateway服務關聯角色(AliyunServiceRoleForApiGatewayIntegrateWithMicroservices)。因此,在RAM使用者無法自動建立API Gateway服務關聯角色(AliyunServiceRoleForApiGatewayIntegrateWithMicroservices)時,您需為其添加以下權限原則。

{

{
    "Statement": [
        {
            "Action": "ram:CreateServiceLinkedRole",
            "Resource": "*",
            "Effect": "Allow",
            "Condition": {
                "StringEquals": {
                    "ram:ServiceName": "microservice-integration.apigateway.aliyuncs.com"
                }
            }
        }
    ],
    "Version": "1"
}