全部产品
Search
文档中心

资源编排:ALIYUN::VPC::NatGateway

更新时间:Jan 14, 2026

ALIYUN::VPC::NatGateway类型用于创建NAT网关。

语法

{
  "Type": "ALIYUN::VPC::NatGateway",
  "Properties": {
    "Description": String,
    "NatGatewayName": String,
    "InstanceChargeType": String,
    "VSwitchId": String,
    "DeletionProtection": Boolean,
    "InternetChargeType": String,
    "NatType": String,
    "DeletionForce": Boolean,
    "VpcId": String,
    "Tags": List,
    "NetworkType": String,
    "EipBindMode": String,
    "IcmpReplyEnabled": Boolean,
    "SecurityProtectionEnabled": Boolean
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

Description

String

NAT网关的描述。

长度为2~256个字符,不能以http://https://开头。

NatGatewayName

String

NAT网关的名称。

长度为2~128个字符,必须以英文字母或汉字开头,不能以http://https://开头。可包含英文字母、汉字、数字、半角句号(.)、下划线(_)和短划线(-)。

如果没有指定该参数,默认使用网关ID作为名称。

InstanceChargeType

String

NAT网关的付费模式。

取值:

  • PostPaid(默认值):按量付费。

  • PrePaid:包年包月。

VSwitchId

String

NAT网关所属的交换机ID。

创建增强型NAT网关时,您必须指定NAT网关所属的交换机,系统会为增强型NAT网关分配一个交换机内的空闲私网IP地址。

  • 如果您要在存量交换机中创建增强型NAT网关,请确保交换机所属的可用区支持创建增强型NAT网关,且交换机有可用的IP。

  • 如果您还未创建交换机,请先在支持创建增强型NAT网关的可用区创建交换机,然后再指定增强型NAT网关所属的交换机。

您可以通过ListEnhanhcedNatGatewayAvailableZones接口查询增强型NAT网关的资源可用区,通过DescribeVSwitches接口查询交换机中的可用IP数。

DeletionProtection

Boolean

是否开启删除保护功能。

取值:

  • true:开启删除保护功能。

  • false:关闭删除保护功能。

InternetChargeType

String

NAT网关的计费类型。

取值:PayByLcu,表示按使用量计费。

NatType

String

NAT网关的类型。

取值:Enhanced,表示增强型NAT网关。

DeletionForce

Boolean

是否强制删除NAT网关。

取值:

  • true:强制删除。

  • false:不强制删除。

VpcId

String

需要创建NAT网关的专有网络ID。

如果您要创建的NAT网关类型为普通型NAT网关,请确保专有网络路由表中没有目标网段为0.0.0.0/0的路由条目。否则,请先删除该路由条目。

说明

如果您创建的NAT网关类型是增强型NAT网关,则无此限制。

NetworkType

String

NAT网关的网络类型。

取值:

  • internet(默认值):公网NAT网关。

  • intranet:私网NAT网关。

Tags

List

标签。

最多可绑定20个标签。

更多信息,请参见Tags语法Tags属性

EipBindMode

String

NAT网关的EIP绑定模式。

取值:

  • MULTI_BINDED(默认值):多EIP网卡可见模式。

  • NAT:EIP普通模式,兼容IPv4网关。

    当NAT网关的EIP绑定模式为EIP普通模式时,NAT网关支持绑定的EIP数量上限为50个,且EIP将占用NAT网关所在交换机的一个私网IP。

    说明

    当NAT网关所在的交换机没有可用的空闲私网地址时,NAT网关将无法绑定新的EIP。

IcmpReplyEnabled

Boolean

是否开启ICMP不代回功能。

取值:

  • true:开启ICMP不代回功能。

  • false(默认值):不开启ICMP不代回功能。

SecurityProtectionEnabled

Boolean

是否开启防火墙功能。

取值:

  • true:开启防火墙功能。

  • false(默认值):不开启防火墙功能。

Tags语法

"Tags": [
  {
    "Key": String,
    "Value": String
  }
]

Tags属性

属性名称

类型

必须

允许更新

描述

约束

Key

String

标签键。

长度为1~64个字符,必须以英文字母或汉字开头,不能以aliyunacs:开头,不能包含http://https://。可包含英文字母、汉字、数字、半角句号(.)、下划线(_)和短划线(-)。

Value

String

标签值。

长度为0~128个字符,必须以英文字母或汉字开头,不能以aliyunacs:开头,不能包含http://https://。可包含英文字母、汉字、数字、半角句号(.)、下划线(_)和短划线(-)。

返回值

Fn::GetAtt

  • NatGatewayId:NAT网关ID。

  • SNatTableId:SNAT条目ID。

  • ForwardTableId:DNAT条目ID。

示例

场景 1 :创建NAT网关

ROSTemplateFormatVersion: '2015-09-01'
Description: Test ECS NatGateway
Parameters:
  VPC:
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
    Type: String
    Label:
      zh-cn: 现有VPC的实例ID
      en: Existing VPC Instance ID
  VSwitch:
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    Type: String
    Label:
      zh-cn: 网络交换机ID
      en: VSwitch ID
    AssociationPropertyMetadata:
      VpcId: VPC
Resources:
  NatGateway:
    Type: ALIYUN::VPC::NatGateway
    Properties:
      NatGatewayName: mytest
      VpcId:
        Ref: VPC
      VSwitchId:
        Ref: VSwitch
Outputs:
  NatGatewayId:
    Value:
      Fn::GetAtt:
        - NatGateway
        - NatGatewayId
  BandwidthPackageId:
    Value:
      Fn::GetAtt:
        - BandwidthPackage
        - BandwidthPackageId
  BandwidthPackageIps:
    Value:
      Fn::GetAtt:
        - CommonBandwidthPackageIp
        - IpAddresses
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Test ECS NatGateway",
  "Parameters": {
    "VPC": {
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
      "Type": "String",
      "Label": {
        "zh-cn": "现有VPC的实例ID",
        "en": "Existing VPC Instance ID"
      }
    },
    "VSwitch": {
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "Type": "String",
      "Label": {
        "zh-cn": "网络交换机ID",
        "en": "VSwitch ID"
      },
      "AssociationPropertyMetadata": {
        "VpcId": "VPC"
      }
    }
  },
  "Resources": {
    "NatGateway": {
      "Type": "ALIYUN::VPC::NatGateway",
      "Properties": {
        "NatGatewayName": "mytest",
        "VpcId": {
          "Ref": "VPC"
        },
        "VSwitchId": {
          "Ref": "VSwitch"
        }
      }
    }
  },
  "Outputs": {
    "NatGatewayId": {
      "Value": {
        "Fn::GetAtt": [
          "NatGateway",
          "NatGatewayId"
        ]
      }
    },
    "BandwidthPackageId": {
      "Value": {
        "Fn::GetAtt": [
          "BandwidthPackage",
          "BandwidthPackageId"
        ]
      }
    },
    "BandwidthPackageIps": {
      "Value": {
        "Fn::GetAtt": [
          "CommonBandwidthPackageIp",
          "IpAddresses"
        ]
      }
    }
  }
}

场景 2 :创建一个按带宽计费的EIP实例并绑定到 NAT 网关。

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  ZoneId:
    Type: String
    AssociationProperty: ZoneId
  VpcId:
    Type: String
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
  VSwitchId:
    Type: String
    AssociationProperty: ALIYUN::VPC::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
      ZoneId: ${ZoneId}
Resources:
  NatGateway:
    Type: ALIYUN::VPC::NatGateway
    Properties:
      NatGatewayName: example-ngw
      VSwitchId:
        Ref: VSwitchId
      NatType: Enhanced
      VpcId:
        Ref: VpcId
      ZoneId:
        Ref: ZoneId
  Eip:
    Type: ALIYUN::VPC::EIP
    Properties:
      DeletionProtection: false
      Isp: BGP
      Bandwidth: 200
      InternetChargeType: PayByTraffic
  EipAssociation:
    Type: ALIYUN::VPC::EIPAssociation
    Properties:
      InstanceId:
        Ref: NatGateway
      AllocationId:
        Ref: Eip
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "ZoneId": {
      "Type": "String",
      "AssociationProperty": "ZoneId"
    },
    "VpcId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
    },
    "VSwitchId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::VPC::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}",
        "ZoneId": "${ZoneId}"
      }
    }
  },
  "Resources": {
    "NatGateway": {
      "Type": "ALIYUN::VPC::NatGateway",
      "Properties": {
        "NatGatewayName": "example-ngw",
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "NatType": "Enhanced",
        "VpcId": {
          "Ref": "VpcId"
        },
        "ZoneId": {
          "Ref": "ZoneId"
        }
      }
    },
    "Eip": {
      "Type": "ALIYUN::VPC::EIP",
      "Properties": {
        "DeletionProtection": false,
        "Isp": "BGP",
        "Bandwidth": 200,
        "InternetChargeType": "PayByTraffic"
      }
    },
    "EipAssociation": {
      "Type": "ALIYUN::VPC::EIPAssociation",
      "Properties": {
        "InstanceId": {
          "Ref": "NatGateway"
        },
        "AllocationId": {
          "Ref": "Eip"
        }
      }
    }
  }
}

