全部产品
Search
文档中心

Resource Orchestration Service:ALIYUN::ECS::VPC

更新时间:Feb 07, 2026

Gunakan ALIYUN::ECS::VPC untuk membuat virtual private cloud (VPC).

Sintaks

{
  "Type": "ALIYUN::ECS::VPC",
  "Properties": {
    "Description": String,
    "Tags": List,
    "Ipv6CidrBlock": String,
    "EnableIpv6": Boolean,
    "ResourceGroupId": String,
    "VpcName": String,
    "CidrBlock": String,
    "Ipv6Isp": String,
    "UserCidr": String,
    "SecondaryCidrBlocks": List
  }
}

Properti

Nama Properti

Tipe

Wajib

Pembaruan diizinkan

Deskripsi

Batasan

ResourceGroupId

String

Tidak

Ya

ID kelompok sumber daya.

Tidak ada

VpcName

String

Tidak

Ya

Nama VPC.

Nilainya harus terdiri dari 2 hingga 128 karakter. Harus dimulai dengan huruf atau karakter Tionghoa, tetapi tidak boleh dimulai dengan http:// atau https://. Dapat berisi huruf, karakter Tionghoa, angka, garis bawah (_), dan tanda hubung (-).

CidrBlock

String

Tidak

Ya

Blok CIDR IPv4 VPC.

Nilai yang valid:

  • 10.0.0.0/8

  • 172.16.0.0/12

  • 192.168.0.0/16 dan subnet-nya

Description

String

Tidak

Ya

Deskripsi VPC.

Deskripsi harus terdiri dari 2 hingga 256 karakter. Tidak boleh dimulai dengan http:// atau https://.

Ipv6CidrBlock

String

Tidak

Tidak

Blok CIDR IPv6 VPC.

Tidak ada

EnableIpv6

Boolean

Tidak

Ya

Menentukan apakah IPv6 diaktifkan untuk VPC.

Nilai yang valid:

  • true: Fitur diaktifkan.

  • false (default): dimatikan.

Tags

List

Tidak

Ya

Tag

Anda dapat menambahkan hingga 20 tag.

Untuk informasi selengkapnya, lihat properti Tags.

Ipv6Isp

String

Tidak

Tidak

Jenis segmen alamat IPv6 untuk Virtual Private Cloud (VPC).

Nilai yang valid:

  • BGP (default): IPv6 Alibaba Cloud Border Gateway Protocol (BGP)

UserCidr

String

Tidak

Tidak

Blok CIDR pengguna.

Untuk menentukan beberapa blok CIDR, pisahkan dengan koma (,). Anda dapat menentukan maksimal tiga blok CIDR.

Catatan

Untuk informasi selengkapnya tentang blok CIDR pengguna, lihat FAQ Blok CIDR.

SecondaryCidrBlocks

List

Tidak

Tidak

SecondaryCidrBlocks

Tidak ada

Sintaks Tags

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

Properti Tags

Nama Properti

Tipe

Wajib

Pembaruan diizinkan

Deskripsi

Batasan

Key

String

Ya

Tidak

Kunci tag.

Kunci harus terdiri dari 1 hingga 128 karakter. Tidak boleh dimulai dengan aliyun atau acs:. Tidak boleh berisi http:// atau https://.

Value

String

Tidak

Tidak

Nilai tag.

Nilai harus terdiri dari 0 hingga 128 karakter. Tidak boleh dimulai dengan aliyun atau acs:. Tidak boleh berisi http:// atau https://.

Nilai kembalian

Fn::GetAtt

  • VpcId: ID VPC.

  • VRouterId: ID vRouter.

  • RouteTableId: ID tabel rute.

  • VpcName: Nama VPC.

Contoh

Skenario 1: Membuat VPC

Buat cepat

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  VpcCidrBlock:
    Type: String
    Label: Blok CIDR IPv4 VPC
    Description: 'Rentang alamat IP VPC dalam format blok CIDR.<br>Anda dapat menggunakan rentang alamat IP berikut dan subnet-nya:<br><font color=''green''>[10.0.0.0/8]</font><br><font color=''green''>[172.16.0.0/12]</font><br><font color=''green''>[192.168.0.0/16]</font>'
    Default: 192.168.0.0/16
    AssociationProperty: ALIYUN::VPC::VPC::CidrBlock
  VpcName:
    Type: String
    Label: Nama VPC
    Description: Nama VPC. Harus terdiri dari 2 hingga 128 karakter, dimulai dengan huruf kapital atau huruf kecil atau karakter Tionghoa, dan dapat berisi angka, garis bawah (_), dan tanda hubung (-).
    ConstraintDescription: 'Nama harus terdiri dari 2 hingga 128 karakter.'
    Default: MyVpc
    MinLength: 2
    MaxLength: 128
