すべてのプロダクト
Search
ドキュメントセンター

Resource Orchestration Service:ALIYUN::VPC::EIPAssociation

最終更新日:Feb 07, 2026

ALIYUN::VPC::EIPAssociation を使用して、Elastic IP Address (EIP) をクラウドサービスインスタンスに関連付けます。

構文

{
  "Type": "ALIYUN::VPC::EIPAssociation",
  "Properties": {
    "AllocationId": String,
    "InstanceId": String,
    "PrivateIpAddress": String,
    "Mode": String
  }
}         

プロパティ

プロパティ名

必須

更新許可

説明

制約

AllocationId

String

はい

はい

EIP の ID。

なし

InstanceId

String

はい

はい

クラウドサービスインスタンスの ID。

サポートされるクラウドサービスインスタンスタイプは以下のとおりです。

  • VPC モードの ECS インスタンス。

  • VPC モードの SLB インスタンス。

  • NAT Gateway。

  • 高可用性仮想 IP アドレス (HaVip)。

  • 弾性ネットワークインターフェース (ENI)。

PrivateIpAddress

String

いいえ

はい

vSwitch の CIDR ブロック内のプライベート IP アドレス。

このパラメーターを指定しない場合、システムは VPC ID および vSwitch ID に基づいて自動的にプライベート IP アドレスを割り当てます。

Mode

String

いいえ

はい

関連付けモード。

有効な値:

  • NAT (デフォルト):一般モード (標準モード)。

  • MULTI_BINDED:マルチ EIP 可視モード。

  • BINDED:EIP 可視モード。

戻り値

Fn::GetAtt

  • EipAddress:EIP の IP アドレス。

  • AllocationId:EIP の ID。

シナリオ 1:1 つの ECS インスタンスを作成し、EIP を関連付けます。

今すぐ作成

ROSTemplateFormatVersion: '2015-09-01'
Description:
  en: Create a VPC type ECS and bind EIP (existing VPC).
  ja: VPCタイプのECSインスタンスを作成し、EIPをバインドします(既存のVPC)。
Parameters:
  VPC:
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
    Type: String
    Description:
      en: Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud.
      ja: コンソールの[Virtual Private Cloud]から、(vpc-xxx)で始まるIDを検索してください。
    Label:
      en: VPC ID
      ja: VPC ID
  VSwitch:
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      VpcId: ${VPC}
    Type: String
    Description:
      en: Existing VSwitch ID, query under console-VPC-VSwitch, <font color='red'>VSwitch must be under VPC. ECS will be created under this VSwitch.</font>
      ja: 既存のvSwitchのIDです。コンソールの[VPC]→[vSwitch]で照会できます。<font color='red'>vSwitchはVPC内に存在する必要があります。ECSインスタンスはこのvSwitch内に作成されます。</font>
    Label:
      en: VSwitch ID
      ja: vSwitch ID
  SecurityGroup:
    Type: String
    AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
    Description:
      en: Please search the business security group ID starting with (sg-xxx) from console-ECS-Network & Security.
      ja: コンソールの[ECS]→[ネットワークとセキュリティ]から、(sg-xxx)で始まるビジネスセキュリティグループのIDを検索してください。<br/><font color='red'>セキュリティグループはVPC内に存在する必要があります。</font>
    Label:
      en: Business Security Group ID
      ja: セキュリティグループID
    AssociationPropertyMetadata:
      VpcId: ${VPC}
  ECSInstanceType:
    AssociationPropertyMetadata:
      InstanceChargeType: ${ECSInstanceType}
    AssociationProperty: ALIYUN::ECS::Instance::InstanceType
    Type: String
    Description:
      en: <font color='blue'><b>1.Before selecting the model please confirm that the current available zone under the model is in stock, some models need to be reported in advance</font><br/><font color='blue'><b>2.List of optional models</font><br></font>[ecs.c5.large <font color='green'>2vCPU 4GiB Intranet bandwidth1Gbps In-grid sending and receiving packages30MillionPPS</font>]<br/>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB Intranet bandwidth1.5Gbps In-grid sending and receiving packages50MillionPPS</font>]<br/>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB Intranet bandwidth2.5Gbps In-grid sending and receiving packages80MillionPPS</font>]
      ja: <font color='blue'><b>1. インスタンスタイプを選択する前に、現在のゾーンで該当するインスタンスタイプが在庫にあることを確認してください。一部のインスタンスタイプは事前に申請する必要があります。</font><br/><font color='blue'><b>2. 選択可能なインスタンスタイプ一覧</font><br></font>[ecs.c5.large <font color='green'>2 vCPU、4 GiB、内部帯域幅 1 Gbit/s、パケット転送速度 300,000 PPS</font>]<br/>[ecs.c5.xlarge <font color='green'>4 vCPU、8 GiB、内部帯域幅 1.5 Gbit/s、パケット転送速度 500,000 PPS</font>]<br/>[ecs.c5.2xlarge <font color='green'>8 vCPU、16 GiB、内部帯域幅 2.5 Gbit/s、パケット転送速度 800,000 PPS</font>]
    Label:
      en: Instance Type
      ja: インスタンスタイプ
  ECSDiskCategory:
    Type: String
    Description:
      en: '<font color=''blue''><b>Optional values:</font><br/>[cloud_efficiency: <font color=''green''>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color=''green''>SSD Cloud Disk</font>]<br>[cloud_essd: <font color=''green''>ESSD Cloud Disk</font>]<br>[cloud: <font color=''green''>Cloud Disk</font>]<br>[ephemeral_ssd: <font color=''green''>Local SSD Cloud Disk</font>]'
      ja: '<font color=''blue''><b>有効な値:</font><br/>[cloud_efficiency: <font color=''green''>Ultra ディスク</font>]<br/>[cloud_ssd: <font color=''green''>標準 SSD</font>]<br/>[cloud_essd: <font color=''green''>ESSD (エンタープライズ SSD)</font>]<br/>[cloud: <font color=''green''>基本ディスク</font>]<br/>[ephemeral_ssd: <font color=''green''>ローカル SSD</font>]'
    AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
    AssociationPropertyMetadata:
      InstanceType: ${ECSInstanceType}
    Label:
      en: System Disk Type
      ja: システムディスクタイプ
  InstanceChargeType:
    Type: String
    Label:
      en: Instance Charge Type
      ja: インスタンス課金方法
    Description:
      en: '<font color=''blue''><b>Optional values:</font><br/>[PostPaid: <font color=''green''>Pay as you go.</font>]<br> [PrePaid: <font color=''green''>Prepaid, monthly subscription.</font>]'
      ja: '<font color=''blue''><b>有効な値:</font><br/>[PostPaid: <font color=''green''>従量課金</font>]<br/>[PrePaid: <font color=''green''>サブスクリプション</font>]'
    AllowedValues:
      - PostPaid
      - PrePaid
    Default: PostPaid
  KeyPairName:
    Type: String
    AssociationProperty: ALIYUN::ECS::KeyPair::KeyPairName
    Label:
      en: Key Pair Name
      ja: キーペア名
    Description:
      en: If it is a Windows ECS instance, ignore this parameter. The default is blank.<br>If you have filled in <font color='green'>key pair name</font>, <font color='green'>instance password< The content of /font> will still be set in the instance, but the password login method in the Linux system will be forbidden.<br><font color='red'>Please enter the name of the existing key pair. If you use the instance password Login, the key pair name does not need to be filled in.</font>
      ja: Windows ECSインスタンスの場合は、このパラメーターを無視してください。デフォルトは空白です。<br>「<font color='green'>キーペア名</font>」を指定した場合、「<font color='green'>インスタンスパスワード</font>」の設定はインスタンスに適用されますが、Linuxオペレーティングシステムではパスワードによるログインが禁止されます。<br><font color='red'>既存のキーペアの名前を入力してください。インスタンスパスワードを使用してログインする場合は、キーペア名を入力する必要はありません。</font>
    Default: Null
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - VPC
          - VSwitch
          - SecurityGroup
        Label:
          default: 'VPC '
      - Parameters:
          - ECSInstanceType
          - ECSDiskCategory
          - InstanceChargeType
          - KeyPairName
        Label:
          default: ECS
    TemplateTags:
      - ECSインスタンスを作成するためのイメージIDおよびスナップショットを指定します。
Resources:
  ECSInstanceGroup:
    Type: ALIYUN::ECS::InstanceGroup
    Properties:
      IoOptimized: optimized
      InstanceChargeType:
        Ref: InstanceChargeType
      SystemDisk_Category:
        Ref: ECSDiskCategory
      SecurityGroupId:
        Ref: SecurityGroup
      VSwitchId:
        Ref: VSwitch
      MaxAmount: 1
      SystemDisk_Size: 40
      VpcId:
        Ref: VPC
      ImageId: ubuntu_14
      InstanceType:
        Ref: ECSInstanceType
      AllocatePublicIP: 'false'
      Password: Admin@123!
      KeyPairName:
        Ref: KeyPairName
  ElasticIp:
    Type: ALIYUN::VPC::EIP
    Properties:
      Bandwidth: 5
      InternetChargeType: PayByTraffic
  ElasticIpAssociation:
    Type: ALIYUN::VPC::EIPAssociation
    Properties:
      InstanceId:
        Fn::Select:
          - 0
          - Fn::GetAtt:
              - ECSInstanceGroup
              - InstanceIds
      AllocationId:
        Ref: ElasticIp
