AI Gateway service-linked roles are predefined Resource Access Management (RAM) roles designed for specific features. This topic describes the service-linked roles for AI Gateway and explains how to manage them.
Scenarios
The following table lists the service-linked roles for AI Gateway.
| Role name | Purpose | Integrated services |
|---|---|---|
| AliyunServiceRoleForNativeApiGw | Access resources in other Alibaba Cloud services | Virtual Private Cloud (VPC), Container Service for Kubernetes (ACK), Function Compute (FC), Enterprise Distributed Application Service (EDAS), Microservices Engine (MSE), Server Load Balancer (SLB), Network Load Balancer (NLB), Elastic Compute Service (ECS), Application Real-Time Monitoring Service (ARMS) |
| AliyunServiceRoleForNativeApiGwInvokeFC | Invoke FC functions to enable gateway features | Function Compute (FC) |
| AliyunServiceRoleForNativeApiGwInvokeKMS | Cloud-native API Gateway uses this role to access Key Management Service (KMS) | Key Management Service (KMS) |
Permissions required for a RAM user to use service-linked roles
To allow a RAM user to create or delete service-linked roles, grant the RAM user administrator permissions (AliyunNativeApiGwFullAccess) or add the following permissions to the Action statement in a custom policy:
Create a service-linked role:
ram:CreateServiceLinkedRoleDelete a service-linked role:
ram:DeleteServiceLinkedRole
For more information, see Permissions required to create and delete a service-linked role.
Permissions
AliyunServiceRoleForNativeApiGw
The permissions granted to AliyunServiceRoleForNativeApiGw vary by cloud service.
VPC
{
"Effect": "Allow",
"Action": [
"vpc:AllocateEipAddress",
"vpc:AllocateEipAddressPro",
"vpc:DescribeEipAddresses",
"vpc:AssociateEipAddress",
"vpc:UnassociateEipAddress",
"vpc:ReleaseEipAddress",
"vpc:ModifyEipAddressAttribute",
"vpc:ModifyBypassToaAttribute",
"vpc:AddCommonBandwidthPackageIp",
"vpc:RemoveCommonBandwidthPackageIp",
"vpc:TagResources",
"vpc:DescribeVSwitches",
"vpc:DescribeVSwitchAttributes",
"vpc:DescribeVpcs",
"vpc:CreateVSwitch",
"vpc:DescribeVpcAttribute",
"vpc:DescribeVRouters",
"vpc:DescribeRouteTables",
"vpc:DescribeRouteEntryList"
],
"Resource": "*"
}Container Service for Kubernetes
{
"Effect": "Allow",
"Action": [
"cs:DescribeClusterDetail",
"cs:DescribeClusterInnerServiceKubeconfig",
"cs:RevokeClusterInnerServiceKubeconfig",
"cs:GetUserConfig",
"cs:DescribeClusterUserKubeconfig",
"cs:GetClusterById",
"cs:GetClustersByUid",
"cs:DescribeClustersV1",
"cs:ListClusters",
"cs:GetClusters",
"cs:DescribeClusterNodePools"
],
"Resource": "*"
}Function Compute (FC)
{
"Effect": "Allow",
"Action": [
"fc:ListAliases",
"fc:ListServices",
"fc:ListServiceVersions",
"fc:ListFunctions",
"fc:ListFunctionVersions",
"fc:ListTriggers"
],
"Resource": "*"
}EDAS
{
"Effect": "Allow",
"Action": [
"edas:ReadNamespace",
"edas:ReadService",
"edas:ListUserDefineRegion"
],
"Resource": "*"
}MSE
{
"Effect": "Allow",
"Action": [
"mse:ListAnsServices",
"mse:ListEngineNamespaces",
"mse:ListClusters",
"mse:QueryConfig"
],
"Resource": "*"
}SLB
{
"Effect": "Allow",
"Action": [
"slb:SetLoadBalancerName",
"slb:CreateLoadBalancer",
"slb:AddBackendServers",
"slb:SetBackendServers",
"slb:RemoveBackendServers",
"slb:CreateLoadBalancerTCPListener",
"slb:DescribeLoadBalancerTCPListenerAttribute",
"slb:SetLoadBalancerTCPListenerAttribute",
"slb:CreateLoadBalancerHTTPListener",
"slb:DescribeLoadBalancerHTTPListenerAttribute",
"slb:SetLoadBalancerHTTPListenerAttribute",
"slb:CreateLoadBalancerHTTPSListener",
"slb:DescribeLoadBalancerHTTPSListenerAttribute",
"slb:SetLoadBalancerHTTPSListenerAttribute",
"slb:StartLoadBalancerListener",
"slb:StopLoadBalancerListener",
"slb:DeleteLoadBalancerListener",
"slb:DescribeLoadBalancers",
"slb:DescribeLoadBalancerAttribute",
"slb:DescribeHealthStatus",
"slb:CreateLoadBalancerForCloudService",
"slb:DeleteLoadBalancer",
"slb:ModifyLoadBalancerInternetSpec",
"slb:RemoveTags",
"slb:AddTags",
"slb:SetLoadBalancerUDPListenerAttribute",
"slb:CreateLoadBalancerUDPListener",
"slb:CreateVServerGroup",
"slb:DeleteVServerGroup",
"slb:SetVServerGroupAttribute",
"slb:ModifyVServerGroupBackendServers",
"slb:AddVServerGroupBackendServers",
"slb:ModifyLoadBalancerInstanceSpec",
"slb:ModifyLoadBalancerInternetSpec",
"slb:RemoveVServerGroupBackendServers",
"slb:SetLoadBalancerModificationProtection",
"slb:SetLoadBalancerDeleteProtection",
"slb:DescribeLoadBalancerUDPListenerAttribute ",
"slb:DescribeTags",
"slb:DescribeVServerGroups",
"slb:DescribeVServerGroupAttribute",
"slb:DescribeLoadBalancerListeners",
"slb:ListTagResources",
"slb:TagResources",
"slb:UntagResources"
],
"Resource": "*"
}NLB
{
"Effect": "Allow",
"Action": [
"nlb:TagResources",
"nlb:UnTagResources",
"nlb:ListTagResources",
"nlb:CreateLoadBalancer",
"nlb:DeleteLoadBalancer",
"nlb:GetLoadBalancerAttribute",
"nlb:ListLoadBalancers",
"nlb:UpdateLoadBalancerAttribute",
"nlb:UpdateLoadBalancerAddressTypeConfig",
"nlb:UpdateLoadBalancerZones",
"nlb:CreateListener",
"nlb:DeleteListener",
"nlb:ListListeners",
"nlb:UpdateListenerAttribute",
"nlb:StopListener",
"nlb:StartListener",
"nlb:GetListenerAttribute",
"nlb:GetListenerHealthStatus",
"nlb:CreateServerGroup",
"nlb:DeleteServerGroup",
"nlb:UpdateServerGroupAttribute",
"nlb:AddServersToServerGroup",
"nlb:RemoveServersFromServerGroup",
"nlb:UpdateServerGroupServersAttribute",
"nlb:ListServerGroups",
"nlb:ListServerGroupServers",
"nlb:LoadBalancerLeaveSecurityGroup",
"nlb:LoadBalancerJoinSecurityGroup",
"nlb:GetJobStatus",
"nlb:UpdateLoadBalancerProtection"
],
"Resource": "*"
}ECS
{
"Effect": "Allow",
"Action": [
"ecs:CreateSecurityGroup",
"ecs:AuthorizeSecurityGroup",
"ecs:AuthorizeSecurityGroupEgress",
"ecs:RevokeSecurityGroup",
"ecs:RevokeSecurityGroupEgress",
"ecs:DeleteSecurityGroup",
"ecs:JoinSecurityGroup",
"ecs:LeaveSecurityGroup",
"ecs:DescribeSecurityGroups",
"ecs:DescribeInstances",
"ecs:CreateNetworkInterface",
"ecs:DeleteNetworkInterface",
"ecs:DescribeNetworkInterfaces",
"ecs:CreateNetworkInterfacePermission",
"ecs:DescribeNetworkInterfacePermissions",
"ecs:DeleteNetworkInterfacePermission",
"ecs:DescribeSecurityGroupAttribute",
"ecs:AddTags",
"ecs:DescribeEipAddresses",
"ecs:DescribeNetworkInterfaceAttribute",
"ecs:ModifyNetworkInterfaceAttribute",
"ecs:AssignPrivateIpAddresses",
"ecs:UnassignPrivateIpAddresses",
"ecs:AssignIpv6Addresses",
"ecs:UnassignIpv6Addresses",
"ecs:AttachNetworkInterface",
"ecs:DetachNetworkInterface",
"ecs:ListTagResources"
],
"Resource": "*"
}ARMS
{
"Effect": "Allow",
"Action": [
"arms:OpenArmsService",
"arms:GetAlertRules",
"arms:ReportCustomIncidents",
"arms:AddPrometheusInstance",
"arms:GetAuthToken",
"arms:GetClusterAllUrl",
"arms:OpenArmsServiceSecondVersion",
"arms:CheckServiceStatus",
"arms:OpenVCluster",
"arms:GetPrometheusApiToken",
"arms:ListDashboards",
"arms:GetExploreUrl",
"arms:CreateDefaultCloudProductPrometheusAlertRule",
"arms:ListNotificationPolicies",
"arms:ListDispatchRule",
"arms:CreateDispatchRule",
"arms:CreateOrUpdateNotificationPolicy",
"arms:DescribeContactGroups",
"arms:SearchContactGroup",
"arms:CreatePrometheusAlertRule"
],
"Resource": "*"
}AliyunServiceRoleForNativeApiGwInvokeFC
AliyunServiceRoleForNativeApiGwInvokeFC has the following permissions:
{
"Effect": "Allow",
"Action": "fc:InvokeFunction",
"Resource": "*"
}AliyunServiceRoleForNativeApiGwInvokeKMS
AliyunServiceRoleForNativeApiGwInvokeKMS has the following permissions:
{
"Effect": "Allow",
"Action": [
"kms:ListKmsInstances",
"kms:ListKeys",
"kms:GenerateDataKey",
"kms:Decrypt",
"kms:CreateSecret",
"kms:DeleteSecret",
"kms:UpdateSecret",
"kms:DescribeSecret",
"kms:GetSecretValue",
"kms:PutSecretValue",
"kms:TagResource",
"kms:UntagResource"
],
"Resource": "*"
}View a service-linked role
After a service-linked role is created, search for the role name (AliyunServiceRoleForNativeApiGw or AliyunServiceRoleForNativeApiGwInvokeFC) on the Roles page of the RAM console to view the following information:
Basic information
In the Basic Information section of the role details page, view the role name, creation time, role ARN, and remarks.
Permission policy
On the Permissions tab of the role details page, click the policy name to view the policy content and the cloud resources the role can access.
Trust policy
On the Trust Policy tab of the role details page, view the trust policy document. A trust policy defines the trusted entities that can assume a RAM role. For a service-linked role, the trusted entity is an Alibaba Cloud service, identified in the
Servicefield.
For more information about how to view service-linked roles, see View the information about a RAM role.
Delete a service-linked role
If you no longer use AI Gateway, you can manually delete the service-linked role in the RAM console.
Log on to the RAM console. In the left-side navigation pane, choose .
On the Roles page, enter the role name in the search box. For example, enter
AliyunServiceRoleForNativeApiGw.Find the role in the search results and click Delete Role in the Actions column.
Enter the role name in the confirmation dialog box, and then click Delete Role.
After you delete an AI Gateway service-linked role, features that depend on the role no longer work as expected. Proceed with caution.
FAQ
Why does my RAM user fail to automatically create the AI Gateway service-linked role (AliyunServiceRoleForNativeApiGw)?
The RAM user lacks the required permissions. Attach the following permission policy to the RAM user:
{
"Statement": [
{
"Action": [
"ram:CreateServiceLinkedRole"
],
"Resource": "acs:ram:*:Alibaba Cloud account ID:role/*",
"Effect": "Allow",
"Condition": {
"StringEquals": {
"ram:ServiceName": [
"nativeapigw.aliyuncs.com"
]
}
}
}
],
"Version": "1"
}Replace Alibaba Cloud account ID with the ID of your Alibaba Cloud account.
Why does my RAM user fail to automatically create the AI Gateway service-linked role (AliyunServiceRoleForNativeApiGwInvokeFC)?
The RAM user lacks the required permissions. Attach the following permission policy to the RAM user:
{
"Statement": [
{
"Action": [
"ram:CreateServiceLinkedRole"
],
"Resource": "acs:ram:*:Alibaba Cloud account ID:role/*",
"Effect": "Allow",
"Condition": {
"StringEquals": {
"ram:ServiceName": [
"invokefc.nativeapigw.aliyuncs.com"
]
}
}
}
],
"Version": "1"
}Replace Alibaba Cloud account ID with the ID of your Alibaba Cloud account.
References
For more information about service-linked roles, see Service-linked roles.