Resources:
  Vpc:
    Type: ALIYUN::ECS::VPC
    Properties:
      CidrBlock:
        Ref: VpcCidrBlock
      VpcName:
        Ref: VpcName
Outputs:
  VRouterId:
    Description: ID router VPC yang dibuat.
    Value:
      Fn::GetAtt:
        - Vpc
        - VRouterId
  RouteTableId:
    Description: ID tabel rute VPC yang dibuat.
    Value:
      Fn::GetAtt:
        - Vpc
        - RouteTableId
  VpcId:
    Description: ID VPC yang dibuat.
    Value:
      Fn::GetAtt:
        - Vpc
        - VpcId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "VpcCidrBlock": {
      "Type": "String",
      "Label": {
        "en": "VPC CIDR IPv4 Block"
      },
      "Description": {
        "en": "The ip address range of the VPC in the CidrBlock form; <br>You can use the following ip address ranges and their subnets: <br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>"
      },
      "Default": "192.168.0.0/16",
      "AssociationProperty": "ALIYUN::VPC::VPC::CidrBlock"
    },
    "VpcName": {
      "Type": "String",
      "Label": {
        "en": "VPC Name"
      },
      "Description": {
        "en": "VPC name, 2 to 128 characters in length, beginning with size letters or Chinese characters, including Numbers, '_' or '-'.",
      },
      "ConstraintDescription": {
        "en": "[2, 128] English or Chinese characters"
      },
      "Default": "MyVpc",
      "MinLength": 2,
      "MaxLength": 128
    }
  },
  "Resources": {
    "Vpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": {
          "Ref": "VpcCidrBlock"
        },
        "VpcName": {
          "Ref": "VpcName"
        }
      }
    }
  },
  "Outputs": {
    "VRouterId": {
      "Description": "Router id of created VPC.",
      "Value": {
        "Fn::GetAtt": [
          "Vpc",
          "VRouterId"
        ]
      }
    },
    "RouteTableId": {
      "Description": "The router table id of created VPC.",
      "Value": {
        "Fn::GetAtt": [
          "Vpc",
          "RouteTableId"
        ]
      }
    },
    "VpcId": {
      "Description": "Id of created VPC.",
      "Value": {
        "Fn::GetAtt": [
          "Vpc",
          "VpcId"
        ]
      }
    }
  }
}

Skenario 2: Membuat instans ECS dual-stack (IPv4 dan IPv6) dan mengonfigurasi gateway IPv6 serta bandwidth

Buat cepat

ROSTemplateFormatVersion: '2015-09-01'
Description:
  en: Buat server cloud dual-stack (ECS) dan konfigurasikan secara otomatis IP publik IPv6, termasuk pengaturan VPC, security group, gateway IPv6, dan bandwidth.
Parameters:
  InstanceImageId:
    AssociationPropertyMetadata:
      InstanceType: ${InstanceType}
      SupportedImageOwnerAlias:
        - system
        - self
        - others
    Description:
      en: 'ID image.