Outputs:
  VpcId:
    Description: VPC Id
    Value:
      Ref: VPC
  SecurityGroupId:
    Description: Security Group Id
    Value:
      Ref: SecurityGroup
  VSwitchId:
    Description: VSwitch Id
    Value:
      Ref: VSwitch
  EipAddress:
    Description: IP address of created EIP.
    Value:
      Fn::GetAtt:
        - ElasticIp
        - EipAddress
                    <br/><br/><br/><br/><br/><br/>
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "en": "VPC タイプの ECS を作成し、EIP をバインドします(既存の VPC)。",
    "zh-cn": "创建VPC类型ECS,并绑定EIP(已有VPC)。"
  },
  "Parameters": {
    "VPC": {
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
      "Type": "String",
      "Description": {
        "en": "コンソールの [仮想プライベートクラウド] から、vpc-xxx で始まる ID を検索してください。",
        "zh-cn": "现有专有网络的实例ID,在专有网络控制台选择专有网络进行查询。"
      },
      "Label": {
        "en": "VPC ID",
        "zh-cn": "专有网络VPC实例ID"
      }
    },
    "VSwitch": {
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VPC}"
      },
      "Type": "String",
      "Description": {
        "en": "既存の VSwitch ID。コンソールの [VPC] > [VSwitch] で照会してください。<font color='red'>VSwitch は VPC の下に存在する必要があります。ECS はこの VSwitch の下に作成されます。</font>",
        "zh-cn": "现有交换机ID,在专有网络控制台选择交换机进行查询,<font color='red'>交换机必须在VPC下。ECS将创建在此交换机下。</font>"
      },
      "Label": {
        "en": "VSwitch ID",
        "zh-cn": "交换机实例ID"
      }
    },
    "SecurityGroup": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
      "Description": {
        "en": "コンソールの [ECS] > [ネットワークとセキュリティ] から、sg-xxx で始まるビジネス用セキュリティグループ ID を検索してください。",
        "zh-cn": "现有业务安全组的实例ID,在ECS控制台选择安全组进行查询。<br/><font color='red'>安全组必须归属在VPC下。</font>"
      },
      "Label": {
        "en": "ビジネス用セキュリティグループ ID",
        "zh-cn": "业务安全组ID"
      },
      "AssociationPropertyMetadata": {
        "VpcId": "${VPC}"
      }
    },
    "ECSInstanceType": {
      "AssociationPropertyMetadata": {
        "InstanceChargeType": "${ECSInstanceType}"
      },
      "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
      "Type": "String",
      "Description": {
        "en": "<font color='blue'><b>1. モデルを選択する前に、現在のゾーンでそのモデルが利用可能であることを確認してください。一部のモデルは事前の通知が必要です。</font><br/><font color='blue'><b>2. 選択可能なモデル:</font><br/>[ecs.c5.large <font color='green'>2 vCPUs、4 GiB、イントラネット帯域幅: 1 Gbps、イントラネットの送受信パケット数: 3000 万 PPS</font>]<br>[ecs.c5.xlarge <font color='green'>4 vCPUs、8 GiB、イントラネット帯域幅: 1.5 Gbps、イントラネットの送受信パケット数: 5000 万 PPS</font>]<br>[ecs.c5.2xlarge <font color='green'>8 vCPUs、16 GiB、イントラネット帯域幅: 2.5 Gbps、イントラネットの送受信パケット数: 8000 万 PPS</font>]",
        "zh-cn": "<font color='blue'><b>1、选择机型前请先确认当前可用区下该机型是否有货,部分机型需要提前报备。</font><br/><font color='blue'><b>2、取值: </font><br></font>[ecs.c5.large: <font color='green'>2vCPU 4 GiB,内网带宽1Gbps、内网收发包30万PPS。</font>]<br>[ecs.c5.xlarge: <font color='green'>4vCPU 8GiB,内网带宽1.5Gbps、内网收发包50万PPS。</font>]<br>[ecs.c5.2xlarge:  <font color='green'>8vCPU 16 GiB,内网带宽2.5 Gbps、内网收发包80万PPS。</font>]"
      },
      "Label": {
        "en": "インスタンスタイプ",
        "zh-cn": "实例规格"
      }
    },
    "ECSDiskCategory": {
      "Type": "String",
      "Description": {
        "en": "<font color='blue'><b>選択可能な値:</font><br/>[cloud_efficiency: <font color='green'>ハイエフィシェンシー クラウドディスク</font>]<br>[cloud_ssd: <font color='green'>SSD クラウドディスク</font>]<br>[cloud_essd: <font color='green'>ESSD クラウドディスク</font>]<br>[cloud: <font color='green'>クラウドディスク</font>]<br>[ephemeral_ssd: <font color='green'>ローカル SSD クラウドディスク</font>]",
        "zh-cn": "<font color='blue'><b>取值: </font><br>[cloud_efficiency: <font color='green'>高效云盘</font>]<br>[cloud_ssd: <font color='green'>SSD云盘</font>]<br>[cloud_essd: <font color='green'>ESSD云盘</font>]<br>[cloud: <font color='green'>普通云盘</font>]<br>[ephemeral_ssd: <font color='green'>本地SSD盘</font>]"
      },
      "AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
      "AssociationPropertyMetadata": {
        "InstanceType": "${ECSInstanceType}"
      },
      "Label": {
        "en": "システムディスクの種類",
        "zh-cn": "系统盘类型"
      }
    },
    "InstanceChargeType": {
      "Type": "String",
      "Label": {
        "en": "インスタンスの課金方法",
        "zh-cn": "实例的付费方式"
      },
      "Description": {
        "en": "<font color='blue'><b>選択可能な値:</font><br>[PostPaid: <font color='green'>従量課金。</font>]<br> [PrePaid: <font color='green'>前払い(月額サブスクリプション)。</font>]",
        "zh-cn": "<font color='blue'><b>取值: </font><br>[PostPaid: <font color='green'>按量付费。</font>]<br>[PrePaid: <font color='green'>预付费,包年包月。</font>]"
      },
      "AllowedValues": [
        "PostPaid",
        "PrePaid"
      ],
      "Default": "PostPaid"
    },
    "KeyPairName": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::KeyPair::KeyPairName",
      "Label": {
        "en": "キーペア名",
        "zh-cn": "密钥对名称"
      },
      "Description": {
        "en": "Windows ECS インスタンスの場合は、このパラメーターを無視してください。デフォルト値は空白です。<br><font color='green'>キーペア名</font> を入力した場合、<font color='green'>インスタンスパスワード</font> はインスタンスに設定されますが、Linux システムでのパスワードログインは禁止されます。<br><font color='red'>既存のキーペアの名前を入力してください。インスタンスパスワードでログインする場合は、キーペア名の入力は不要です。</font>",
        "zh-cn": "如果是Windows ECS实例,则忽略该参数。默认为空。<br>如果已填写<font color='green'>密钥对名称</font>,<font color='green'>实例密码</font>的内容仍会被设置到实例中,但是Linux系统中的密码登录方式会被禁止。<br><font color='red'>请输入已有密钥对的名称。如使用实例密码登录,密钥对名称不需要填写。</font>"
      },
      "Default": null
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "VPC",
            "VSwitch",
            "SecurityGroup"
          ],
          "Label": {
            "default": "VPC "
          }
        },
        {
          "Parameters": [
            "ECSInstanceType",
            "ECSDiskCategory",
            "InstanceChargeType",
            "KeyPairName"
          ],
          "Label": {
            "default": "ECS"
          }
        }
      ],
      "TemplateTags": [
        "Specify the image Id and snapshot to create ECS instance."
      ]
    }
  },
  "Resources": {
    "ECSInstanceGroup": {
      "Type": "ALIYUN::ECS::InstanceGroup",
      "Properties": {
        "IoOptimized": "optimized",
        "InstanceChargeType": {
          "Ref": "InstanceChargeType"
        },
        "SystemDisk_Category": {
          "Ref": "ECSDiskCategory"
        },
        "SecurityGroupId": {
          "Ref": "SecurityGroup"
        },
        "VSwitchId": {
          "Ref": "VSwitch"
        },
        "MaxAmount": 1,
        "SystemDisk_Size": 40,
        "VpcId": {
          "Ref": "VPC"
        },
        "ImageId": "ubuntu_14",
        "InstanceType": {
          "Ref": "ECSInstanceType"
        },
        "AllocatePublicIP": "false",
        "Password": "Admin@123!",
        "KeyPairName": {
          "Ref": "KeyPairName"
        }
      }
    },
    "ElasticIp": {
      "Type": "ALIYUN::VPC::EIP",
      "Properties": {
        "Bandwidth": 5,
        "InternetChargeType": "PayByTraffic"
      }
    },
    "ElasticIpAssociation": {
      "Type": "ALIYUN::VPC::EIPAssociation",
      "Properties": {
        "InstanceId": {
          "Fn::Select": [
            0,
            {
              "Fn::GetAtt": [
                "ECSInstanceGroup",
                "InstanceIds"
              ]
            }
          ]
        },
        "AllocationId": {
          "Ref": "ElasticIp"
        }
      }
    }
  },
  "Outputs": {
    "VpcId": {
      "Description": "VPC ID",
      "Value": {
        "Ref": "VPC"
      }
    },
    "SecurityGroupId": {
      "Description": "セキュリティグループ ID",
      "Value": {
        "Ref": "SecurityGroup"
      }
    },
    "VSwitchId": {
      "Description": "VSwitch ID",
      "Value": {
        "Ref": "VSwitch"
      }
    },
    "EipAddress": {
      "Description": "作成された EIP の IP アドレス。",
      "Value": {
        "Fn::GetAtt": [
          "ElasticIp",
          "EipAddress"
        ]
      }
    }
  }
}<br/><br/><br/><br/><br/>

