全部產品
Search
文件中心

API Gateway:API Gateway-串連使用者VPC服務關聯角色

更新時間:Jul 13, 2024

本文為您介紹API Gateway - 串連使用者VPC服務關聯角色(AliyunServiceRoleForApiGatewayConnectUserVpc)的應用情境以及如何刪除API Gateway - 串連使用者VPC服務關聯角色。

背景資訊

API Gateway - 串連使用者VPC服務關聯角色(AliyunServiceRoleForApiGatewayConnectUserVpc)是API Gateway為了建立可以通過內網直接請求使用者VPC內服務的專享執行個體,而提供的RAM角色。更多關於服務關聯角色的資訊請參見服務關聯角色

應用情境

建立VPC融合類型的專享API Gateway時,如果服務關聯角色不存在,系統會自動建立一個名稱為AliyunServiceRoleForApiGatewayConnectUserVpc的服務關聯角色,並且為該角色添加名稱為AliyunServiceRolePolicyForApiGatewayConnectUserVpc的權限原則,授予API Gateway訪問其他雲資源的許可權。

AliyunServiceRoleForApiGatewayConnectUserVpc 介紹

角色名稱:AliyunServiceRoleForApiGatewayConnectUserVpc 角色權限原則:AliyunServiceRolePolicyForApiGatewayConnectUserVpc 許可權說明:

{
  "Version": "1",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ecs:CreateNetworkInterface",
        "ecs:DescribeNetworkInterfaceAttribute",
        "ecs:DescribeNetworkInterfaces",
        "ecs:DeleteNetworkInterface",
        "ecs:DescribeSecurityGroups",
        "ecs:ModifyNetworkInterfaceAttribute",
        "ecs:AssignPrivateIpAddresses",
        "ecs:UnassignPrivateIpAddresses",
        "ecs:AssignIpv6Addresses",
        "ecs:UnassignIpv6Addresses",
        "vpc:DescribeVpcs",
        "vpc:DescribeVSwitches"
      ],
      "Resource": "*"
    },
    {
      "Action": "ram:DeleteServiceLinkedRole",
      "Resource": "*",
      "Effect": "Allow",
      "Condition": {
        "StringEquals": {
          "ram:ServiceName": "connectuservpc.apigateway.aliyuncs.com"
        }
      }
    }
  ]
}

刪除服務關聯角色

如果您需要刪除AliyunServiceRoleForApiGatewayConnectUserVpc(服務關聯角色),需要先刪除依賴這個服務關聯角色的API Gateway專享執行個體。操作步驟如下:

  1. 進入API Gateway控制台,在左側導覽列選擇執行個體與叢集>專享執行個體

  2. 專享執行個體列表>執行個體列表頁面找到您建立的VPC融合類型的專享執行個體,在執行個體列表詳情的右上方選擇釋放執行個體

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

常見問題

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

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

{

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