Untuk Linux, pilih: <font color=''red''><b>centos_7</font> <br/>Untuk Windows, pilih: <font color=''red''><b>win2008r2, win2012r2, atau win2016</font>' Default: centos_7_04_64_20G_alibase_201701015.vhd Label: en: Image AssociationProperty: ALIYUN::ECS::Image::ImageId Type: String SystemDiskCategory: AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory AssociationPropertyMetadata: LocaleKey: DiskCategory InstanceType: ${InstanceType} Type: String Description: en: '<font color=''blue''><b>Nilai yang valid:</font><br/>[cloud_efficiency: <font color=''green''>disk ultra</font>]<br>[cloud_ssd: <font color=''green''>SSD standar</font>]<br>[cloud_essd: <font color=''green''>SSD Perusahaan</font>]<br>[cloud: <font color=''green''>disk dasar</font>]<br>[ephemeral_ssd: <font color=''green''>SSD lokal</font>]' Label: en: Jenis Disk Sistem SystemDiskSize: Default: 40 Type: Number Description: en: 'Ukuran disk sistem. Satuan: GB. Nilai yang valid: 20 hingga 500.' Label: en: Ruang Disk Sistem VpcCidrBlock: Default: 192.168.0.0/16 Label: en: Blok CIDR IPv4 VPC Type: String Description: en: 'Blok CIDR IPv4 VPC. Kami merekomendasikan Anda menggunakan salah satu blok CIDR berikut:<br><font color=''green''>[10.0.0.0/8]</font><br><font color=''green''>[172.16.0.0/12]</font><br><font color=''green''>[192.168.0.0/16]</font>' AllowedValues: - 192.168.0.0/16 - 172.16.0.0/12 - 10.0.0.0/8 InstanceType: AssociationProperty: ALIYUN::ECS::Instance::InstanceType AssociationPropertyMetadata: ZoneId: VSwitchZoneId Type: String Description: en: 'Tipe instans. Pastikan tipe instans tersedia di zona yang dipilih.<br>Tipe instans umum adalah <font color=''red''><b>ecs.c5.large</font>.<br/>Catatan: Beberapa zona mungkin tidak mendukung semua tipe instans.<br>Untuk informasi selengkapnya, lihat <a href=''https://www.alibabacloud.com/help/en/doc-detail/25378.html'' target=''_blank''><b><font color=''blue''>Keluarga instans</font></a>.' Label: en: Tipe Instans InstancePassword: Description: en: 'Kata sandi logon instans ECS. Kata sandi harus terdiri dari 8 hingga 30 karakter dan mengandung minimal tiga jenis karakter berikut: huruf kapital, huruf kecil, angka, dan karakter khusus ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/.' Type: String Label: en: Kata Sandi Instans NoEcho: true AssociationProperty: ALIYUN::ECS::Instance::Password ConstraintDescription: en: 'Kata sandi harus terdiri dari 8 hingga 30 karakter dan mengandung minimal tiga jenis karakter berikut: huruf kapital, huruf kecil, angka, dan karakter khusus ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/.' VSwitchCidrBlock: Default: 192.168.0.0/24 Type: String Description: en: Blok CIDR IPv4 vSwitch. Blok CIDR harus merupakan subnet dari VPC. Label: en: Blok CIDR IPv4 vSwitch InternetChargeType: Default: PayByBandwidth AssociationPropertyMetadata: LocaleKey: InternetChargeType Label: en: Metode Penagihan Bandwidth Internet IPv6 Type: String AllowedValues: - PayByTraffic - PayByBandwidth IPV6Bandwidth: Default: 10 Type: Number Description: en: 'Bandwidth publik gateway IPv6. Satuan: Mbit/s. Nilai yang valid: 1 hingga 5000. Jika Anda mengatur metode penagihan ke pay-by-traffic, rentang nilainya adalah 1 hingga 2000. Jika Anda mengatur metode penagihan ke pay-by-bandwidth, rentang nilainya adalah 1 hingga 5000.' Label: en: Bandwidth Publik Gateway IPv6 VSwitchZoneId: AssociationProperty: ALIYUN::ECS::Instance:ZoneId Type: String Description: en: 'ID zona.<br/><b>Catatan: <font color=''blue''>Sebelum memilih zona, pastikan zona tersebut mendukung sumber daya ECS yang ingin Anda buat. Kami merekomendasikan Anda memilih zona yang berbeda dari zona vSwitch lainnya.</font>' Label: en: Zona vSwitch InstancePublicIP: Default: false Type: Boolean Description: en: Menentukan apakah akan menetapkan alamat IPv4 publik. Label: en: Alokasikan Alamat IPv4 Publik IPV6GateWaySpec: AssociationPropertyMetadata: LocaleKey: NatGatewaySpec Description: en: 'Edisi gateway IPv6. Nilai yang valid: Small (Free Edition), Medium (Enterprise Edition), dan Large (Enterprise Enhanced Edition).' Default: Small Label: en: Spesifikasi Gateway IPv6 AllowedValues: - Small - Medium - Large Type: String Outputs: EcsInstanceId: Description: InstanceId EcsInstance Value: Fn::GetAtt: - EcsInstance - InstanceId EcsInstancePrivateIp: Description: PrivateIp EcsInstance Value: Fn::GetAtt: - EcsInstance - PrivateIp EcsInstanceIpv6Address: Description: Ipv6Address EcsInstance Value: Fn::Select: - '0' - Fn::GetAtt: - EcsAssignIpv6Addresses - Ipv6Addresses Conditions: {} Resources: EcsSecurityGroup: Type: ALIYUN::ECS::SecurityGroup Properties: SecurityGroupIngress: - Priority: 1 IpProtocol: tcp NicType: intranet SourceCidrIp: 0.0.0.0/0 PortRange: 3389/3389 - Priority: 1 IpProtocol: all NicType: intranet Ipv6SourceCidrIp: '::/0' PortRange: '-1/-1' VpcId: Ref: EcsVpc SecurityGroupEgress: - Priority: 1 IpProtocol: tcp DestCidrIp: 0.0.0.0/0 NicType: intranet PortRange: 3389/3389 - Ipv6DestCidrIp: '::/0' IpProtocol: all Priority: 1 NicType: intranet PortRange: '-1/-1' WaitConditionHandle: Type: ALIYUN::ROS::WaitConditionHandle Properties: {} VpcIpv6InternetBandwidth: Type: ALIYUN::VPC::Ipv6InternetBandwidth Properties: InternetChargeType: Ref: InternetChargeType Bandwidth: Ref: IPV6Bandwidth Ipv6AddressId: Fn::Select: - 0 - Fn::GetAtt: - EcsAssignIpv6Addresses - Ipv6AddressIds Ipv6GatewayId: Ref: VpcIpv6Gateway DependsOn: - EcsAssignIpv6Addresses - VpcIpv6Gateway VpcIpv6Gateway: Type: ALIYUN::VPC::Ipv6Gateway Properties: VpcId: Ref: EcsVpc Name: MyIpv6Gateway Spec: Ref: IPV6GateWaySpec EcsAssignIpv6Addresses: Type: ALIYUN::ECS::AssignIpv6Addresses Properties: NetworkInterfaceId: Fn::GetAtt: - EcsInstance - PrimaryNetworkInterfaceId Ipv6AddressCount: 1 DependsOn: - EcsInstance EcsVSwitch: Type: ALIYUN::ECS::VSwitch Properties: Ipv6CidrBlock: 0 VpcId: Ref: EcsVpc CidrBlock: Ref: VSwitchCidrBlock ZoneId: Ref: VSwitchZoneId WaitCondition: Type: ALIYUN::ROS::WaitCondition Properties: Count: 1 Handle: Ref: WaitConditionHandle Timeout: 900 EcsInstance: Type: ALIYUN::ECS::Instance Properties: UserData: Fn::Replace: - ros-notify: Fn::GetAtt: - WaitConditionHandle - CurlCli - Fn::Join: - '' - - '#!/bin/sh' - |2 - | cd /opt - | wget http://ecs-image-utils.oss-cn-hangzhou.aliyuncs.com/ipv6/rhel/ecs-utils-ipv6 - | chmod +x ./ecs-utils-ipv6 - | ./ecs-utils-ipv6 - | ros-notify -d "{\"Data\" : \"SUCCESS\", \"Status\" : \"SUCCESS\"}" SystemDiskCategory: Ref: SystemDiskCategory VpcId: Ref: EcsVpc SecurityGroupId: Ref: EcsSecurityGroup SystemDiskSize: Ref: SystemDiskSize ImageId: Ref: InstanceImageId AllocatePublicIP: Ref: InstancePublicIP VSwitchId: Ref: EcsVSwitch IoOptimized: optimized Password: Ref: InstancePassword InstanceType: Ref: InstanceType DependsOn: - EcsSecurityGroup - EcsVSwitch - EcsVpc EcsVpc: Type: ALIYUN::ECS::VPC Properties: CidrBlock: Ref: VpcCidrBlock VpcName: Fn::Join: - '-' - - StackId - Ref: ALIYUN::StackId EnableIpv6: true Metadata: ALIYUN::ROS::Interface: ParameterGroups: - Parameters: - VpcCidrBlock - VSwitchCidrBlock - VSwitchZoneId - InstanceType - InstanceImageId - SystemDiskSize - InstancePublicIP - InternetChargeType - IPV6Bandwidth - IPV6GateWaySpec - SystemDiskCategory - InstancePassword Label: default: ECS <br/><br/><br/><br/><br/>
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "en": "Membuat server cloud (ECS) dual-stack dan secara otomatis mengonfigurasi IP publik IPv6, termasuk VPC, grup keamanan, Gateway IPv6, dan pengaturan bandwidth."
  },
  "Parameters": {
    "InstanceImageId": {
      "AssociationPropertyMetadata": {
        "InstanceType": "${InstanceType}",
        "SupportedImageOwnerAlias": [
          "system",
          "self",
          "others"
        ]
      },
      "Description": {
        "en": "ID citra.
Untuk Linux, pilih: <font color='red'><b>centos_7</font> <br/>Untuk Windows, pilih: <font color='red'><b>win2008r2, win2012r2, atau win2016</font>" }, "Default": "centos_7_04_64_20G_alibase_201701015.vhd", "Label": { "en": "Citra" }, "AssociationProperty": "ALIYUN::ECS::Image::ImageId", "Type": "String" }, "SystemDiskCategory": { "AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory", "AssociationPropertyMetadata": { "LocaleKey": "DiskCategory", "InstanceType": "${InstanceType}" }, "Type": "String", "Description": { "en": "<font color='blue'><b>Nilai yang valid:</font><br/>[cloud_efficiency: <font color='green'>disk ultra</font>]<br>[cloud_ssd: <font color='green'>SSD standar</font>]<br>[cloud_essd: <font color='green'>SSD Perusahaan</font>]<br>[cloud: <font color='green'>disk dasar</font>]<br>[ephemeral_ssd: <font color='green'>SSD lokal</font>]" }, "Label": { "en": "Tipe Disk Sistem" } }, "SystemDiskSize": { "Default": 40, "Type": "Number", "Description": { "en": "Ukuran disk sistem. Satuan: GB. Nilai yang valid: 20 hingga 500." }, "Label": { "en": "Ruang Disk Sistem" } }, "VpcCidrBlock": { "Default": "192.168.0.0/16", "Label": { "en": "Blok CIDR IPv4 VPC" }, "Type": "String", "Description": { "en": "Blok CIDR IPv4 VPC. Kami merekomendasikan Anda menggunakan salah satu blok CIDR berikut:<br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>" }, "AllowedValues": [ "192.168.0.0/16", "172.16.0.0/12", "10.0.0.0/8" ] }, "InstanceType": { "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType", "AssociationPropertyMetadata": { "ZoneId": "VSwitchZoneId" }, "Type": "String", "Description": { "en": "Tipe instans. Pastikan tipe instans tersedia di zona yang dipilih.<br>Tipe instans umum adalah <font color='red'><b>ecs.c5.large</font>.<br/>Catatan: Beberapa zona mungkin tidak mendukung semua tipe instans.<br>Untuk informasi lebih lanjut, lihat <a href='https://www.alibabacloud.com/help/en/doc-detail/25378.html' target='_blank'><b><font color='blue'>Keluarga instans</font></a>." }, "Label": { "en": "Tipe Instans" } }, "InstancePassword": { "Description": { "en": "Kata sandi logon instans ECS. Kata sandi harus memiliki panjang 8 hingga 30 karakter dan berisi setidaknya tiga dari jenis karakter berikut: huruf besar, huruf kecil, angka, dan karakter khusus ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/." }, "Type": "String", "Label": { "en": "Kata Sandi Instans" }, "NoEcho": true, "AssociationProperty": "ALIYUN::ECS::Instance::Password", "ConstraintDescription": { "en": "Kata sandi harus memiliki panjang 8 hingga 30 karakter dan berisi setidaknya tiga dari jenis karakter berikut: huruf besar, huruf kecil, angka, dan karakter khusus ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/." } }, "VSwitchCidrBlock": { "Default": "192.168.0.0/24", "Type": "String", "Description": { "en": "Blok CIDR IPv4 vSwitch. Blok CIDR harus merupakan subnet dari VPC." }, "Label": { "en": "Blok CIDR IPv4 vSwitch" } }, "InternetChargeType": { "Default": "PayByBandwidth", "AssociationPropertyMetadata": { "LocaleKey": "InternetChargeType" }, "Label": { "en": "Metode Penagihan Bandwidth Internet IPv6" }, "Type": "String", "AllowedValues": [ "PayByTraffic", "PayByBandwidth" ] }, "IPV6Bandwidth": { "Default": 10, "Type": "Number", "Description": { "en": "Bandwidth publik Gateway IPv6. Satuan: Mbit/s. Nilai yang valid: 1 hingga 5000. Jika Anda mengatur metode penagihan ke bayar-per-lalu-lintas, rentang nilai adalah 1 hingga 2000. Jika Anda mengatur metode penagihan ke bayar-per-bandwidth, rentang nilai adalah 1 hingga 5000." }, "Label": { "en": "Bandwidth Publik Gateway IPv6" } }, "VSwitchZoneId": { "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId", "Type": "String", "Description": { "en": "ID zona.<br/><b>Catatan: <font color='blue'>Sebelum Anda memilih zona, pastikan zona tersebut mendukung sumber daya ECS yang ingin Anda buat. Kami merekomendasikan Anda memilih zona yang berbeda dari zona vSwitch lainnya.</font>" }, "Label": { "en": "Zona vSwitch" } }, "InstancePublicIP": { "Default": false, "Type": "Boolean", "Description": { "en": "Menentukan apakah akan menetapkan alamat IPv4 publik." }, "Label": { "en": "Alokasikan Alamat IPv4 Publik" } }, "IPV6GateWaySpec": { "AssociationPropertyMetadata": { "LocaleKey": "NatGatewaySpec" }, "Description": { "en": "Edisi Gateway IPv6. Nilai yang valid: Small (Free Edition), Medium (Edisi Perusahaan), dan Large (Edisi Perusahaan yang Ditingkatkan)." }, "Default": "Small", "Label": { "en": "Spesifikasi Gateway IPv6" }, "AllowedValues": [ "Small", "Medium", "Large" ], "Type": "String" } }, "Outputs": { "EcsInstanceId": { "Description": "ID Instans EcsInstance", "Value": { "Fn::GetAtt": [ "EcsInstance", "InstanceId" ] } }, "EcsInstancePrivateIp": { "Description": "IP Privat EcsInstance", "Value": { "Fn::GetAtt": [ "EcsInstance", "PrivateIp" ] } }, "EcsInstanceIpv6Address": { "Description": "Alamat IPv6 EcsInstance", "Value": { "Fn::Select": [ "0", { "Fn::GetAtt": [ "EcsAssignIpv6Addresses", "Ipv6Addresses" ] } ] } } }, "Conditions": {}, "Resources": { "EcsSecurityGroup": { "Type": "ALIYUN::ECS::SecurityGroup", "Properties": { "SecurityGroupIngress": [ { "Priority": 1, "IpProtocol": "tcp", "NicType": "intranet", "SourceCidrIp": "0.0.0.0/0", "PortRange": "3389/3389" }, { "Priority": 1, "IpProtocol": "all", "NicType": "intranet", "Ipv6SourceCidrIp": "::/0", "PortRange": "-1/-1" } ], "VpcId": { "Ref": "EcsVpc" }, "SecurityGroupEgress": [ { "Priority": 1, "IpProtocol": "tcp", "DestCidrIp": "0.0.0.0/0", "NicType": "intranet", "PortRange": "3389/3389" }, { "Ipv6DestCidrIp": "::/0", "IpProtocol": "all", "Priority": 1, "NicType": "intranet", "PortRange": "-1/-1" } ] } }, "WaitConditionHandle": { "Type": "ALIYUN::ROS::WaitConditionHandle", "Properties": {} }, "VpcIpv6InternetBandwidth": { "Type": "ALIYUN::VPC::Ipv6InternetBandwidth", "Properties": { "InternetChargeType": { "Ref": "InternetChargeType" }, "Bandwidth": { "Ref": "IPV6Bandwidth" }, "Ipv6AddressId": { "Fn::Select": [ 0, { "Fn::GetAtt": [ "EcsAssignIpv6Addresses", "Ipv6AddressIds" ] } ] }, "Ipv6GatewayId": { "Ref": "VpcIpv6Gateway" } }, "DependsOn": [ "EcsAssignIpv6Addresses", "VpcIpv6Gateway" ] }, "VpcIpv6Gateway": { "Type": "ALIYUN::VPC::Ipv6Gateway", "Properties": { "VpcId": { "Ref": "EcsVpc" }, "Name": "MyIpv6Gateway", "Spec": { "Ref": "IPV6GateWaySpec" } } }, "EcsAssignIpv6Addresses": { "Type": "ALIYUN::ECS::AssignIpv6Addresses", "Properties": { "NetworkInterfaceId": { "Fn::GetAtt": [ "EcsInstance", "PrimaryNetworkInterfaceId" ] }, "Ipv6AddressCount": 1 }, "DependsOn": [ "EcsInstance" ] }, "EcsVSwitch": { "Type": "ALIYUN::ECS::VSwitch", "Properties": { "Ipv6CidrBlock": 0, "VpcId": { "Ref": "EcsVpc" }, "CidrBlock": { "Ref": "VSwitchCidrBlock" }, "ZoneId": { "Ref": "VSwitchZoneId" } } }, "WaitCondition": { "Type": "ALIYUN::ROS::WaitCondition", "Properties": { "Count": 1, "Handle": { "Ref": "WaitConditionHandle" }, "Timeout": 900 } }, "EcsInstance": { "Type": "ALIYUN::ECS::Instance", "Properties": { "UserData": { "Fn::Replace": [ { "ros-notify": { "Fn::GetAtt": [ "WaitConditionHandle", "CurlCli" ] } }, { "Fn::Join": [ "", [ "#!/bin/sh", " \n", "cd /opt \n", "wget http://ecs-image-utils.oss-cn-hangzhou.aliyuncs.com/ipv6/rhel/ecs-utils-ipv6 \n", "chmod +x ./ecs-utils-ipv6 \n", "./ecs-utils-ipv6 \n", "ros-notify -d \"{\\\"Data\\\" : \\\"SUCCESS\\\", \\\"Status\\\" : \\\"SUCCESS\\\"}\" \n" ] ] } ] }, "SystemDiskCategory": { "Ref": "SystemDiskCategory" }, "VpcId": { "Ref": "EcsVpc" }, "SecurityGroupId": { "Ref": "EcsSecurityGroup" }, "SystemDiskSize": { "Ref": "SystemDiskSize" }, "ImageId": { "Ref": "InstanceImageId" }, "AllocatePublicIP": { "Ref": "InstancePublicIP" }, "VSwitchId": { "Ref": "EcsVSwitch" }, "IoOptimized": "optimized", "Password": { "Ref": "InstancePassword" }, "InstanceType": { "Ref": "InstanceType" } }, "DependsOn": [ "EcsSecurityGroup", "EcsVSwitch", "EcsVpc" ] }, "EcsVpc": { "Type": "ALIYUN::ECS::VPC", "Properties": { "CidrBlock": { "Ref": "VpcCidrBlock" }, "VpcName": { "Fn::Join": [ "-", [ "StackId", { "Ref": "ALIYUN::StackId" } ] ] }, "EnableIpv6": true } } }, "Metadata": { "ALIYUN::ROS::Interface": { "ParameterGroups": [ { "Parameters": [ "VpcCidrBlock", "VSwitchCidrBlock", "VSwitchZoneId", "InstanceType", "InstanceImageId", "SystemDiskSize", "InstancePublicIP", "InternetChargeType", "IPV6Bandwidth", "IPV6GateWaySpec", "SystemDiskCategory", "InstancePassword" ], "Label": { "default": "ECS" } } ] } } }<br/><br/><br/><br/><br/>

Skenario 3: Membuat instans Classic Load Balancer (CLB) tipe VPC

Buat cepat

ROSTemplateFormatVersion: '2015-09-01'
Description:
  en: Membuat VPC dan vSwitch, serta mengonfigurasi instans Server Load Balancer (SLB) akses internal. Anda dapat menentukan tipe instans dan tipe alamat.
Parameters:
  VpcCidrBlock:
    Type: String
    Label:
      en: Blok CIDR VPC
    Description:
      en: 'Blok CIDR IPv4 VPC. Anda dapat menggunakan blok CIDR berikut atau subnet-nya: 10.0.0.0/8, 172.16.0.0/12, dan 192.168.0.0/16.'
    Default: 192.168.0.0/16
    AllowedValues:
      - 192.168.0.0/16
      - 172.16.0.0/12
      - 10.0.0.0/8
  VSwitchZoneId:
    Type: String
    Label:
      en: ID Zona
    Default: Null
    Description:
      en: ID zona. Pastikan zona tersebut mendukung SLB.
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
  VSwitchCidrBlock:
    Type: String
    Label:
      en: Blok CIDR vSwitch
    Description:
      en: Blok CIDR vSwitch. Harus merupakan subnet dari VPC dan tidak sedang digunakan oleh vSwitch lain.
    Default: 192.168.0.0/24
  LoadBalancerSpec:
    Type: String
    Label:
      en: Spesifikasi
    Description:
      en: 'Spesifikasi instans SLB. Untuk informasi selengkapnya, lihat <a href=''https://www.alibabacloud.com/help/document_detail/85939.html'' target=''_blank''><font color=''blue''>spesifikasi instans SLB</font>.</a>'
    Default: slb.s1.small
Conditions: {}
Resources:
  EcsVpc:
    Type: ALIYUN::ECS::VPC
    Properties:
      CidrBlock:
        Ref: VpcCidrBlock
      VpcName:
        Fn::Join:
          - '-'
          - - StackId
            - Ref: ALIYUN::StackId
  EcsVSwitch:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      ZoneId:
        Ref: VSwitchZoneId
      VpcId:
        Ref: EcsVpc
      CidrBlock:
        Ref: VSwitchCidrBlock
      VSwitchName:
        Fn::Join:
          - '-'
          - - StackId
            - Ref: ALIYUN::StackId
  SlbLoadBalancer:
    Type: ALIYUN::SLB::LoadBalancer
    Properties:
      VpcId:
        Ref: EcsVpc
      VSwitchId:
        Ref: EcsVSwitch
      AddressType: intranet
      LoadBalancerName:
        Fn::Join:
          - '-'
          - - StackId
            - Ref: ALIYUN::StackId
      LoadBalancerSpec:
        Ref: LoadBalancerSpec
      PayType: PayOnDemand
    DependsOn: EcsVSwitch
Outputs:
  SlbLoadBalancerId:
    Description:
      en: ID instans SLB.
    Value:
      Fn::GetAtt:
        - SlbLoadBalancer
        - LoadBalancerId
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - VpcCidrBlock
          - VSwitchZoneId
          - VSwitchCidrBlock
        Label:
          default:
            en: VPC
      - Parameters:
          - LoadBalancerSpec
        Label:
          default:
            en: SLB
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "en": "Creates a VPC and a vSwitch, and configures an internal-facing Server Load Balancer (SLB) instance. You can specify the instance type and address type."
  },
  "Parameters": {
    "VpcCidrBlock": {
      "Type": "String",
      "Label": {
        "en": "VPC CIDR Block"
      },
      "Description": {
        "en": "The IPv4 CIDR block of the VPC. You can use the following CIDR blocks or their subnets: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16."
      },
      "Default": "192.168.0.0/16",
      "AllowedValues": [
        "192.168.0.0/16",
        "172.16.0.0/12",
        "10.0.0.0/8"
      ]
    },
    "VSwitchZoneId": {
      "Type": "String",
      "Label": {
        "en": "Zone ID"
      },
      "Default": null,
      "Description": {
        "en": "The ID of the zone. Make sure that the zone supports SLB."
      },
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId"
    },
    "VSwitchCidrBlock": {
      "Type": "String",
      "Label": {
        "en": "vSwitch CIDR Block"
      },
      "Description": {
        "en": "The CIDR block of the vSwitch. It must be a subnet of the VPC and cannot be in use by another vSwitch."
      },
      "Default": "192.168.0.0/24"
    },
    "LoadBalancerSpec": {
      "Type": "String",
      "Label": {
        "en": "Specification"
      },
      "Description": {
        "en": "The specification of the SLB instance. For more information, see <a href='https://www.alibabacloud.com/help/document_detail/85939.html' target='_blank'><font color='blue'>SLB instance specifications</font>.</a>"
      },
      "Default": "slb.s1.small"
    }
  },
  "Conditions": {},
  "Resources": {
    "EcsVpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": {
          "Ref": "VpcCidrBlock"
        },
        "VpcName": {
          "Fn::Join": [
            "-",
            [
              "StackId",
              {
                "Ref": "ALIYUN::StackId"
              }
            ]
          ]
        }
      }
    },
    "EcsVSwitch": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "ZoneId": {
          "Ref": "VSwitchZoneId"
        },
        "VpcId": {
          "Ref": "EcsVpc"
        },
        "CidrBlock": {
          "Ref": "VSwitchCidrBlock"
        },
        "VSwitchName": {
          "Fn::Join": [
            "-",
            [
              "StackId",
              {
                "Ref": "ALIYUN::StackId"
              }
            ]
          ]
        }
      }
    },
    "SlbLoadBalancer": {
      "Type": "ALIYUN::SLB::LoadBalancer",
      "Properties": {
        "VpcId": {
          "Ref": "EcsVpc"
        },
        "VSwitchId": {
          "Ref": "EcsVSwitch"
        },
        "AddressType": "intranet",
        "LoadBalancerName": {
          "Fn::Join": [
            "-",
            [
              "StackId",
              {
                "Ref": "ALIYUN::StackId"
              }
            ]
          ]
        },
        "LoadBalancerSpec": {
          "Ref": "LoadBalancerSpec"
        },
        "PayType": "PayOnDemand"
      },
      "DependsOn": "EcsVSwitch"
    }
  },
  "Outputs": {
    "SlbLoadBalancerId": {
      "Description": {
        "en": "The ID of the SLB instance."
      },
      "Value": {
        "Fn::GetAtt": [
          "SlbLoadBalancer",
          "LoadBalancerId"
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "VpcCidrBlock",
            "VSwitchZoneId",
            "VSwitchCidrBlock"
          ],
          "Label": {
            "default": {
              "en": "VPC"
            }
          }
        },
        {
          "Parameters": [
            "LoadBalancerSpec"
          ],
          "Label": {
            "default": {
              "en": "SLB"
            }
          }
        }
      ]
    }
  }
}

Untuk contoh lainnya, lihat templat publik yang berisi resource ini.