シナリオ 2:複数の ECS インスタンスを作成し、それぞれに EIP を関連付けます

今すぐ作成

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: Create a specified number of ECS instances in a Virtual Private Cloud (VPC), equipped with Elastic IP addresses (EIPs), billed by configuration and bandwidth usage, and deployed in the specified vSwitch and security group.
  en: 指定された VPC 内に、指定された数の ECS インスタンスをプロビジョニングします。これらのインスタンスには Elastic IP アドレス (EIP) が装備され、構成と帯域幅の使用量に基づいて課金され、指定された仮想スイッチ (vSwitch) とセキュリティグループ配下に配置されます。
Parameters:
  VPC:
    Type: String
    Label:
      en: VPC ID
      zh-cn: the VPC ID.
    Description:
      en: コンソールの Virtual Private Cloud で、vpc-xxx で始まる ID を検索します。
      zh-cn: Find the ID of your existing VPC in the console under Virtual Private Cloud.
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
  VSwitch:
    Type: String
    Label:
      en: VSwitch ID
      zh-cn: the vSwitch ID.
    Description:
      en: 既存の VSwitch ID。コンソールの VPC > vSwitch で確認します。<font color='red'>VSwitch は選択した VPC 内にある必要があります。ECS インスタンスはこの VSwitch 内に作成されます。</font>
      zh-cn: Find the ID of your existing VSwitch in the console under VPC > vSwitch. <font color='red'>The VSwitch must be in the selected VPC. ECS instances will be created in this VSwitch.</font>
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      VpcId: ${VPC}
      ZoneId: ${ECSZoneId}
  SecurityGroup:
    Type: String
    Label:
      en: ビジネスセキュリティグループ ID
      zh-cn: the business security group ID.
    Description:
      en: コンソールの ECS > ネットワーク & セキュリティで、sg-xxx で始まるビジネスセキュリティグループ ID を検索します。
      zh-cn: Find the ID of your existing business security group in the console under ECS > Network & Security > Security Groups. 
<font color='red'>The security group must belong to the selected VPC.</font> AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId AssociationPropertyMetadata: VpcId: ${VPC} EIPBandwidth: Type: Number Label: en: EIP 帯域幅 zh-cn: Elastic IP address bandwidth. Description: en: EIP 帯域幅。有効値: 1~200。単位: Mbps。 zh-cn: Elastic IP address bandwidth. Valid values: 1 to 200. Unit: Mbps. Default: 1 MinValue: 1 MaxValue: 200 EIPInternetChargeType: Type: String Label: en: EIP 課金タイプ zh-cn: EIP charge type. AssociationPropertyMetadata: LocaleKey: InternetChargeType Default: PayByTraffic AllowedValues: - PayByBandwidth - PayByTraffic Count: Type: Number Label: en: 数 zh-cn: Count Description: en: 作成する ECS インスタンスと EIP の数。有効値: 1~140。 zh-cn: Number of ECS instances and EIPs to create. Valid values: 1 to 140. Default: 2 MinValue: 1 MaxValue: 140 ECSZoneId: Type: String Label: en: VSwitch 可用性ゾーン zh-cn: the vSwitch zone Description: en: 可用性ゾーン ID。<br><b>注: <font color='blue'>可用性ゾーンを選択する前に、使用する予定のインスタンスタイプをサポートしていることを確認してください。他の vSwitch とは異なる可用性ゾーンを選択することをお勧めします。</font><br/><font color='red'>VSwitch の可用性ゾーンと選択した VSwitch ID は一致している必要があります。</font> zh-cn: Availability zone ID. <br><b>Note: <font color='blue'>Before you select an availability zone, confirm that it supports the instance type you plan to use. We recommend choosing a different availability zone than other VSwitches.</font><br/><font color='red'>The availability zone of the VSwitch and the selected VSwitch ID must match.</font> AssociationProperty: ALIYUN::ECS::Instance:ZoneId ECSImageId: Type: String Label: en: イメージ zh-cn: Image Description: en: イメージ ID。CentOS 7 を使用します。詳細については、「<b><a href='https://www.alibabacloud.com/help/en/doc-detail/112977.html' target='_blank'><font color='blue'>イメージの検索</font></a>」をご参照ください。 zh-cn: Image ID. Use CentOS 7. For details, see <a href='https://www.alibabacloud.com/help/document_detail/112977.html' target='_blank'><font color='blue'>Find an image</font></a>. AssociationProperty: ALIYUN::ECS::Image::ImageId AssociationPropertyMetadata: InstanceType: ${ECSInstanceType} SupportedImageOwnerAlias: - system - self - others Default: centos_7_04_64_20G_alibase_201701015.vhd ECSInstanceType: Type: String Label: en: インスタンスタイプ zh-cn: Instance Type Description: en: <font color='blue'><b>1. インスタンスタイプを選択する前に、選択した可用性ゾーンで利用可能であることを確認してください。一部のインスタンスタイプには事前通知が必要です。</font>
<font color='blue'><b>2. 利用可能なインスタンスタイプ</font>
</font>[ecs.c5.large <font color='green'>2 vCPU、4 GiB メモリ、1 Gbps 内部帯域幅、3,000 万 PPS</font>]<br/>[ecs.c5.xlarge <font color='green'>4 vCPU、8 GiB メモリ、1.5 Gbps 内部帯域幅、5,000 万 PPS</font>]<br/>[ecs.c5.2xlarge <font color='green'>8 vCPU、16 GiB メモリ、2.5 Gbps 内部帯域幅、8,000 万 PPS</font>] zh-cn: <font color='blue'><b>1. Before selecting an instance type, confirm that it is available in the selected availability zone. Some instance types require advance notice.</font><br/><font color='blue'><b>2. Available instance types</font><br></font>[ecs.c5.large <font color='green'>2 vCPUs, 4 GiB memory, 1 Gbps internal bandwidth, 300,000 PPS</font>]<br/>[ecs.c5.xlarge <font color='green'>4 vCPUs, 8 GiB memory, 1.5 Gbps internal bandwidth, 500,000 PPS</font>]<br/>[ecs.c5.2xlarge <font color='green'>8 vCPUs, 16 GiB memory, 2.5 Gbps internal bandwidth, 800,000 PPS</font>] AssociationProperty: ALIYUN::ECS::Instance::InstanceType AssociationPropertyMetadata: ZoneId: ECSZoneId ECSDiskCategory: Type: String Label: en: システムディスクタイプ zh-cn: System Disk Type Description: en: <font color='blue'><b>有効値:</font><br/>[cloud_efficiency: <font color='green'>ウルトラディスク</font>]<br>[cloud_ssd: <font color='green'>標準 SSD</font>]<br>[cloud_essd: <font color='green'>ESSD (エンタープライズ SSD)</font>]<br>[cloud: <font color='green'>ベーシックディスク</font>]<br>[ephemeral_ssd: <font color='green'>ローカル SSD ディスク</font>] zh-cn: <font color='blue'><b>Valid values:</font><br>[cloud_efficiency: <font color='green'>Ultra disk</font>]<br>[cloud_ssd: <font color='green'>Standard SSD</font>]<br>[cloud_essd: <font color='green'>Enterprise SSD</font>]<br>[cloud: <font color='green'>Basic disk</font>]<br>[ephemeral_ssd: <font color='green'>Local SSD disk</font>] AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory AssociationPropertyMetadata: LocaleKey: DiskCategory InstanceType: ${ECSInstanceType} ECSSysDiskSize: Type: Number Label: en: システムディスク容量 zh-cn: System Disk Space Description: en: システムディスクサイズ。有効値: 40~500。単位: GB。 zh-cn: System disk size. Valid values: 40 to 500. Unit: GB. Default: 40 MinValue: 40 MaxValue: 500 ECSPassword: Type: String NoEcho: true Label: en: インスタンスパスワード zh-cn: Instance Password Description: en: サーバーのログインパスワード。長さ: 8~30 文字。次のうち少なくとも 3 種類を含める必要があります: 大文字、小文字、数字、および ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/. などの特殊文字。 zh-cn: Server logon password. Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, numbers, and special characters such as ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/. ConstraintDescription: en: 長さ: 8~30 文字。次のうち少なくとも 3 種類を含める必要があります: 大文字、小文字、数字、および ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/. などの特殊文字。 zh-cn: Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, numbers, and special characters such as ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/. Default: Null AssociationProperty: ALIYUN::ECS::Instance::Password KeyPairName: Type: String Label: en: キーペア名 zh-cn: Key Pair Name Description: en: Windows ECS インスタンスを作成する場合は、このパラメーターを無視してください。デフォルト値は空です。<br><font color='green'>キーペア名</font>を指定した場合、<font color='green'>インスタンスパスワード</font>はインスタンスに設定されますが、Linux インスタンスではパスワードベースのログインは無効になります。<br><font color='red'>既存のキーペアの名前を入力します。インスタンスパスワードを使用してログインする場合は、このフィールドを空のままにします。</font> zh-cn: Ignore this parameter if you are creating a Windows ECS instance. The default value is empty.<br>If you specify a <font color='green'>key pair name</font>, the <font color='green'>instance password</font> is still set on the instance, but password-based logon is disabled for Linux instances.<br><font color='red'>Enter the name of an existing key pair. If you use the instance password to log on, leave this field blank.</font> AssociationProperty: ALIYUN::ECS::KeyPair::KeyPairName Default: Null PayType: Type: String Label: en: ECS インスタンス課金タイプ zh-cn: ECS instance charge type AssociationProperty: ChargeType AssociationPropertyMetadata: LocaleKey: InstanceChargeType Default: PostPaid AllowedValues: - PostPaid - PrePaid PayPeriodUnit: Type: String Label: en: 支払期間単位 zh-cn: Pay Period Unit AssociationProperty: PayPeriodUnit AssociationPropertyMetadata: Visible: Condition: Fn::Not: Fn::Equals: - ${PayType} - PostPaid Default: Month AllowedValues: - Month - Year PayPeriod: Type: Number Label: en: 期間 zh-cn: Period AssociationProperty: PayPeriod AssociationPropertyMetadata: Visible: Condition: Fn::Not: Fn::Equals: - ${PayType} - PostPaid Default: 1 AllowedValues: - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 Resources: ECSInstanceGroup: Type: ALIYUN::ECS::InstanceGroup Properties: ZoneId: Ref: ECSZoneId VpcId: Ref: VPC VSwitchId: Ref: VSwitch SecurityGroupId: Ref: SecurityGroup ImageId: Ref: ECSImageId AllocatePublicIP: 'false' InstanceChargeType: Ref: PayType Period: Ref: PayPeriod PeriodUnit: Ref: PayPeriodUnit InstanceType: Ref: ECSInstanceType IoOptimized: optimized KeyPairName: Ref: KeyPairName MaxAmount: Ref: Count Password: Ref: ECSPassword SystemDiskCategory: Ref: ECSDiskCategory SystemDiskSize: Ref: ECSSysDiskSize ElasticIp: Type: ALIYUN::VPC::EIP Properties: Bandwidth: Ref: EIPBandwidth InternetChargeType: Ref: EIPInternetChargeType Count: Ref: Count ElasticIpAssociation: Type: ALIYUN::VPC::EIPAssociation Properties: InstanceId: Fn::Select: - Ref: ALIYUN::Index - Fn::GetAtt: - ECSInstanceGroup - InstanceIds AllocationId: Fn::Select: - Ref: ALIYUN::Index - Ref: ElasticIp Count: Ref: Count Outputs: EipAddress: Description: 作成された EIP の IP アドレス。 Value: Fn::GetAtt: - ElasticIp - EipAddress SecurityGroupId: Description: 生成されたセキュリティグループの ID。 Value: Ref: SecurityGroup VSwitchId: Description: VPC 用に生成された vSwitch ID。 Value: Ref: VSwitch VpcId: Description: VPC 用に生成された VPC ID。 Value: Ref: VPC Metadata: ALIYUN::ROS::Interface: ParameterGroups: - Parameters: - VPC - ECSZoneId - VSwitch - SecurityGroup Label: default: 'VPC ' - Parameters: - EIPBandwidth - EIPInternetChargeType Label: default: EIP - Parameters: - PayType - PayPeriodUnit - PayPeriod Label: default: en: ECS PayType 設定 zh-cn: ECS PayType Configuration - Parameters: - ECSInstanceType - ECSImageId - ECSDiskCategory - ECSSysDiskSize - Count - ECSPassword - KeyPairName Label: default: ECS <br/><br/><br/>