场景 3 :部署公网NAT网关实现统一的云上公网访问出口

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 创建VPC环境,配置双可用区ECS实例,部署公网NAT网关实现统一的云上公网访问出口。
  en: Create a Virtual Private Cloud (VPC) environment, configure dual-Availability
    Zone Elastic Compute Service (ECS) instances, and deploy a public-facing NAT Gateway
    to establish a unified cloud Internet access gateway.
Parameters:
  CommonName:
    Type: String
    Default: unified-egress
  ZoneId1:
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Instance::ZoneId'
    AssociationPropertyMetadata:
      ExclusiveTo:
        - ZoneId2
    Label:
      en: Availability Zone
      zh-cn: 可用区1
  ZoneId2:
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Instance::ZoneId'
    AssociationPropertyMetadata:
      ExclusiveTo:
        - ZoneId1
    Label:
      en: Availability Zone
      zh-cn: 可用区2
  InstanceType1:
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Instance::InstanceType'
    AssociationPropertyMetadata:
      InstanceChargeType: PostPaid
      SystemDiskCategory: cloud_essd
      ZoneId: ${ZoneId}
    Label:
      en: ECS Instance Type
      zh-cn: ECS 实例规格1
  InstanceType2:
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Instance::InstanceType'
    AssociationPropertyMetadata:
      InstanceChargeType: PostPaid
      SystemDiskCategory: cloud_essd
      ZoneId: ${ZoneId}
    Label:
      en: ECS Instance Type
      zh-cn: ECS 实例规格2
  InstancePassword:
    NoEcho: true
    Type: String
    Description:
      en: >-
        Server login password, Length 8-30, must contain three(Capital letters,
        lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special
        symbol in)
      zh-cn: >-
        服务器登录密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
        中的特殊符号)
    Label:
      en: Instance Password
      zh-cn: 实例密码
    ConstraintDescription:
      en: >-
        Length 8-30, must contain three(Capital letters, lowercase letters,
        numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)
      zh-cn: '长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/ 中的特殊符号)'
    AssociationProperty: 'ALIYUN::ECS::Instance::Password'
    Default: null
