You need to enable JavaScript to run this app.
导航

策略示例

最近更新时间2024.05.07 19:12:43

首次发布时间2022.11.03 08:35:40

系统预设策略

IAM平台已提前为您设置了关于VPC的默认策略,您可为直接为IAM身份(IAM用户、用户组或角色)授权系统预设策略。系统预设策略只能用于授权,不可编辑和修改

私有网络系统预设策略

系统预设策略名称描述
VPCFullAccess被授权该策略后的IAM身份(IAM用户、用户组、角色),可获得权限范围内私有网络功能的 管理 权限。
VPCReadOnlyAccess被授权该策略后的IAM身份(IAM用户、用户组、角色),可获得权限范围内私有网络功能的 只读 权限。

说明

通配符*:匹配0个、1个或多个字符。

VPCFullAccess

{
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "vpc:*Vpc*",
                "vpc:*Subnet*",
                "vpc:*NetworkInterface*",
                "vpc:*Route*",
                "vpc:*SecurityGroup*",
                "vpc:*HaVip*",
                "vpc:*NetworkAcl*",
                "vpc:*PrivateIpAddresses",
                "vpc:*Ipv6Addresses",
                "vpc:*FlowLog*",
                "vpc:*PrefixList*",
                "vpc:*TrafficMirror*",
                "vpc:TagResources",
                "vpc:UntagResources",
                "vpc:ListTagsForResources",
                "cen:GrantInstanceToCen",
                "cen:RevokeInstanceFromCen",
                "cen:DescribeInstanceGrantedRules",
                "quota:GetServiceQuota",
                "ecs:DescribeZones"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

VPCReadOnlyAccess

{
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "vpc:*DescribeVpc*",
                "vpc:*DescribeSubnet*",
                "vpc:*DescribeNetworkInterface*",
                "vpc:*DescribeRoute*",
                "vpc:*DescribeSecurityGroup*",
                "vpc:*DescribeHaVip*",
                "cen:DescribeInstanceGrantedRules",
                "vpc:*DescribeNetworkAcl*",
                "vpc:*DescribeFlowLog*",
                "vpc:*DescribePrefixList*",
                "vpc:*DescribeTrafficMirror*",
                "vpc:ListTagsForResources"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

自定义策略

Deny的优先级高于Allow,当身份对某些操作存在Deny权限时,再次赋予这些操作的Allow权限将无法生效。

示例一:拒绝删除VPC和子网

为IAM用户授权 VPCFullAccess 后,可为其再授予如下权限,拒绝删除VPC和子网。

{
  "Statement": [
    {
      "Effect": "Deny",
      "Action": [
        "vpc:DeleteVpc",
        "vpc:DeleteSubnet"
      ],
      "Resource": [
        "*"
      ]
    }
	]
}

示例二:授予指定子网管理权限

为IAM用户授权 VPCReadOnlyAccess 后,可为其再授予指定子网(如subnet-2yyxafgve001)的权限,使其可以管理该子网。

{
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "vpc:*Subnet*"
      ],
      "Resource": [
        "trn:vpc:*:*:subnet/subnet-2yyxafgve001"
      ]
    }
	]
}

示例三:授权修改指定路由表中的路由条目

仅允许IAM用户修改指定路由表vtb-2fdzao4h726f45中的路由条目。将vtb-2fdzao4h726f45中加入到项目中,并为该IAM用户在该项目授予如下权限。

{
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "vpc:DescribeRouteTable*",
        "vpc:*RouteEntry*"
      ],
      "Resource": [
        "*"
      ]
    },
    {
      "Effect": "Allow",
      "Action": [
		    "vpc:Describe*",
        "ecs:Describe*",
        "vpn:Describe*",
        "natgateway:Describe*", 
        "transitrouter:Describe*" 
      ],
      "Resource": [
        "*"
      ]
    }
  ]
}

示例四:授权使用VPC标签功能

{
    "Statement":[
        {
            "Effect":"Allow",
            "Action":[
                "vpc:TagResources",
                "vpc:UntagResources",
                "vpc:ListTagsForResources"
            ],
            "Resource":[
                "*"
            ]
        }
    ]
}

相关文档

更多IAM策略示例,请参见 自定义策略示例