{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "创建指定数量的VPC内ECS实例,配备EIP,按配置计费与带宽,于指定交换机与安全组下。",
    "en": "Provision a specified number of ECS instances within a designated Virtual Private Cloud (VPC), equipped with Elastic IP Addresses (EIPs), billed by configuration and bandwidth usage, placed under the specified virtual switch (VSwitch) and security group."
  },
  "Parameters": {
    "VPC": {
      "Type": "String",
      "Label": {
        "en": "VPC ID",
        "zh-cn": "专有网络VPC实例ID"
      },
      "Description": {
        "en": "Search for the ID that starts with vpc-xxx in the console under Virtual Private Cloud.",
        "zh-cn": "Find the ID of your existing VPC in the console under Virtual Private Cloud."
      },
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
    },
    "VSwitch": {
      "Type": "String",
      "Label": {
        "en": "VSwitch ID",
        "zh-cn": "交换机实例ID"
      },
      "Description": {
        "en": "Existing VSwitch ID. Find it in the console under VPC > vSwitch. <font color='red'>The VSwitch must be in the selected VPC. ECS instances will be created in this VSwitch.</font>",
        "zh-cn": "Find the ID of your existing VSwitch in the console under VPC > vSwitch. <font color='red'>The VSwitch must be in the selected VPC. ECS instances will be created in this VSwitch.</font>"
      },
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VPC}",
        "ZoneId": "${ECSZoneId}"
      }
    },
    "SecurityGroup": {
      "Type": "String",
      "Label": {
        "en": "Business Security Group ID",
        "zh-cn": "业务安全组ID"
      },
      "Description": {
        "en": "Search for the business security group ID that starts with sg-xxx in the console under ECS > Network & Security.",
        "zh-cn": "Find the ID of your existing business security group in the console under ECS > Network & Security > Security Groups. 
<font color='red'>The security group must belong to the selected VPC.</font>" }, "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId", "AssociationPropertyMetadata": { "VpcId": "${VPC}" } }, "EIPBandwidth": { "Type": "Number", "Label": { "en": "EIP Bandwidth", "zh-cn": "弹性公网帯域幅" }, "Description": { "en": "EIP bandwidth. Valid values: 1 to 200. Unit: Mbps.", "zh-cn": "Elastic IP address bandwidth. Valid values: 1 to 200. Unit: Mbps." }, "Default": 1, "MinValue": 1, "MaxValue": 200 }, "EIPInternetChargeType": { "Type": "String", "Label": { "en": "EIP Charge Type", "zh-cn": "EIP の課金タイプ" }, "AssociationPropertyMetadata": { "LocaleKey": "InternetChargeType" }, "Default": "PayByTraffic", "AllowedValues": [ "PayByBandwidth", "PayByTraffic" ] }, "Count": { "Type": "Number", "Label": { "en": "Count", "zh-cn": "数量" }, "Description": { "en": "Number of ECS instances and EIPs to create. Valid values: 1 to 140.", "zh-cn": "Number of ECS instances and EIPs to create. Valid values: 1 to 140." }, "Default": 2, "MinValue": 1, "MaxValue": 140 }, "ECSZoneId": { "Type": "String", "Label": { "en": "VSwitch Availability Zone", "zh-cn": "交換機の可用性ゾーン" }, "Description": { "en": "Availability zone ID. <br><b>Note: <font color='blue'>Before you select an availability zone, confirm that it supports the instance type you plan to use. We recommend choosing a different availability zone than other VSwitches.</font><br/><font color='red'>The availability zone of the VSwitch and the selected VSwitch ID must match.</font>", "zh-cn": "Availability zone ID. <br><b>Note: <font color='blue'>Before you select an availability zone, confirm that it supports the instance type you plan to use. We recommend choosing a different availability zone than other VSwitches.</font><br/><font color='red'>The availability zone of the VSwitch and the selected VSwitch ID must match.</font>" }, "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId" }, "ECSImageId": { "Type": "String", "Label": { "en": "Image", "zh-cn": "镜像" }, "Description": { "en": "Image ID. Use CentOS 7. For details, see <b><a href='https://www.alibabacloud.com/help/document_detail/112977.html' target='_blank'><font color='blue'>Find an image</font></a>.", "zh-cn": "Image ID. Use CentOS 7. For details, see <b><a href='https://www.alibabacloud.com/help/document_detail/112977.html' target='_blank'><font color='blue'>Find an image</font></a>" }, "AssociationProperty": "ALIYUN::ECS::Image::ImageId", "AssociationPropertyMetadata": { "InstanceType": "${ECSInstanceType}", "SupportedImageOwnerAlias": [ "system", "self", "others" ] }, "Default": "centos_7_04_64_20G_alibase_201701015.vhd" }, "ECSInstanceType": { "Type": "String", "Label": { "en": "Instance Type", "zh-cn": "实例规格" }, "Description": { "en": "<font color='blue'><b>1. Before selecting an instance type, confirm that it is available in the selected availability zone. Some instance types require advance notice.</font><br/><font color='blue'><b>2. Available instance types</font><br></font>[ecs.c5.large <font color='green'>2 vCPUs, 4 GiB memory, 1 Gbps internal bandwidth, 30 million PPS</font>]<br/>[ecs.c5.xlarge <font color='green'>4 vCPUs, 8 GiB memory, 1.5 Gbps internal bandwidth, 50 million PPS</font>]<br/>[ecs.c5.2xlarge <font color='green'>8 vCPUs, 16 GiB memory, 2.5 Gbps internal bandwidth, 80 million PPS</font>]", "zh-cn": "<font color='blue'><b>1. Before selecting an instance type, confirm that it is available in the selected availability zone. Some instance types require advance notice.</font><br/><font color='blue'><b>2. Available instance types</font><br></font>[ecs.c5.large <font color='green'>2 vCPUs, 4 GiB memory, 1 Gbps internal bandwidth, 300,000 PPS</font>]<br/>[ecs.c5.xlarge <font color='green'>4 vCPUs, 8 GiB memory, 1.5 Gbps internal bandwidth, 500,000 PPS</font>]<br/>[ecs.c5.2xlarge <font color='green'>8 vCPUs, 16 GiB memory, 2.5 Gbps internal bandwidth, 800,000 PPS</font>]" }, "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType", "AssociationPropertyMetadata": { "ZoneId": "ECSZoneId" } }, "ECSDiskCategory": { "Type": "String", "Label": { "en": "System Disk Type", "zh-cn": "系统盘类型" }, "Description": { "en": "<font color='blue'><b>Valid values:</font><br/>[cloud_efficiency: <font color='green'>Ultra disk</font>]<br>[cloud_ssd: <font color='green'>Standard SSD</font>]<br>[cloud_essd: <font color='green'>Enterprise SSD</font>]<br>[cloud: <font color='green'>Basic disk</font>]<br>[ephemeral_ssd: <font color='green'>Local SSD disk</font>]", "zh-cn": "<font color='blue'><b>Valid values:</font><br>[cloud_efficiency: <font color='green'>Ultra disk</font>]<br>[cloud_ssd: <font color='green'>Standard SSD</font>]<br>[cloud_essd: <font color='green'>Enterprise SSD</font>]<br>[cloud: <font color='green'>Basic disk</font>]<br>[ephemeral_ssd: <font color='green'>Local SSD disk</font>]" }, "AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory", "AssociationPropertyMetadata": { "LocaleKey": "DiskCategory", "InstanceType": "${ECSInstanceType}" } }, "ECSSysDiskSize": { "Type": "Number", "Label": { "en": "System Disk Space", "zh-cn": "系统盘空间" }, "Description": { "en": "System disk size. Valid values: 40 to 500. Unit: GB.", "zh-cn": "System disk size. Valid values: 40 to 500. Unit: GB." }, "Default": 40, "MinValue": 40, "MaxValue": 500 }, "ECSPassword": { "Type": "String", "NoEcho": true, "Label": { "en": "Instance Password", "zh-cn": "实例密码" }, "Description": { "en": "Server logon password. Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, numbers, and special characters such as ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/.", "zh-cn": "Server logon password. Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, numbers, and special characters such as ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/." }, "ConstraintDescription": { "en": "Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, numbers, and special characters such as ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/.", "zh-cn": "Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, numbers, and special characters such as ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/." }, "Default": null, "AssociationProperty": "ALIYUN::ECS::Instance::Password" }, "KeyPairName": { "Type": "String", "Label": { "en": "Key Pair Name", "zh-cn": "密钥对名称" }, "Description": { "en": "Ignore this parameter if you are creating a Windows ECS instance. The default value is empty.<br>If you specify a <font color='green'>key pair name</font>, the <font color='green'>instance password</font> is still set on the instance, but password-based logon is disabled for Linux instances.<br><font color='red'>Enter the name of an existing key pair. If you use the instance password to log on, leave this field blank.</font>", "zh-cn": "Ignore this parameter if you are creating a Windows ECS instance. The default value is empty.<br>If you specify a <font color='green'>key pair name</font>, the <font color='green'>instance password</font> is still set on the instance, but password-based logon is disabled for Linux instances.<br><font color='red'>Enter the name of an existing key pair. If you use the instance password to log on, leave this field blank.</font>" }, "AssociationProperty": "ALIYUN::ECS::KeyPair::KeyPairName", "Default": null }, "PayType": { "Type": "String", "Label": { "en": "ECS Instance Charge Type", "zh-cn": "ECS付费类型" }, "AssociationProperty": "ChargeType", "AssociationPropertyMetadata": { "LocaleKey": "InstanceChargeType" }, "Default": "PostPaid", "AllowedValues": [ "PostPaid", "PrePaid" ] }, "PayPeriodUnit": { "Type": "String", "Label": { "en": "Pay Period Unit", "zh-cn": "购买资源时长周期" }, "AssociationProperty": "PayPeriodUnit", "AssociationPropertyMetadata": { "Visible": { "Condition": { "Fn::Not": { "Fn::Equals": [ "${PayType}", "PostPaid" ] } } } }, "Default": "Month", "AllowedValues": [ "Month", "Year" ] }, "PayPeriod": { "Type": "Number", "Label": { "en": "Period", "zh-cn": "购买资源时长" }, "AssociationProperty": "PayPeriod", "AssociationPropertyMetadata": { "Visible": { "Condition": { "Fn::Not": { "Fn::Equals": [ "${PayType}", "PostPaid" ] } } } }, "Default": 1, "AllowedValues": [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ] } }, "Resources": { "ECSInstanceGroup": { "Type": "ALIYUN::ECS::InstanceGroup", "Properties": { "ZoneId": { "Ref": "ECSZoneId" }, "VpcId": { "Ref": "VPC" }, "VSwitchId": { "Ref": "VSwitch" }, "SecurityGroupId": { "Ref": "SecurityGroup" }, "ImageId": { "Ref": "ECSImageId" }, "AllocatePublicIP": "false", "InstanceChargeType": { "Ref": "PayType" }, "Period": { "Ref": "PayPeriod" }, "PeriodUnit": { "Ref": "PayPeriodUnit" }, "InstanceType": { "Ref": "ECSInstanceType" }, "IoOptimized": "optimized", "KeyPairName": { "Ref": "KeyPairName" }, "MaxAmount": { "Ref": "Count" }, "Password": { "Ref": "ECSPassword" }, "SystemDiskCategory": { "Ref": "ECSDiskCategory" }, "SystemDiskSize": { "Ref": "ECSSysDiskSize" } } }, "ElasticIp": { "Type": "ALIYUN::VPC::EIP", "Properties": { "Bandwidth": { "Ref": "EIPBandwidth" }, "InternetChargeType": { "Ref": "EIPInternetChargeType" } }, "Count": { "Ref": "Count" } }, "ElasticIpAssociation": { "Type": "ALIYUN::VPC::EIPAssociation", "Properties": { "InstanceId": { "Fn::Select": [ { "Ref": "ALIYUN::Index" }, { "Fn::GetAtt": [ "ECSInstanceGroup", "InstanceIds" ] } ] }, "AllocationId": { "Fn::Select": [ { "Ref": "ALIYUN::Index" }, { "Ref": "ElasticIp" } ] } }, "Count": { "Ref": "Count" } } }, "Outputs": { "EipAddress": { "Description": "IP address of created EIP.", "Value": { "Fn::GetAtt": [ "ElasticIp", "EipAddress" ] } }, "SecurityGroupId": { "Description": "generated security group id for security group.", "Value": { "Ref": "SecurityGroup" } }, "VSwitchId": { "Description": "generated security vswitch id for VPC.", "Value": { "Ref": "VSwitch" } }, "VpcId": { "Description": "generated security vpc id for VPC.", "Value": { "Ref": "VPC" } } }, "Metadata": { "ALIYUN::ROS::Interface": { "ParameterGroups": [ { "Parameters": [ "VPC", "ECSZoneId", "VSwitch", "SecurityGroup" ], "Label": { "default": "VPC " } }, { "Parameters": [ "EIPBandwidth", "EIPInternetChargeType" ], "Label": { "default": "EIP" } }, { "Parameters": [ "PayType", "PayPeriodUnit", "PayPeriod" ], "Label": { "default": { "en": "ECS PayType Configuration", "zh-cn": "ECS付费类型配置" } } }, { "Parameters": [ "ECSInstanceType", "ECSImageId", "ECSDiskCategory", "ECSSysDiskSize", "Count", "ECSPassword", "KeyPairName" ], "Label": { "default": "ECS" } } ] } } }<br/><br/><br/>

シナリオ 3:単一の ECS インスタンスに複数の EIP をアタッチします

今すぐ作成

ROSTemplateFormatVersion: '2015-09-01'
Description:
  en: Provision a specified number of ECS instances within a designated VPC, equipped with EIPs, billed by configuration and bandwidth usage, and placed in the specified vSwitch and security group.
Parameters:
  VPC:
    Type: String
    Label:
      en: VPC ID
    Description:
      en: The ID of your VPC. Find the ID that starts with vpc- in the Virtual Private Cloud console.
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
  VSwitch:
    Type: String
    Label:
      en: VSwitch ID
    Description:
      en: The ID of an existing vSwitch. Find the ID in the console under VPC > vSwitches. <font color='red'>The vSwitch must be in the selected VPC. The ECS instance will be created in this vSwitch.</font>
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      VpcId: ${VPC}
      ZoneId: ${ECSZoneId}
  SecurityGroup:
    Type: String
    Label:
      en: Business Security Group ID
    Description:
      en: The ID of an existing security group. Find the ID that starts with sg- in the console under ECS > Network & Security > Security Groups. 
<font color='red'>The security group must be in the selected VPC.</font> AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId AssociationPropertyMetadata: VpcId: ${VPC} EIPBandwidth: Type: Number Label: en: EIP Bandwidth Description: en: 'The bandwidth of the EIP. The value can be from 1 to 200. The unit is Mbps.' Default: 1 MinValue: 1 MaxValue: 200 EIPInternetChargeType: Type: String Label: en: EIP Charge Type AssociationPropertyMetadata: LocaleKey: InternetChargeType Default: PayByTraffic AllowedValues: - PayByBandwidth - PayByTraffic Count: Type: Number Label: en: Count Description: en: 'The number of ECS instances and EIPs to create. The value can be from 1 to 140.' Default: 2 MinValue: 1 MaxValue: 140 ECSZoneId: Type: String Label: en: VSwitch Availability Zone Description: en: 'The ID of the zone.<br><b>Note: <font color=''blue''>Before you select a zone, confirm that it supports the instance type for the ECS resources you want to create. We recommend you select a different zone from other vSwitches.</font></b ><br><font color=''red''>The zone and the selected vSwitch must be the same.</font>' AssociationProperty: ALIYUN::ECS::Instance:ZoneId ECSImageId: Type: String Label: en: Image Description: en: The ID of the image. Use a CentOS 7 image. For more information, see <b><a href='https://www.alibabacloud.com/help/document_detail/112977.html' target='_blank'><font color='blue'>Find an image</font></a> AssociationProperty: ALIYUN::ECS::Image::ImageId AssociationPropertyMetadata: InstanceType: ${ECSInstanceType} SupportedImageOwnerAlias: - system - self - others Default: centos_7_04_64_20G_alibase_201701015.vhd ECSInstanceType: Type: String Label: en: Instance Type Description: en: <font color='blue'><b>1. Before you select an instance type, confirm that it is in stock in the current zone. Some instance types require you to apply for them in advance.</font>
<font color='blue'><b>2. Available instance types:</font><br></font>[ecs.c5.large <font color='green'>2 vCPU, 4 GiB, 1 Gbps internal bandwidth, 300,000 PPS</font>]<br/>[ecs.c5.xlarge <font color='green'>4 vCPU, 8 GiB, 1.5 Gbps internal bandwidth, 500,000 PPS</font>]<br/>[ecs.c5.2xlarge <font color='green'>8 vCPU, 16 GiB, 2.5 Gbps internal bandwidth, 800,000 PPS</font>] AssociationProperty: ALIYUN::ECS::Instance::InstanceType AssociationPropertyMetadata: ZoneId: ECSZoneId ECSDiskCategory: Type: String Label: en: System Disk Type Description: en: '<font color=''blue''><b>Available values:</font><br>[cloud_efficiency: <font color=''green''>Ultra disk</font>]<br>[cloud_ssd: <font color=''green''>Standard SSD</font>]<br>[cloud_essd: <font color=''green''>ESSD</font>]<br>[cloud: <font color=''green''>Basic disk</font>]<br>[ephemeral_ssd: <font color=''green''>Local SSD</font>]' AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory AssociationPropertyMetadata: LocaleKey: DiskCategory InstanceType: ${ECSInstanceType} ECSSysDiskSize: Type: Number Label: en: System Disk Space Description: en: 'The size of the system disk. The value can be from 40 to 500. The unit is GB.' Default: 40 MinValue: 40 MaxValue: 500 ECSPassword: Type: String NoEcho: true Label: en: Instance Password Description: en: The logon password for the server. The password must be 8 to 30 characters long and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters from the following set: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/. ConstraintDescription: en: The password must be 8 to 30 characters long and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters from the following set: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/. Default: Null AssociationProperty: ALIYUN::ECS::Instance::Password KeyPairName: Type: String Label: en: Key Pair Name Description: en: This parameter is ignored for Windows ECS instances. The default value is empty.<br>If you specify a <font color='green'>key pair name</font>, the <font color='green'>instance password</font> is still set for the instance, but password-based logon is disabled for the Linux system.<br><font color='red'>Enter the name of an existing key pair. If you use the instance password to log on, do not specify a key pair name.</font> AssociationProperty: ALIYUN::ECS::KeyPair::KeyPairName Default: Null PayType: Type: String Label: en: ECS Instance Charge Type AssociationProperty: ChargeType AssociationPropertyMetadata: LocaleKey: InstanceChargeType Default: PostPaid AllowedValues: - PostPaid - PrePaid PayPeriodUnit: Type: String Label: en: Pay Period Unit AssociationProperty: PayPeriodUnit AssociationPropertyMetadata: Visible: Condition: Fn::Not: Fn::Equals: - ${PayType} - PostPaid Default: Month AllowedValues: - Month - Year PayPeriod: Type: Number Label: en: Period AssociationProperty: PayPeriod AssociationPropertyMetadata: Visible: Condition: Fn::Not: Fn::Equals: - ${PayType} - PostPaid Default: 1 AllowedValues: - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 Resources: ECSInstanceGroup: Type: ALIYUN::ECS::InstanceGroup Properties: ZoneId: Ref: ECSZoneId VpcId: Ref: VPC VSwitchId: Ref: VSwitch SecurityGroupId: Ref: SecurityGroup ImageId: Ref: ECSImageId AllocatePublicIP: 'false' InstanceChargeType: Ref: PayType Period: Ref: PayPeriod PeriodUnit: Ref: PayPeriodUnit InstanceType: Ref: ECSInstanceType IoOptimized: optimized KeyPairName: Ref: KeyPairName MaxAmount: Ref: Count Password: Ref: ECSPassword SystemDiskCategory: Ref: ECSDiskCategory SystemDiskSize: Ref: ECSSysDiskSize ElasticIp: Type: ALIYUN::VPC::EIP Properties: Bandwidth: Ref: EIPBandwidth InternetChargeType: Ref: EIPInternetChargeType Count: Ref: Count ElasticIpAssociation: Type: ALIYUN::VPC::EIPAssociation Properties: InstanceId: Fn::Select: - Ref: ALIYUN::Index - Fn::GetAtt: - ECSInstanceGroup - InstanceIds AllocationId: Fn::Select: - Ref: ALIYUN::Index - Ref: ElasticIp Count: Ref: Count Outputs: EipAddress: Description: IP address of created EIP. Value: Fn::GetAtt: - ElasticIp - EipAddress SecurityGroupId: Description: generated security group id for security group. Value: Ref: SecurityGroup VSwitchId: Description: generated security vswitch id for VPC. Value: Ref: VSwitch VpcId: Description: generated security vpc id for VPC. Value: Ref: VPC Metadata: ALIYUN::ROS::Interface: ParameterGroups: - Parameters: - VPC - ECSZoneId - VSwitch - SecurityGroup Label: default: 'VPC ' - Parameters: - EIPBandwidth - EIPInternetChargeType Label: default: EIP - Parameters: - PayType - PayPeriodUnit - PayPeriod Label: default: en: ECS billing configuration - Parameters: - ECSInstanceType - ECSImageId - ECSDiskCategory - ECSSysDiskSize - Count - ECSPassword - KeyPairName Label: default: ECS <br/><br/><br/><br/>

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Locals": {
    "DS_Eip1": {
      "Type": "DATASOURCE::EIP::Address",
      "Properties": {
        "AllocationId": {
          "Ref": "EipId1"
        }
      }
    },
    "HasEip1": {
      "Type": "Eval",
      "Value": {
        "Fn::Not": {
          "Fn::Equals": [
            {
              "Fn::Length": {
                "Ref": "DS_Eip1"
              }
            },
            0
          ]
        }
      }
    },
    "DS_Eip2": {
      "Type": "DATASOURCE::EIP::Address",
      "Properties": {
        "AllocationId": {
          "Ref": "EipId2"
        }
      }
    },
    "HasEip2": {
      "Type": "Eval",
      "Value": {
        "Fn::Not": {
          "Fn::Equals": [
            {
              "Fn::Length": {
                "Ref": "DS_Eip2"
              }
            },
            0
          ]
        }
      }
    },
    "DS_Eip3": {
      "Type": "DATASOURCE::EIP::Address",
      "Properties": {
        "AllocationId": {
          "Ref": "EipId3"
        }
      }
    },
    "HasEip3": {
      "Type": "Eval",
      "Value": {
        "Fn::Not": {
          "Fn::Equals": [
            {
              "Fn::Length": {
                "Ref": "DS_Eip3"
              }
            },
            0
          ]
        }
      }
    }
  },
  "Parameters": {
    "EcsCondition": {
      "Type": "String",
      "Label": {
        "en": "Create an ECS instance, EIP, and ENI",
        "ja": "ECS インスタンス、EIP、ENI を作成"
      },
      "AllowedValues": [
        "既存の ECS インスタンス、EIP、ENI を使用",
        "新しい ECS インスタンス、EIP、ENI を作成"
      ],
      "Default": "既存の ECS インスタンス、EIP、ENI を使用"
    },
    "EcsInstanceId": {
      "Type": "String",
      "Default": null,
      "Label": {
        "en": "ECS Instance ID",
        "ja": "ECS インスタンス ID"
      },
      "AssociationProperty": "ALIYUN::ECS::Instance::InstanceId",
      "AssociationPropertyMetadata": {
        "Visible": {
          "Condition": {
            "Fn::Not": {
              "Fn::Equals": [
                "${EcsCondition}",
                "新しい ECS インスタンス、EIP、ENI を作成"
              ]
            }
          }
        }
      }
    },
    "ECSNetworkInterfaceId": {
      "Type": "String",
      "Default": null,
      "Label": {
        "en": "ECS Network Interface ID",
        "ja": "ECS ネットワークインターフェイス ID"
      },
      "AssociationPropertyMetadata": {
        "Visible": {
          "Condition": {
            "Fn::Not": {
              "Fn::Equals": [
                "${EcsCondition}",
                "新しい ECS インスタンス、EIP、ENI を作成"
              ]
            }
          }
        }
      }
    },
    "EipId1": {
      "Type": "String",
      "Default": null,
      "AssociationProperty": "ALIYUN::VPC::EIP::AllocationId",
      "Label": {
        "en": "EIP 1 Instance ID",
        "ja": "EIP 1 インスタンス ID"
      },
      "AssociationPropertyMetadata": {
        "Visible": {
          "Condition": {
            "Fn::Not": {
              "Fn::Equals": [
                "${EcsCondition}",
                "新しい ECS インスタンス、EIP、ENI を作成"
              ]
            }
          }
        }
      }
    },
    "EipId2": {
      "Type": "String",
      "Default": null,
      "AssociationProperty": "ALIYUN::VPC::EIP::AllocationId",
      "Label": {
        "en": "EIP 2 Instance ID",
        "ja": "EIP 2 インスタンス ID"
      },
      "AssociationPropertyMetadata": {
        "Visible": {
          "Condition": {
            "Fn::Not": {
              "Fn::Equals": [
                "${EcsCondition}",
                "新しい ECS インスタンス、EIP、ENI を作成"
              ]
            }
          }
        }
      }
    },
    "EipId3": {
      "Type": "String",
      "Default": null,
      "AssociationProperty": "ALIYUN::VPC::EIP::AllocationId",
      "Label": {
        "en": "EIP 3 Instance ID",
        "ja": "EIP 3 インスタンス ID"
      },
      "AssociationPropertyMetadata": {
        "Visible": {
          "Condition": {
            "Fn::Not": {
              "Fn::Equals": [
                "${EcsCondition}",
                "新しい ECS インスタンス、EIP、ENI を作成"
              ]
            }
          }
        }
      }
    },
    "SystemDiskCategory": {
      "Default": null,
      "AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
      "AssociationPropertyMetadata": {
        "InstanceType": "${InstanceType}",
        "ZoneId": "${ZoneId}",
        "Visible": {
          "Condition": {
            "Fn::Not": {
              "Fn::Equals": [
                "${EcsCondition}",
                "既存の ECS インスタンス、EIP、ENI を使用"
              ]
            }
          }
        }
      },
      "Type": "String",
      "Description": {
        "en": "<font color='blue'>Available values:</font>
[cloud_efficiency: <font color='green'>Ultra disk</font>]<br>[cloud_ssd: <font color='green'>Standard SSD</font>]<br>[cloud_essd: <font color='green'>ESSD</font>]<br>[cloud: <font color='green'>Basic disk</font>]<br>[ephemeral_ssd: <font color='green'>Local SSD</font>]", "ja": "<font color='blue'><b>選択可能な値:</font><br/>[cloud_efficiency: <font color='green'>高性能クラウドディスク</font>]<br>[cloud_ssd: <font color='green'>標準 SSD</font>]<br>[cloud_essd: <font color='green'>ESSD</font>]<br>[cloud: <font color='green'>ベーシックディスク</font>]<br>[ephemeral_ssd: <font color='green'>ローカル SSD</font>]" }, "Label": { "en": "System Disk Category", "ja": "システムディスクカテゴリ" } }, "InstancePassword": { "ConstraintDescription": { "en": "The password must be 8 to 30 characters long and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include the following: ()`~!@#$%^&*_-+=|{}[]:;' <>,.?/", "ja": "パスワードは 8~30 文字で、次の文字タイプのうち、少なくとも 3 種類を含める必要があります: 大文字、小文字、数字、特殊文字。特殊文字には、()`~!@#$%^&*_-+=|{}[]:;' <>,.?/ が含まれます。" }, "Description": { "en": "The logon password for the instance. The password must be 8 to 30 characters long and contain at least three of the following character types: uppercase letters, lowercase letters, and digits. <br> Special characters include the following: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/", "ja": "インスタンスのログインパスワード。パスワードは 8~30 文字で、次の文字タイプのうち、少なくとも 3 種類を含める必要があります: 大文字、小文字、数字。<br> 特殊文字には、()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ が含まれます。" }, "MinLength": "8", "Label": { "en": "Instance Password", "ja": "インスタンスのパスワード" }, "AllowedPattern": "[0-9A-Za-z\\_\\-&:;'<>,=%`~!@#\\(\\)\\$\\^\\*\\+\\|\\{\\}\\[\\]\\.\\?\\/]+$", "NoEcho": true, "Default": null, "MaxLength": "30", "Type": "String", "AssociationPropertyMetadata": { "Visible": { "Condition": { "Fn::Not": { "Fn::Equals": [ "${EcsCondition}", "既存の ECS インスタンス、EIP、ENI を使用" ] } } } } }, "InstanceType": { "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType", "AssociationPropertyMetadata": { "ZoneId": "${ZoneId}", "Visible": { "Condition": { "Fn::Not": { "Fn::Equals": [ "${EcsCondition}", "既存の ECS インスタンス、EIP、ENI を使用" ] } } } }, "Type": "String", "Default": null, "Label": { "en": "Instance Type", "ja": "インスタンスタイプ" } }, "ZoneId": { "Default": null, "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId", "Type": "String", "Description": { "en": "The ID of the zone.<br><b>Note: <font color='blue'>Before you select a zone, confirm that it supports the instance type for the ECS resources you want to create.</font>", "ja": "ゾーンの ID。<br><b>注: <font color='blue'>ゾーンを選択する前に、作成する ECS リソースのインスタンスタイプをそのゾーンがサポートしていることを確認してください。</font>" }, "Label": { "en": "Zone ID", "ja": "ゾーン ID" }, "AssociationPropertyMetadata": { "Visible": { "Condition": { "Fn::Not": { "Fn::Equals": [ "${EcsCondition}", "既存の ECS インスタンス、EIP、ENI を使用" ] } } } } } }, "Resources": { "DS_Instances": { "Condition": "HasEcs", "Type": "DATASOURCE::ECS::Instances", "Properties": { "InstanceIds": [ { "Ref": "EcsInstanceId" } ] } }, "DS_NetworkInterfaces": { "Condition": "HasEcs", "Type": "DATASOURCE::ECS::NetworkInterfaces", "Properties": { "NetworkInterfaceIds": [ { "Ref": "ECSNetworkInterfaceId" } ] } }, "AssignPrivateIpAddresses": { "Type": "ALIYUN::ECS::AssignPrivateIpAddresses", "Properties": { "NetworkInterfaceId": { "Fn::If": [ "CreateEcs", { "Fn::GetAtt": [ "EcsENI", "NetworkInterfaceId" ] }, { "Ref": "ECSNetworkInterfaceId" } ] }, "SecondaryPrivateIpAddressCount": 2 } }, "EipAssociationPrimaryPrivateIp": { "DependsOn": [ "AssignPrivateIpAddresses" ], "Type": "ALIYUN::VPC::EIPAssociation", "Condition": "EipAssociation1", "Properties": { "InstanceId": { "Fn::If": [ "CreateEcs", { "Fn::GetAtt": [ "EcsENI", "NetworkInterfaceId" ] }, { "Ref": "ECSNetworkInterfaceId" } ] }, "AllocationId": { "Fn::If": [ "CreateEcs", { "Fn::GetAtt": [ "Eip1", "AllocationId" ] }, { "Ref": "EipId1" } ] }, "PrivateIpAddress": { "Fn::If": [ "CreateEcs", { "Fn::GetAtt": [ "EcsENI", "PrivateIpAddress" ] }, { "Fn::Jq": [ "First", ".[0].PrivateIpAddress", { "Fn::GetAtt": [ "DS_NetworkInterfaces", "NetworkInterfaces" ] } ] } ] }, "Mode": "NAT" } }, "EipAssociationSecondaryPrivateIp1": { "Type": "ALIYUN::VPC::EIPAssociation", "Condition": "EipAssociation2", "DependsOn": [ "EipAssociationPrimaryPrivateIp" ], "Properties": { "InstanceId": { "Fn::If": [ "CreateEcs", { "Fn::GetAtt": [ "EcsENI", "NetworkInterfaceId" ] }, { "Ref": "ECSNetworkInterfaceId" } ] }, "AllocationId": { "Fn::If": [ "CreateEcs", { "Fn::GetAtt": [ "Eip2", "AllocationId" ] }, { "Ref": "EipId2" } ] }, "PrivateIpAddress": { "Fn::Select": [ "0", { "Fn::GetAtt": [ "AssignPrivateIpAddresses", "PrivateIpAddresses" ] } ] }, "Mode": "NAT" } }, "EipAssociationSecondaryPrivateIp2": { "DependsOn": [ "EipAssociationSecondaryPrivateIp1" ], "Condition": "EipAssociation3", "Type": "ALIYUN::VPC::EIPAssociation", "Properties": { "InstanceId": { "Fn::If": [ "CreateEcs", { "Fn::GetAtt": [ "EcsENI", "NetworkInterfaceId" ] }, { "Ref": "ECSNetworkInterfaceId" } ] }, "AllocationId": { "Fn::If": [ "CreateEcs", { "Fn::GetAtt": [ "Eip3", "AllocationId" ] }, { "Ref": "EipId3" } ] }, "PrivateIpAddress": { "Fn::Select": [ "1", { "Fn::GetAtt": [ "AssignPrivateIpAddresses", "PrivateIpAddresses" ] } ] }, "Mode": "NAT" } }, "EcsEniAttachment": { "DependsOn": [ "EipAssociationPrimaryPrivateIp", "EipAssociationSecondaryPrivateIp1", "EipAssociationSecondaryPrivateIp2" ], "Type": "ALIYUN::ECS::NetworkInterfaceAttachment", "Properties": { "InstanceId": { "Fn::If": [ "CreateEcs", { "Fn::GetAtt": [ "EcsInstance", "InstanceId" ] }, { "Ref": "EcsInstanceId" } ] }, "NetworkInterfaceId": { "Fn::If": [ "CreateEcs", { "Fn::GetAtt": [ "EcsENI", "NetworkInterfaceId" ] }, { "Ref": "ECSNetworkInterfaceId" } ] } } }, "WaitConditionHandle": { "Type": "ALIYUN::ROS::WaitConditionHandle", "Properties": {} }, "WaitCondition": { "Type": "ALIYUN::ROS::WaitCondition", "Properties": { "Handle": { "Ref": "WaitConditionHandle" }, "Timeout": 3720, "Count": 1 } }, "InitEcsEni": { "Type": "ALIYUN::ECS::RunCommand", "Properties": { "InstanceIds": [ { "Fn::If": [ "CreateEcs", { "Fn::GetAtt": [ "EcsInstance", "InstanceId" ] }, { "Ref": "EcsInstanceId" } ] } ], "Type": "RunShellScript", "Sync": true, "Timeout": 3600, "CommandContent": { "Fn::Sub": [ "#!/bin/bash\nif [ ! -f .ros.provision ]; then\n echo \"Name: Attach multiple EIPs to an ECS instance in NAT mode (CentOS 7)\" > .ros.provision\nfi\nname=$(grep \"^Name:\" .ros.provision | awk -F':' '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')\nif [[ \"$name\" != \"Attach multiple EIPs to an ECS instance in NAT mode (CentOS 7)\" ]]; then\n echo \"このインスタンスは、\\\"$name\\\" チュートリアルのワンクリック設定を使用してすでに設定されています。このチュートリアルのワンクリック設定を再度適用することはできません。\"\n ${WaitConditionHandle.CurlCli} --data-binary \"{\\\"status\\\": \\\"FAILURE\\\", \\\"reason\\\": \\\"このインスタンスは、\\\\\\\"$name\\\\\\\" チュートリアルを使用してすでに設定されています。このチュートリアルの設定を再度適用することはできません。\\\"}\"\n exit 0\nfi\nsecondary_eni=`ip address show | grep eth | grep DOWN | awk -F: '{print $2}'`\nsecondary_eni_name=`eval echo \"$secondary_eni\"`\nif [[ \"$secondary_eni_name\" != \"\" ]]; then\n echo \"#########################\"\n echo \"# セカンダリ ENI は完全には設定されていません\"\n echo \"#########################\"\n secondary_eni_mac=`cat /sys/class/net/\"$secondary_eni_name\"/address`\n echo \"DEVICE=$secondary_eni_name\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\"\n echo \"BOOTPROTO=dhcp\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\"\n echo \"ONBOOT=yes\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\"\n echo \"TYPE=Ethernet\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\"\n echo \"USERCTL=yes\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\"\n echo \"PEERDNS=no\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\"\n echo \"IPV6INIT=no\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\"\n echo \"PERSISTENT_DHCLIENT=yes\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\"\n echo \"HWADDR=$secondary_eni_mac\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\"\n echo \"DEFROUTE=no\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\"\n systemctl restart network\nelse\n echo \"#########################\"\n echo \"# セカンダリ ENI は設定済みです\"\n echo \"#########################\"\nfi\nnetmask_address=`ifconfig \"$secondary_eni_name\"| grep netmask | awk '{print $4}'`\necho \"DEVICE=$secondary_eni_name:0\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\":0\necho \"TYPE=Ethernet\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\":0\necho \"BOOTPROTO=static\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\":0\necho \"ONBOOT=yes\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\":0\necho \"IPADDR=${PrivateIpAddresses1}\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\":0\necho \"NETMASK=$netmask_address\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\":0\necho \"DEVICE=$secondary_eni_name:1\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\":1\necho \"TYPE=Ethernet\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\":1\necho \"BOOTPROTO=static\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\":1\necho \"ONBOOT=yes\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\":1\necho \"IPADDR=${PrivateIpAddresses2}\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\":1\necho \"NETMASK=$netmask_address\" >> /etc/sysconfig/network-scripts/ifcfg-\"$secondary_eni_name\":1\nsystemctl restart network\necho \"# セカンダリ ENI の PrivateIpAddresses は設定済みです\"\n${WaitConditionHandle.CurlCli} --data-binary '{\"status\": \"SUCCESS\"}'\n", { "PrivateIpAddresses1": { "Fn::Select": [ "0", { "Fn::GetAtt": [ "AssignPrivateIpAddresses", "PrivateIpAddresses" ] } ] }, "PrivateIpAddresses2": { "Fn::Select": [ "1", { "Fn::GetAtt": [ "AssignPrivateIpAddresses", "PrivateIpAddresses" ] } ] } } ] } }, "DependsOn": [ "EcsEniAttachment" ] }, "EcsVpc": { "Condition": "CreateEcs", "Type": "ALIYUN::ECS::VPC", "Properties": { "CidrBlock": "192.168.0.0/16" } }, "EcsVSwitch": { "Type": "ALIYUN::ECS::VSwitch", "Condition": "CreateEcs", "Properties": { "VpcId": { "Ref": "EcsVpc" }, "CidrBlock": "192.168.1.0/24", "ZoneId": { "Ref": "ZoneId" } } }, "EcsSecurityGroup": { "Condition": "CreateEcs", "Type": "ALIYUN::ECS::SecurityGroup", "Properties": { "VpcId": { "Ref": "EcsVpc" } } }, "EcsInstance": { "Condition": "CreateEcs", "Type": "ALIYUN::ECS::Instance", "Properties": { "SystemDiskCategory": { "Ref": "SystemDiskCategory" }, "VpcId": { "Fn::GetAtt": [ "EcsVpc", "VpcId" ] }, "AllocatePublicIP": false, "SecurityGroupId": { "Ref": "EcsSecurityGroup" }, "ImageId": "centos_7", "VSwitchId": { "Ref": "EcsVSwitch" }, "Password": { "Ref": "InstancePassword" }, "InstanceType": { "Ref": "InstanceType" } } }, "EcsENI": { "Condition": "CreateEcs", "Type": "ALIYUN::ECS::NetworkInterface", "Properties": { "VSwitchId": { "Ref": "EcsVSwitch" }, "SecurityGroupId": { "Ref": "EcsSecurityGroup" } } }, "Eip1": { "Condition": "CreateEcs", "Type": "ALIYUN::VPC::EIP", "Properties": { "InstanceChargeType": "Postpaid", "InternetChargeType": "PayByTraffic" } }, "Eip2": { "Condition": "CreateEcs", "Type": "ALIYUN::VPC::EIP", "Properties": { "InstanceChargeType": "Postpaid", "InternetChargeType": "PayByTraffic" } }, "Eip3": { "Condition": "CreateEcs", "Type": "ALIYUN::VPC::EIP", "Properties": { "InstanceChargeType": "Postpaid", "InternetChargeType": "PayByTraffic" } } }, "Outputs": {}, "Metadata": { "ALIYUN::ROS::Interface": { "ParameterGroups": [ { "Parameters": [ "EcsCondition", "EcsInstanceId", "ZoneId", "InstanceType", "SystemDiskCategory", "InstancePassword", "ECSNetworkInterfaceId", "EipId1", "EipId2", "EipId3" ] } ] } }, "Conditions": { "CreateEcs": { "Fn::Equals": [ "新しい ECS インスタンス、EIP、ENI を作成", { "Ref": "EcsCondition" } ] }, "HasEcs": { "Fn::Equals": [ "既存の ECS インスタンス、EIP、ENI を使用", { "Ref": "EcsCondition" } ] }, "HasEip1": { "Ref": "HasEip1" }, "HasEip2": { "Ref": "HasEip2" }, "HasEip3": { "Ref": "HasEip3" }, "EipAssociation1": { "Fn::Or": [ "CreateEcs", "HasEip1" ] }, "EipAssociation2": { "Fn::Or": [ "CreateEcs", "HasEip2" ] }, "EipAssociation3": { "Fn::Or": [ "CreateEcs", "HasEip3" ] } }, "Description": { "en": "Attach multiple EIPs to a CentOS 7 ECS instance using a secondary ENI.", "ja": "セカンダリ ENI を使用して、複数の EIP を CentOS 7 ECS インスタンスにアタッチします。" } }<br/>

その他の例については、「このリソースを含むパブリックテンプレート」をご参照ください。