Resources:
  Vpc:
    Type: 'ALIYUN::ECS::VPC'
    Properties:
      CidrBlock: 192.168.0.0/16
      VpcName:
        Fn::Sub: ${CommonName}-vpc
  VSwitch1:
    Type: 'ALIYUN::ECS::VSwitch'
    Properties:
      VpcId:
        Ref: Vpc
      CidrBlock: 192.168.1.0/24
      ZoneId:
        Ref: ZoneId1
      VSwitchName:
        Fn::Sub: ${CommonName}-app1-vsw
  VSwitch2:
    Type: 'ALIYUN::ECS::VSwitch'
    Properties:
      VpcId:
        Ref: Vpc
      CidrBlock: 192.168.2.0/24
      ZoneId:
        Ref: ZoneId2
      VSwitchName:
        Fn::Sub: ${CommonName}-app2-vsw
  VSwitch3:
    Type: 'ALIYUN::ECS::VSwitch'
    Properties:
      VpcId:
        Ref: Vpc
      CidrBlock: 192.168.3.0/24
      ZoneId:
        Ref: ZoneId1
      VSwitchName:
        Fn::Sub: ${CommonName}-pub-vsw
  SecurityGroup:
    Type: 'ALIYUN::ECS::SecurityGroup'
    Properties:
      VpcId:
        Ref: Vpc
      SecurityGroupName:
        Fn::Sub: ${CommonName}-sg
      SecurityGroupIngress:
        - PortRange: 443/443
          SourceCidrIp: 0.0.0.0/0
          IpProtocol: tcp
        - PortRange: 80/80
          SourceCidrIp: 0.0.0.0/0
          IpProtocol: tcp
  EcsInstance1:
    Type: 'ALIYUN::ECS::InstanceGroup'
    Properties:
      VpcId:
        Ref: Vpc
      ZoneId:
        Ref: ZoneId1
      VSwitchId:
        Ref: VSwitch1
      SecurityGroupId:
        Ref: SecurityGroup
      ImageId: aliyun_3_9_x64_20G_alibase_20231219.vhd
      InstanceName:
        Fn::Sub: ${CommonName}-ecs-1
      InstanceType:
        Ref: InstanceType1
      SystemDiskCategory: cloud_essd
      MaxAmount: 1
      InternetMaxBandwidthOut: 0
      Password:
        Ref: InstancePassword
  EcsInstance2:
    Type: 'ALIYUN::ECS::InstanceGroup'
    Properties:
      VpcId:
        Ref: Vpc
      ZoneId:
        Ref: ZoneId2
      VSwitchId:
        Ref: VSwitch2
      SecurityGroupId:
        Ref: SecurityGroup
      ImageId: aliyun_3_9_x64_20G_alibase_20231219.vhd
      InstanceName:
        Fn::Sub: ${CommonName}-ecs-2
      InstanceType:
        Ref: InstanceType2
      SystemDiskCategory: cloud_essd
      MaxAmount: 1
      InternetMaxBandwidthOut: 0
      Password:
        Ref: InstancePassword
  NatGateway:
    Type: 'ALIYUN::VPC::NatGateway'
    Properties:
      NatGatewayName:
        Fn::Sub: ${CommonName}-ngw
      VSwitchId:
        Ref: VSwitch3
      NatType: Enhanced
      VpcId:
        Ref: Vpc
      ZoneId:
        Ref: ZoneId1
  Eip:
    Type: 'ALIYUN::VPC::EIP'
    Properties:
      DeletionProtection: false
      Isp: BGP
      Bandwidth: 200
      InternetChargeType: PayByTraffic
  EipAssociation:
    Type: 'ALIYUN::VPC::EIPAssociation'
    Properties:
      InstanceId:
        Ref: NatGateway
      AllocationId:
        Ref: Eip
  SNat:
    Type: 'ALIYUN::VPC::SnatEntry'
    DependsOn: EipAssociation
    Properties:
      SnatTableId:
        Fn::GetAtt:
          - NatGateway
          - SNatTableId
      SnatEntryName:
        Fn::Sub: ${CommonName}-snat
      SourceVSwitchIds:
        - Ref: VSwitch1
        - Ref: VSwitch2
      SnatIp:
        Fn::GetAtt:
          - Eip
          - EipAddress
