如果火山引擎提供的系统预设策略不满足您的需求,您可通过创建自定义策略,遵循最小授权原则,进行更精细化的权限管控,以提升IAM身份对主账号下资源的安全访问。本文为您介绍日常场景中常见的VPN连接相关的自定义策略示例,供您参考。
自定义策略语法中策略元素配置的详细介绍,请参见IAM策略语法。
说明
Deny的优先级高于Allow,当身份对某些操作存在Deny权限时,再次赋予这些操作的Allow权限将无法生效。
{ "Statement": [ { "Effect": "Deny", "Action": [ "vpn:DeleteVpnGateway" ], "Resource": [ "*" ] } ] }
{ "Statement": [ { "Effect": "Deny", "Action": [ "vpn:Delete*" ], "Resource": [ "trn:vpn:*:200000000X:vpngateway/vgw-2yyxafgve001", "trn:vpn:*:200000000X:vpngateway/vgw-2yyxafgve002" ] } ] }
{ "Statement": [ { "Effect": "Allow", "Action": [ "vpc:*Vpc*", "vpc:*Subnet*", "vpc:*NetworkInterface*", "vpc:*Route*", "vpc:*SecurityGroup*", "vpc:*HaVip*", "vpc:*NetworkAcl*", "vpc:*PrivateIpAddresses", "vpc:*Ipv6Addresses" ], "Resource": [ "*" ] } ] }
{ "Statement": [ { "Effect": "Allow", "Action": [ "vpc:*DescribeVpc*", "vpc:*DescribeSubnet*", "vpc:*DescribeNetworkInterface*", "vpc:*DescribeRoute*" ], "Resource": [ "*" ] } ] }
{ "Statement":[ { "Effect":"Allow", "Action":[ "vpc:TagResources", "vpc:UntagResources", "vpc:ListTagsForResources" ], "Resource":[ "*" ] } ] }
{ "Statement": [ { "Effect": "Allow", "Action": [ "tls:Describe*", "tls:Get*", "tls:PreviewDelimiterLog", "tls:SearchLogs", "tls:Statistics", "tls:CreateDownloadTask" ], "Resource": [ "*" ] } ] }
{ "Statement": [ { "Effect": "Allow", "Action": [ "vpn:*" ], "Resource": [ "*" ], "Condition": { "StringEquals": { "volc:ResourceTag/vpn": "use" } } } ] }
{ "Statement": [ { "Effect": "Allow", "Action": [ "transitrouter:DescribeTransitRouters", "transitrouter:CreateTransitRouterVpnAttachment" ], "Resource": [ "*" ] } ] }
通用自定义策略示例:文档中提供了多种常见的自定义策略语法示例供您参考。
VPN连接资源TRN格式如下表所示:
产品 | 产品Service代码 | 资源类型 | 资源类型代码 | trn格式 |
---|---|---|---|---|
VPN连接 | vpn | VPN网关 | vpngateway | trn:vpn:{region}:{account}:vpngateway/{vpngatewayid} |
用户网关 | customergateway | trn:vpn:{region}:{account}:customergateway/{customergatewayid} | ||
IPSec连接 | vpnconnection | trn:vpn:{region}:{account}:vpnconnection/{vpnconnectionid} | ||
VPN网关路由 | vpngatewayroute | trn:vpn:{region}:{account}:vpngatewayroute/{vpngatewayrouteid} |