All Products
Search
Document Center

API Gateway:AliyunServiceRoleForApiGatewayConnectUserVpc

Last Updated:Mar 01, 2026

When you create a Dedicated Instance (VPC) in API Gateway, the system needs permissions to manage network interfaces, security groups, and VPC resources in your account. To grant these permissions securely, API Gateway uses a service-linked role.

This topic covers the AliyunServiceRoleForApiGatewayConnectUserVpc service-linked role, including its permissions, automatic creation, and deletion procedure.

For general information about service-linked roles, see Service-linked roles.

Role details

PropertyValue
Role nameAliyunServiceRoleForApiGatewayConnectUserVpc
Policy nameAliyunServiceRolePolicyForApiGatewayConnectUserVpc
Trusted serviceconnectuservpc.apigateway.aliyuncs.com
PurposeAllows API Gateway dedicated instances to access services in your virtual private cloud (VPC) over the internal network

Permissions

The AliyunServiceRolePolicyForApiGatewayConnectUserVpc policy grants the following permissions:

Network interface management

PermissionDescription
ecs:CreateNetworkInterfaceCreate elastic network interfaces (ENIs) in the VPC for API Gateway connectivity
ecs:DeleteNetworkInterfaceDelete ENIs that are no longer needed
ecs:AttachNetworkInterfaceAttach ENIs to instances
ecs:DetachNetworkInterfaceDetach ENIs from instances
ecs:DescribeNetworkInterfacesQuery ENI details
ecs:DescribeNetworkInterfaceAttributeQuery ENI attributes
ecs:ModifyNetworkInterfaceAttributeUpdate ENI attributes
ecs:CreateNetworkInterfacePermissionCreate cross-account ENI permissions
ecs:DescribeNetworkInterfacePermissionsQuery ENI permissions

IP address management

PermissionDescription
ecs:AssignPrivateIpAddressesAssign private IP addresses to ENIs
ecs:UnassignPrivateIpAddressesRelease private IP addresses from ENIs
ecs:AssignIpv6AddressesAssign IPv6 addresses to ENIs
ecs:UnassignIpv6AddressesRelease IPv6 addresses from ENIs

VPC and security group access

PermissionDescription
ecs:DescribeSecurityGroupsQuery security groups in the VPC
ecs:ListTagResourcesList tag resources
vpc:DescribeVpcsQuery available VPCs
vpc:DescribeVpcAttributeQuery VPC attributes
vpc:DescribeVSwitchesQuery vSwitches in the VPC
vpc:DescribeVSwitchAttributesQuery vSwitch attributes
vpc:ModifyBypassToaAttributeModify bypass ToA attribute

Role lifecycle management

PermissionDescription
ram:DeleteServiceLinkedRoleDelete this service-linked role (restricted to connectuservpc.apigateway.aliyuncs.com)

Full policy document

{
  "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",
        "ecs:AttachNetworkInterface",
        "ecs:DetachNetworkInterface",
        "ecs:CreateNetworkInterfacePermission",
        "ecs:DescribeNetworkInterfacePermissions",
        "ecs:ListTagResources",
        "vpc:DescribeVSwitchAttributes",
        "vpc:DescribeVpcAttribute",
        "vpc:ModifyBypassToaAttribute"
      ],
      "Resource": "*"
    },
    {
      "Action": "ram:DeleteServiceLinkedRole",
      "Resource": "*",
      "Effect": "Allow",
      "Condition": {
        "StringEquals": {
          "ram:ServiceName": "connectuservpc.apigateway.aliyuncs.com"
        }
      }
    }
  ]
}

Create the role

You do not need to manually create this role. When you create a Dedicated Instance (VPC) in API Gateway, the system automatically creates the AliyunServiceRoleForApiGatewayConnectUserVpc role and attaches the AliyunServiceRolePolicyForApiGatewayConnectUserVpc policy.

Note: If the role is not automatically created for your RAM user, the RAM user might lack the required permissions. Attach the following policy to your RAM user to grant the ram:CreateServiceLinkedRole permission:

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

Edit the role

API Gateway does not allow you to edit the AliyunServiceRoleForApiGatewayConnectUserVpc service-linked role. After the role is created, its name and permissions cannot be changed.

Delete the role

Before you delete the AliyunServiceRoleForApiGatewayConnectUserVpc role, release all API Gateway dedicated instances associated with the role. Then delete the role from the Resource Access Management (RAM) console.

Step 1: Release the dedicated instance

  1. Log on to the API Gateway console.

  2. In the left-side navigation pane, choose Instances and Clusters > Dedicated Instances.

  3. On the Instances tab, find the Dedicated Instance (VPC), and then click Release Instance.

Step 2: Delete the role

  1. Log on to the RAM console.

  2. In the left-side navigation pane, choose Identities > Roles.

  3. Find AliyunServiceRoleForApiGatewayConnectUserVpc and click Delete Role in the Actions column.

Related information