Outputs:
  EcsLoginAddress1:
    Description:
      en: Ecs1 login address.
      zh-cn: ECS1 登录地址。
    Value:
      Fn::Sub: >-
        https://ecs-workbench.aliyun.com/?from=EcsConsole
        &instanceType=ecs&regionId=${ALIYUN::Region}&instanceId=${EcsInstance1}
  EcsLoginAddress2:
    Description:
      en: Ecs2 login address.
      zh-cn: ECS2 登录地址。
    Value:
      Fn::Sub: >-
        https://ecs-workbench.aliyun.com/?from=EcsConsole
        &instanceType=ecs&regionId=${ALIYUN::Region}&instanceId=${EcsInstance2}
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - ZoneId1
          - ZoneId2
        Label:
          default:
            en: ZoneID
            zh-cn: 交换机可用区配置
      - Parameters:
          - InstanceType1
          - InstanceType2
          - InstancePassword
        Label:
          default:
            en: ECS Instance Configuration
            zh-cn: ECS实例配置
    TemplateTags:
      - acs:technical-solution:network:通过公网NAT网关实现云上统一公网出口-tech_solu_134
    Hidden:
      - CommonName
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "创建VPC环境,配置双可用区ECS实例,部署公网NAT网关实现统一的云上公网访问出口。",
    "en": "Create a Virtual Private Cloud (VPC) environment, configure dual-Availability Zone Elastic Compute Service (ECS) instances, and deploy a public-facing NAT Gateway to establish a unified cloud Internet access gateway."
  },
  "Parameters": {
    "CommonName": {
      "Type": "String",
      "Default": "unified-egress"
    },
    "ZoneId1": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
      "AssociationPropertyMetadata": {
        "ExclusiveTo": [
          "ZoneId2"
        ]
      },
      "Label": {
        "en": "Availability Zone",
        "zh-cn": "可用区1"
      }
    },
    "ZoneId2": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
      "AssociationPropertyMetadata": {
        "ExclusiveTo": [
          "ZoneId1"
        ]
      },
      "Label": {
        "en": "Availability Zone",
        "zh-cn": "可用区2"
      }
    },
    "InstanceType1": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
      "AssociationPropertyMetadata": {
        "InstanceChargeType": "PostPaid",
        "SystemDiskCategory": "cloud_essd",
        "ZoneId": "${ZoneId}"
      },
      "Label": {
        "en": "ECS Instance Type",
        "zh-cn": "ECS 实例规格1"
      }
    },
    "InstanceType2": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
      "AssociationPropertyMetadata": {
        "InstanceChargeType": "PostPaid",
        "SystemDiskCategory": "cloud_essd",
        "ZoneId": "${ZoneId}"
      },
      "Label": {
        "en": "ECS Instance Type",
        "zh-cn": "ECS 实例规格2"
      }
    },
    "InstancePassword": {
      "NoEcho": true,
      "Type": "String",
      "Description": {
        "en": "Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)",
        "zh-cn": "服务器登录密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)"
      },
      "Label": {
        "en": "Instance Password",
        "zh-cn": "实例密码"
      },
      "ConstraintDescription": {
        "en": "Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)",
        "zh-cn": "长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)"
      },
      "AssociationProperty": "ALIYUN::ECS::Instance::Password",
      "Default": null
    }
  },
  "Resources": {
    "Vpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": "192.168.0.0/16",
        "VpcName": {
          "Fn::Sub": "${CommonName}-vpc"
        }
      }
    },
    "VSwitch1": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "CidrBlock": "192.168.1.0/24",
        "ZoneId": {
          "Ref": "ZoneId1"
        },
        "VSwitchName": {
          "Fn::Sub": "${CommonName}-app1-vsw"
        }
      }
    },
    "VSwitch2": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "CidrBlock": "192.168.2.0/24",
        "ZoneId": {
          "Ref": "ZoneId2"
        },
        "VSwitchName": {
          "Fn::Sub": "${CommonName}-app2-vsw"
        }
      }
    },
    "VSwitch3": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "CidrBlock": "192.168.3.0/24",
        "ZoneId": {
          "Ref": "ZoneId1"
        },
        "VSwitchName": {
          "Fn::Sub": "${CommonName}-pub-vsw"
        }
      }
    },
    "SecurityGroup": {
      "Type": "ALIYUN::ECS::SecurityGroup",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "SecurityGroupName": {
          "Fn::Sub": "${CommonName}-sg"
        },
        "SecurityGroupIngress": [
          {
            "PortRange": "443/443",
            "SourceCidrIp": "0.0.0.0/0",
            "IpProtocol": "tcp"
          },
          {
            "PortRange": "80/80",
            "SourceCidrIp": "0.0.0.0/0",
            "IpProtocol": "tcp"
          }
        ]
      }
    },
    "EcsInstance1": {
      "Type": "ALIYUN::ECS::InstanceGroup",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "ZoneId": {
          "Ref": "ZoneId1"
        },
        "VSwitchId": {
          "Ref": "VSwitch1"
        },
        "SecurityGroupId": {
          "Ref": "SecurityGroup"
        },
        "ImageId": "aliyun_3_9_x64_20G_alibase_20231219.vhd",
        "InstanceName": {
          "Fn::Sub": "${CommonName}-ecs-1"
        },
        "InstanceType": {
          "Ref": "InstanceType1"
        },
        "SystemDiskCategory": "cloud_essd",
        "MaxAmount": 1,
        "InternetMaxBandwidthOut": 0,
        "Password": {
          "Ref": "InstancePassword"
        }
      }
    },
    "EcsInstance2": {
      "Type": "ALIYUN::ECS::InstanceGroup",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "ZoneId": {
          "Ref": "ZoneId2"
        },
        "VSwitchId": {
          "Ref": "VSwitch2"
        },
        "SecurityGroupId": {
          "Ref": "SecurityGroup"
        },
        "ImageId": "aliyun_3_9_x64_20G_alibase_20231219.vhd",
        "InstanceName": {
          "Fn::Sub": "${CommonName}-ecs-2"
        },
        "InstanceType": {
          "Ref": "InstanceType2"
        },
        "SystemDiskCategory": "cloud_essd",
        "MaxAmount": 1,
        "InternetMaxBandwidthOut": 0,
        "Password": {
          "Ref": "InstancePassword"
        }
      }
    },
    "NatGateway": {
      "Type": "ALIYUN::VPC::NatGateway",
      "Properties": {
        "NatGatewayName": {
          "Fn::Sub": "${CommonName}-ngw"
        },
        "VSwitchId": {
          "Ref": "VSwitch3"
        },
        "NatType": "Enhanced",
        "VpcId": {
          "Ref": "Vpc"
        },
        "ZoneId": {
          "Ref": "ZoneId1"
        }
      }
    },
    "Eip": {
      "Type": "ALIYUN::VPC::EIP",
      "Properties": {
        "DeletionProtection": false,
        "Isp": "BGP",
        "Bandwidth": 200,
        "InternetChargeType": "PayByTraffic"
      }
    },
    "EipAssociation": {
      "Type": "ALIYUN::VPC::EIPAssociation",
      "Properties": {
        "InstanceId": {
          "Ref": "NatGateway"
        },
        "AllocationId": {
          "Ref": "Eip"
        }
      }
    },
    "SNat": {
      "Type": "ALIYUN::VPC::SnatEntry",
      "DependsOn": "EipAssociation",
      "Properties": {
        "SnatTableId": {
          "Fn::GetAtt": [
            "NatGateway",
            "SNatTableId"
          ]
        },
        "SnatEntryName": {
          "Fn::Sub": "${CommonName}-snat"
        },
        "SourceVSwitchIds": [
          {
            "Ref": "VSwitch1"
          },
          {
            "Ref": "VSwitch2"
          }
        ],
        "SnatIp": {
          "Fn::GetAtt": [
            "Eip",
            "EipAddress"
          ]
        }
      }
    }
  },
  "Outputs": {
    "EcsLoginAddress1": {
      "Description": {
        "en": "Ecs1 login address.",
        "zh-cn": "ECS1 登录地址。"
      },
      "Value": {
        "Fn::Sub": "https://ecs-workbench.aliyun.com/?from=EcsConsole &instanceType=ecs&regionId=${ALIYUN::Region}&instanceId=${EcsInstance1}"
      }
    },
    "EcsLoginAddress2": {
      "Description": {
        "en": "Ecs2 login address.",
        "zh-cn": "ECS2 登录地址。"
      },
      "Value": {
        "Fn::Sub": "https://ecs-workbench.aliyun.com/?from=EcsConsole &instanceType=ecs&regionId=${ALIYUN::Region}&instanceId=${EcsInstance2}"
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "ZoneId1",
            "ZoneId2"
          ],
          "Label": {
            "default": {
              "en": "ZoneID",
              "zh-cn": "交换机可用区配置"
            }
          }
        },
        {
          "Parameters": [
            "InstanceType1",
            "InstanceType2",
            "InstancePassword"
          ],
          "Label": {
            "default": {
              "en": "ECS Instance Configuration",
              "zh-cn": "ECS实例配置"
            }
          }
        }
      ],
      "TemplateTags": [
        "acs:technical-solution:network:通过公网NAT网关实现云上统一公网出口-tech_solu_134"
      ],
      "Hidden": [
        "CommonName"
      ]
    }
  }
}