云原生API网关服务关联角色(AliyunServiceRoleForNativeApiGw和AliyunServiceRoleForNativeApiGwInvokeFC)是为了实现特定功能而设计的预定义RAM角色。本文为您介绍云原生API网关服务关联角色(AliyunServiceRoleForNativeApiGw和AliyunServiceRoleForNativeApiGwInvokeFC)的应用场景以及如何删除服务关联角色。
服务关联角色的应用场景
AliyunServiceRoleForNativeApiGw:当云原生API网关需要访问专有网络VPC、容器服务 Kubernetes 版、函数计算FC、企业级分布式应用服务EDAS、微服务引擎MSE、负载均衡SLB、负载均衡NLB、云服务器ECS、应用实时监控服务ARMS等云服务的资源时,可通过自动创建的云原生API网关服务关联角色AliyunServiceRoleForNativeApiGw获取访问权限。
AliyunServiceRoleForNativeApiGwInvokeFC:当云原生API网关需要调用FC服务时,可通过自动创建的云原生API网关服务关联角色AliyunServiceRoleForNativeApiGwInvokeFC完成网关功能。
RAM用户使用服务关联角色需要的权限
如果使用RAM用户创建或删除服务关联角色,必须联系管理员为该RAM用户授予管理员权限(AliyunNativeApiGwFullAccess)或在自定义权限策略的Action
语句中为RAM用户添加以下权限:
创建服务关联角色:
ram:CreateServiceLinkedRole
删除服务关联角色:
ram:DeleteServiceLinkedRole
关于授权的详细操作,请参见创建和删除服务关联角色所需的权限。
权限说明
AliyunServiceRoleForNativeApiGw
云原生API网关服务关联角色(AliyunServiceRoleForNativeApiGw)具备的访问权限说明如下:
专有网络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": "*"
}
容器服务ACK
{
"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": "*"
}
函数计算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
云原生API网关服务关联角色(AliyunServiceRoleForNativeApiGwInvokeFC)具备的访问权限说明如下:
{
"Effect": "Allow",
"Action": "fc:InvokeFunction",
"Resource": "*"
}
查看服务关联角色
当服务关联角色创建成功后,您可以在RAM控制台的角色页面,通过搜索服务关联角色名称(AliyunServiceRoleForNativeApiGw、AliyunServiceRoleForNativeApiGwInvokeFC)查看该服务关联角色的以下信息:
基本信息
在AliyunServiceRoleForNativeApiGw或AliyunServiceRoleForNativeApiGwInvokeFC角色详情页面的基本信息区域,查看角色基本信息,包括角色名称、创建时间、角色ARN和备注等。
权限策略
在AliyunServiceRoleForNativeApiGw或AliyunServiceRoleForNativeApiGwInvokeFC角色详情页面的权限管理页签,单击权限策略名称,查看权限策略内容以及该角色可授权访问哪些云资源。
信任策略
在AliyunServiceRoleForNativeApiGw或AliyunServiceRoleForNativeApiGwInvokeFC角色详情页的信任策略管理页签,查看信任策略内容。信任策略是描述RAM角色可信实体的策略,可信实体是指可以扮演RAM角色的实体用户身份。服务关联角色的可信实体为云服务,您可以通过信任策略中的
Service
字段查看。
关于如何查看服务关联角色的详细操作,请参见查看RAM角色。
删除服务关联角色
当您长时间不使用云原生API网关时,您可以在RAM控制台手动删除服务关联角色。
删除AliyunServiceRoleForNativeApiGw
使用阿里云账号登录RAM控制台,在左侧导航栏中单击 。
在角色页面的搜索框中输入
AliyunServiceRoleForNativeApiGw
进行搜索。在AliyunServiceRoleForNativeApiGw的操作列下单击删除角色。
在删除角色对话框中输入角色名称进行确认,然后单击删除角色。
删除云原生API网关服务关联角色(AliyunServiceRoleForNativeApiGw)后,依赖该角色的服务来源和压测功能将无法正常使用,请谨慎删除。
删除AliyunServiceRoleForNativeApiGwInvokeFC
使用阿里云账号登录RAM控制台,在左侧导航栏中单击 。
在角色页面的搜索框中输入
AliyunServiceRoleForNativeApiGwInvokeFC
进行搜索。在AliyunServiceRoleForNativeApiGwInvokeFC的操作列下单击删除角色。
在删除角色对话框中输入角色名称进行确认,然后单击删除角色。
删除云原生API网关服务关联角色(AliyunServiceRoleForNativeApiGwInvokeFC)后,依赖该角色的FC函数调用功能将无法正常使用,请谨慎删除。
常见问题
为什么我的RAM用户无法自动创建云原生API网关服务关联角色(AliyunServiceRoleForNativeApiGw)?
您需要拥有指定的权限,才能自动创建或删除AliyunServiceRoleForNativeApiGw。因此,在RAM用户无法自动创建AliyunServiceRoleForNativeApiGw时,您需要为其添加以下权限策略。
{
"Statement": [
{
"Action": [
"ram:CreateServiceLinkedRole"
],
"Resource": "acs:ram:*:主账号ID:role/*",
"Effect": "Allow",
"Condition": {
"StringEquals": {
"ram:ServiceName": [
"nativeapigw.aliyuncs.com"
]
}
}
}
],
"Version": "1"
}
请将主账号ID替换为您实际的阿里云账号ID。
为什么我的RAM用户无法自动创建云原生API网关服务关联角色(AliyunServiceRoleForNativeApiGwInvokeFC)?
您需要拥有指定的权限,才能自动创建或删除AliyunServiceRoleForNativeApiGwInvokeFC。因此,在RAM用户无法自动创建AliyunServiceRoleForNativeApiGwInvokeFC时,您需要为其添加以下权限策略。
{
"Statement": [
{
"Action": [
"ram:CreateServiceLinkedRole"
],
"Resource": "acs:ram:*:主账号ID:role/*",
"Effect": "Allow",
"Condition": {
"StringEquals": {
"ram:ServiceName": [
"invokefc.nativeapigw.aliyuncs.com"
]
}
}
}
],
"Version": "1"
}
请将主账号ID替换为您实际的阿里云账号ID。
相关文档
更多关于服务关联角色的信息,请参见服务关联角色。