全部產品
Search
文件中心

Resource Orchestration Service:ALIYUN::ECS::InstanceGroup

更新時間:Feb 06, 2026

ALIYUN::ECS::InstanceGroup類型用於建立一組相同配置的ECS執行個體。

文法

{
  "Type": "ALIYUN::ECS::InstanceGroup",
  "Properties": {
    "DedicatedHostId": String,
    "ResourceGroupId": String,
    "SystemDiskDescription": String,
    "InstanceChargeType": String,
    "RamRoleName": String,
    "SystemDiskPerformanceLevel": String,
    "ImageId": String,
    "SystemDiskDiskName": String,
    "Tags": List,
    "HostName": String,
    "LaunchTemplateName": String,
    "VSwitchId": String,
    "Period": Number,
    "ZoneIds": List,
    "LaunchTemplateId": String,
    "DeletionProtection": Boolean,
    "SecurityGroupIds": List,
    "SecurityEnhancementStrategy": String,
    "InternetChargeType": String,
    "InstanceName": String,
    "DeploymentSetId": String,
    "SubscriptionDeletionForce": Boolean,
    "InternetMaxBandwidthOut": Integer,
    "VpcId": String,
    "LaunchTemplateVersion": String,
    "PeriodUnit": String,
    "AutoReleaseTime": String,
    "PrivateIpAddress": String,
    "Description": String,
    "DiskMappings": List,
    "SystemDiskSize": Number,
    "UserData": String,
    "AutoRenew": String,
    "Ipv6Addresses": List,
    "MaxAmount": Integer,
    "SystemDiskAutoSnapshotPolicyId": String,
    "Ipv6AddressCount": Integer,
    "NetworkType": String,
    "SpotPriceLimit": String,
    "InstanceType": String,
    "AllocatePublicIP": Boolean,
    "SpotStrategy": String,
    "Password": String,
    "PasswordInherit": Boolean,
    "AutoRenewPeriod": Number,
    "KeyPairName": String,
    "IoOptimized": String,
    "ZoneId": String,
    "HpcClusterId": String,
    "SecurityGroupId": String,
    "SystemDiskCategory": String,
    "EniMappings": List,
    "SystemDiskProvisionedIops": Integer,
    "SystemDiskBurstingEnabled": Boolean,
    "SpotInterruptionBehavior": String,
    "SpotDuration": Integer,
    "UpdatePolicy": String,
    "SystemDiskEncrypted": String,
    "SystemDiskEncryptAlgorithm": String,
    "SystemDiskStorageClusterId": String,
    "SystemDiskKMSKeyId": String,
    "CreditSpecification": String,
    "PrivatePoolOptions": Map,
    "StorageSetId": String,
    "HttpTokens": String,
    "HttpEndpoint": String,
    "Tenancy": String,
    "StorageSetPartitionNumber": Integer,
    "DeploymentSetGroupNo": Integer,
    "Affinity": String,
    "UseAdditionalService": Boolean,
    "ImageFamily": String,
    "DeletionForce": Boolean,
    "UniqueSuffix": Boolean,
    "NetworkOptions": Map,
    "CpuOptions": Map,
    "NetworkInterfaceQueueNumber": Integer,
    "HostNames": List,
    "ImageOptions": Map,
    "SecurityOptions": Map,
    "SchedulerOptions": Map
  }
}

屬性

屬性名稱

類型

必須

允許更新

描述

約束

InstanceType

String

ECS執行個體規格。

更多資訊,請參見執行個體規格類型系列

說明

當UpdatePolicy取值為ForAllInstances時,才會對已有執行個體進行更新,否則更新該參數只針對新增執行個體生效。

MaxAmount

Integer

一次性建立ECS執行個體的個數。

取值範圍:1~1000。

說明

當更新資源棧時,如果MaxAmount取值增加(或減少),將新增(或減少)對應數量的ECS執行個體。例如:MaxAmount取值從2增加到5,將新增3個ECS執行個體。

AllocatePublicIP

Boolean

是否建立公網IP。

如果InternetMaxBandwidthOut為0,則不會建立公網IP。

取值:

  • true(預設值):建立公網IP。

  • false:不建立公網IP。

AutoReleaseTime

String

ECS執行個體自動釋放的時間。

時間格式必須遵守ISO8601規範,例如"yyyy-MM-ddTHH:mm:ssZ"。釋放時間不能超過三年。

AutoRenew

String

是否自動續約。

當InstanceChargeType為PrePaid時,該參數生效。

取值:

  • True:自動續約。

  • False(預設值):不自動續約。

說明

更新該參數僅對新增ECS執行個體生效。

AutoRenewPeriod

Number

每次自動續約的時間長度。

當AutoRenew為True時,該參數為必填參數。

取值:

  • 1(預設值)

  • 2

  • 3

  • 6

  • 12

說明

更新該參數僅對新增ECS執行個體生效。

DedicatedHostId

String

Dedicated HostID。

DeletionProtection

Boolean

執行個體釋放保護屬性,指定是否支援通過控制台或DeleteInstance介面釋放執行個體。

取值:

  • true:支援。

  • false:不支援。

DeploymentSetId

String

部署集ID。

更新該參數僅對新增ECS執行個體生效。

Description

String

描述資訊。

最長256個字元。

說明

更新該參數僅對新增ECS執行個體生效。

DiskMappings

List

為ECS執行個體建立的資料盤。

最多建立16塊資料盤。

修改該參數,不會影響已建立的執行個體,新建立的執行個體會使用修改後的值。

更多資訊,請參見DiskMappings屬性

說明

更新該參數僅對新增ECS執行個體生效。

EniMappings

List

附加到執行個體的彈性網卡。

附加到執行個體的彈性網卡個數最多為1個。

更多資訊,請參見EniMappings屬性

HostName

String

主機名稱。

長度最少2個字元。半形句號(.)和短劃線(-)不能作為hostname的首尾字元,且不能連續使用。

更多資訊,請參見請求參數

HpcClusterId

String

執行個體所屬的HPC叢集ID。

更新該參數僅對新增ECS執行個體生效。

ImageId

String

用於啟動ECS執行個體的鏡像ID。包括公用鏡像、自訂鏡像和雲市場鏡像。

支援通過模糊的方式指定公用鏡像ID,而不需要指定一個完整的公用鏡像ID。例如:

  • 指定Ubuntu,最終會匹配ubuntu_16_0402_64_20G_alibase_20170818.vhd。

  • 指定ubuntu1432,最終會匹配ubuntu_14_0405_32_40G_alibase_20170711.vhd。

更多資訊,請參見請求參數

說明

當UpdatePolicy取值為ForAllInstances時,才會對已有執行個體進行更新,否則更新該參數只針對新增執行個體生效。

InstanceChargeType

String

執行個體的付費方式。

取值:

  • PrePaid:預付費,訂用帳戶。

    說明

    當取值為PrePaid時,您必須確認自己的帳號支援餘額支付/信用支付,否則將返回InvalidPayMethod錯誤訊息提示。

  • PostPaid(預設值):隨用隨付。

說明

更新該參數僅對新增ECS執行個體生效。

InstanceName

String

執行個體名稱。

最長為128個字元。可包含英文字母、漢字、數字、底線(_)、半形句號(.)和短劃線(-)。

通過name_prefix[begin_number,bits]name_suffix格式為各個ECS執行個體指定不同的執行個體名。更多資訊,請參見請求參數

InternetChargeType

String

公網訪問頻寬計費方式。

取值:

  • PayByBandwidth:按固定頻寬計費。

  • PayByTraffic(預設值):按流量計費。

說明

當UpdatePolicy取值為ForAllInstances時,才會對已有執行個體進行更新,否則更新該參數只針對新增執行個體生效。

InternetMaxBandwidthOut

Integer

公網出頻寬最大值。

取值範圍:0~100。

單位:Mbps。

預設值:0。

說明

當UpdatePolicy取值為ForAllInstances時,才會對已有執行個體進行更新,否則更新該參數只針對新增執行個體生效。

IoOptimized

String

是否建立I/O最佳化執行個體。

取值:

  • none:非I/O最佳化。

  • optimized(預設值):I/O最佳化。

Ipv6AddressCount

Integer

為彈性網卡指定隨機產生的IPv6地址數量。

不能同時指定Ipv6Addresses和Ipv6AddressCount。

說明

更新該參數僅對新增ECS執行個體生效。

Ipv6Addresses

List

為彈性網卡指定IPv6地址。

最多指定一個IPv6地址。更改不影響現有執行個體。不能同時指定Ipv6Addresses和Ipv6AddressCount。

說明

更新該參數僅對新增ECS執行個體生效。

KeyPairName

String

ECS執行個體綁定的金鑰組名稱。

如果是Windows ECS執行個體,則忽略該參數。預設為空白。

如果已填寫KeyPairName,Password的內容仍會被設定到執行個體中,但是Linux系統中的密碼登入方式會被禁止。

說明

更新該參數僅對新增ECS執行個體生效。

LaunchTemplateId

String

啟動模板ID。

LaunchTemplateName

String

啟動模板名稱。

LaunchTemplateVersion

String

啟動模板的版本。

如果沒有指定版本,則使用預設版本。

NetworkType

String

ECS執行個體網路類型。

取值:

  • vpc:專用網路。

  • classic(預設值):傳統網路。

Password

String

ECS執行個體登入密碼。

長度為8~30個字元。必須同時包含大寫英文字母、小寫英文字母、數字和特殊字元其中三項,支援的特殊字元為::( ) ` ~ ! @ # $ % ^ & * - + = | { } [ ] : ; ‘ < > , . ? /

如果指定Password參數,請使用HTTPS協議調用API,以免發生密碼泄露。

說明

當UpdatePolicy取值為ForAllInstances時,才會對已有執行個體進行更新,否則更新該參數只針對新增執行個體生效。

PasswordInherit

Boolean

是否使用鏡像預設的密碼。

取值:

  • true:使用鏡像預設的密碼。

  • false:不使用鏡像預設的密碼。

說明

使用該參數時,Password參數必須為空白,同時您需要確保使用的鏡像已經設定了密碼。

Period

Number

購買資源的時間長度。

當InstanceChargeType為PrePaid時,該參數生效且為必選參數。

一旦指定了DedicatedHostId,則取值不能超過Dedicated Host的訂閱時間長度。

  • 當PeriodUnit為Week時,Period取值:1~4。

  • 當PeriodUnit為Month時,Period取值:1~9、12、24、36、48、60。

說明

更新該參數僅對新增ECS執行個體生效。

PeriodUnit

String

購買資源的時間長度周期。

取值:

  • Week:周。

  • Month(預設值):月。

說明

更新該參數僅對新增ECS執行個體生效。

PrivateIpAddress

String

執行個體私網IP地址。

專用網路類型ECS執行個體設定私網IP地址時,必須從交換器的空閑網段中選擇。

說明

如果設定PrivateIpAddress,MaxAmount取值只能為1。

RamRoleName

String

執行個體RAM角色名稱。

您可以調用ListRoles查詢執行個體RAM角色名稱。

ResourceGroupId

String

執行個體所在的資源群組ID。

SecurityEnhancementStrategy

String

是否啟用安全強化。

取值:

  • Active:啟用安全強化,只對公用鏡像生效。

  • Deactive:禁用安全強化,對所有鏡像類型生效。

SecurityGroupId

String

新建立執行個體所屬的安全性群組ID,同一個安全性群組內的執行個體之間可以互相訪問。

不支援同時指定SecurityGroupId和SecurityGroupIds。

SecurityGroupIds

List

新建立執行個體所屬的安全性群組ID列表。

不支援同時指定SecurityGroupId和SecurityGroupIds。

更多資訊,請參見安全性群組

SpotDuration

Integer

搶佔式執行個體的保留時間長度。

取值範圍:0~6。

單位:小時。

取值:

  • 0:無保護期模式。

  • 2~6:正在邀測中,如需開通請提交工單。

  • 1(預設值)。

SpotInterruptionBehavior

String

搶佔執行個體中斷模式。

目前僅支援Terminate(預設)直接釋放執行個體。

SpotPriceLimit

String

執行個體的每小時最高價格。

最大支援3位小數。當SpotStrategy為SpotWithPriceLimit時,該參數生效。

SpotStrategy

String

後付費執行個體的競價策略。

當InstanceChargeType為PostPaid時,該參數生效。

取值:

  • NoSpot(預設值):正常隨用隨付執行個體。

  • SpotWithPriceLimit:設定上限價格的競價執行個體。

  • SpotAsPriceGo:系統自動出價,最高隨用隨付價格。

SystemDiskAutoSnapshotPolicyId

String

系統硬碟自動快照策略ID。

SystemDiskBurstingEnabled

Boolean

系統硬碟是否啟用突發。

取值:

  • true:啟用突發。

  • false(預設值):禁用突發。

SystemDiskCategory

String

系統硬碟類型。

取值:

  • cloud:普通雲端硬碟。

  • cloud_efficiency:高效雲端硬碟。

  • cloud_ssd:SSD雲端硬碟。

  • cloud_essd:ESSD雲端硬碟。

  • ephemeral_ssd:本地SSD盤。

說明

當UpdatePolicy取值為ForAllInstances時,才會對已有執行個體進行更新,否則更新該參數只針對新增執行個體生效。

SystemDiskDescription

String

系統硬碟描述資訊。

更新該參數僅對新增ECS執行個體生效。

SystemDiskDiskName

String

系統硬碟名稱。

更新該參數僅對新增ECS執行個體生效。

SystemDiskPerformanceLevel

String

建立ESSD雲端硬碟作為系統硬碟使用時,設定雲端硬碟的效能等級。

取值:

  • PL0:單盤最高隨機讀寫IOPS為1萬。

  • PL1(預設值):單盤最高隨機讀寫IOPS為5萬。

  • PL2:單盤最高隨機讀寫IOPS為10萬。

  • PL3:單盤最高隨機讀寫IOPS為100萬。

關於如何選擇ESSD效能等級,請參見ESSD雲端硬碟

SystemDiskProvisionedIops

Integer

系統硬碟預配的IOPS。

SystemDiskSize

Number

系統硬碟大小。

取值範圍:40~500。

單位:GB。

如果使用自訂鏡像建立系統硬碟,需要保證系統硬碟大於自訂鏡像大小。

說明

當UpdatePolicy取值為ForAllInstances時,才會對已有執行個體進行更新,否則更新該參數只針對新增執行個體生效。

Tags

List

使用者自訂標籤。

最多支援20個標籤,格式:[{"Key":"tagKey","Value":"tagValue"},{"Key":"tagKey2","Value":"tagValue2"}]

更多資訊,請參見Tags屬性

UpdatePolicy

String

指定更新時的策略。

取值:

  • ForNewInstance(預設值):更新策略針對新增執行個體生效。

  • ForAllInstances:更新策略針對所有執行個體生效。

UserData

String

建立ECS執行個體時傳遞的使用者資料。

內容需要限制在16KB以內。無需用Base64轉碼,特殊字元需要使用轉義符。

說明

當UpdatePolicy取值為ForAllInstances時,才會對已有執行個體進行更新,否則更新該參數只針對新增執行個體生效。

VSwitchId

String

交換器ID。

VpcId

String

專用網路ID。

ZoneId

String

可用性區域ID。

ZoneIds

List

可用性區域列表。

DiskMappings文法

"DiskMappings": [
  {
    "Category": String,
    "DiskName": String,
    "Description": String,
    "Device": String,
    "SnapshotId": String,
    "Size": String,
    "Encrypted": String,
    "KMSKeyId": String,
    "PerformanceLevel": String,
    "AutoSnapshotPolicyId": String,
    "ProvisionedIops": Integer,
    "BurstingEnabled": Boolean,
    "StorageClusterId": String
  }
]

DiskMappings屬性

屬性名稱

類型

必須

允許更新

描述

約束

Size

String

資料盤大小。

單位:GB。

Category

String

資料盤的類型。

取值:

  • cloud:雲端硬碟。

  • cloud_efficiency:高效雲端硬碟。

  • cloud_ssd:SSD雲端硬碟。

  • cloud_essd:ESSD盤。

  • ephemeral_ssd:本地SSD盤。

對於I/O最佳化執行個體,預設值為cloud_efficiency。

對於非I/O最佳化執行個體,預設值為cloud。

DiskName

String

資料盤的名稱。

長度為2~128個字元。必須以英文字母或漢字開頭,不能以http://https://開頭。可包含英文字母、漢字、數字、底線(_)、半形冒號(:)和短劃線(-)。

Description

String

資料盤的描述。

長度為2~256個字元。不能以http://https://開頭。

Device

String

掛載點。

SnapshotId

String

快照ID。

Encrypted

String

資料盤是否加密。

取值:

  • true:加密。

  • false(預設值):不加密。

KMSKeyId

String

資料盤對應的KMS密鑰ID。

AutoSnapshotPolicyId

String

自動快照策略ID。

PerformanceLevel

String

建立ESSD雲端硬碟作為資料盤使用時,設定雲端硬碟的效能等級。

取值:

  • PL0:單盤最高隨機讀寫IOPS為1萬。

  • PL1(預設值):單盤最高隨機讀寫IOPS為5萬。

  • PL2:單盤最高隨機讀寫IOPS為10萬。

  • PL3:單盤最高隨機讀寫IOPS為100萬。

關於如何選擇ESSD效能等級,請參見ESSD雲端硬碟

ProvisionedIops

Integer

預配的IOPS。

BurstingEnabled

Boolean

是否啟用突發。

取值:

  • true:啟用。

  • false(預設值):禁用。

StorageClusterId

String

專屬Block Storage叢集ID。

Tags文法

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

Tags屬性

屬性名稱

類型

必須

允許更新

描述

約束

Key

String

標籤鍵。

長度為1~128個字元,不能以aliyunacs:開頭,不能包含http://https://

Value

String

標籤值。

長度為0~128個字元,不能以aliyunacs:開頭,不能包含http://https://

EniMappings文法

"EniMappings": [
  {
    "SecurityGroupId": String,
    "VSwitchId": String,
    "Description": String,
    "NetworkInterfaceName": String,
    "PrimaryIpAddress": String,
    "InstanceType": String,
    "Ipv6AddressCount": Integer,
    "NetworkInterfaceTrafficMode": String,
    "Ipv6Addresses": List,
    "QueueNumber": Integer,
    "SecurityGroupIds": List,
    "NetworkInterfaceId": String,
    "DeleteOnRelease": Boolean,
    "NetworkCardIndex": Integer,
    "QueuePairNumber": Integer
  }
]

EniMappings屬性

屬性名稱

類型

必須

允許更新

描述

約束

SecurityGroupId

String

安全性群組ID。

所屬的安全性群組ID必須是同一個專用網路下的安全性群組。

VSwitchId

String

交換器ID。

Description

String

彈性網卡的描述資訊。

長度為2~256個字元,不能以http://https://開頭。

NetworkInterfaceName

String

彈性網卡名稱。

長度為2~128個字元。必須以英文字母或漢字開頭,不能以http://https://開頭。可包含英文字母、漢字、數字、半形冒號(:)、底線(_)和短劃線(-)。

PrimaryIpAddress

String

彈性網卡的主私人IP地址。

指定的IP必須是在所屬交換器的位址區段內的空閑地址。

如果不指定IP,則預設隨機分配該交換器中的空閑地址。

InstanceType

String

彈性網卡類型。

最多設定2個網卡,設定1個彈性網卡時,支援設定1個主網卡或1個輔助網卡;設定2個彈性網卡時,僅支援同時設定1個主網卡和1個輔助網卡。

取值:

  • Primary:主網卡。

  • Secondary(預設值):輔助網卡。

Ipv6AddressCount

Integer

為主網卡指定隨機產生的IPv6地址數量。

取值範圍:1~10。

注意事項:

  • NetworkInterface.InstanceType取值為Primary時,設定該參數才會生效。如果NetworkInterface.InstanceType取值為Secondary或空值,則不能設定該參數。

  • 設定該參數後,您不能再設定Ipv6AddressCountIpv6AddressNetworkInterface.Ipv6Address

NetworkInterfaceTrafficMode

String

網卡的通訊模式。

取值:

  • Standard(預設值):使用TCP通訊模式。

  • HighPerformance:開啟ERI(Elastic RDMA Interface)介面,使用RDMA通訊模式。

說明

RDMA模式的彈性網卡數量不能超過該執行個體規格類型系列的限制。更多資訊,請參見執行個體規格類型系列

Ipv6Addresses

List

為主網卡指定一個或多個IPv6地址。

支援設定最多10個IPv6地址。

注意事項:

  • NetworkInterface.InstanceType取值為Primary時,設定該參數才會生效。如果NetworkInterface.InstanceType取值為Secondary或空值,則不能設定該參數。

  • 設定該參數後,Amount取值只能為1,且不能再設定Ipv6AddressCountIpv6Address.NNetworkInterface.N.Ipv6AddressCount

QueueNumber

Integer

彈性網卡隊列數。

注意事項:

  • 取值範圍為1~2,設定1個彈性網卡時,支援設定1個主網卡或1個輔助網卡;設定2個彈性網卡時,僅支援同時設定1個主網卡和1個輔助網卡。

  • 不能超過執行個體規格允許的單塊網卡最大隊列數。

  • 執行個體的所有網卡累加隊列數不能超過執行個體規格允許的隊列數總配額。執行個體規格的單塊網卡最大隊列數和總配額可以通過DescribeInstanceTypes介面查詢MaximumQueueNumberPerEniTotalEniQueueQuantity欄位。

  • 如果NetworkInterface.InstanceType取值為Primary,且設定了該參數取值,則不能再設定NetworkInterfaceQueueNumber參數。

SecurityGroupIds

List

彈性網卡所屬的一個或多個安全性群組ID。

注意事項:

  • 如果NetworkInterface.N.InstanceType取值為Primary,則必須設定該參數或NetworkInterface.SecurityGroupId。此時該參數的作用等同於SecurityGroupIds,但需要注意不能再設定SecurityGroupIdSecurityGroupIdsNetworkInterface.SecurityGroupId

  • 如果NetworkInterface.N.InstanceType取值為Secondary或空值,則該參數為非必填參數。預設值為ECS執行個體所屬的安全性群組。

NetworkInterfaceId

String

隨執行個體附加的彈性網卡ID。

該參數只對輔助彈性網卡生效。指定一個現有輔助彈性網卡後,您將無法配置其它網卡建立參數。

DeleteOnRelease

Boolean

釋放執行個體時是否保留網卡

取值:

  • true:不保留。

  • false:保留。

NetworkCardIndex

Integer

網卡指定的物理網卡索引。

  • 只有特定執行個體規格支援指定物理網卡索引。

  • NetworkInterface.N.InstanceType取值為Primary時,對於支援物理網卡的執行個體規格,如果設定此參數,只能設定為 0。

  • NetworkInterface.N.InstanceType取值為Secondary或者空值,對於支援物理網卡的執行個體規格,此參數可以依據執行個體規格設定。更多資訊,請參見執行個體規格類型系列

QueuePairNumber

Integer

RDMA網卡隊列數。

該欄位類型為Long,在序列化/還原序列化的過程中可能導致精度丟失,請注意數值不得大於9007199254740991。

PrivatePoolOptions文法

"PrivatePoolOptions": [
  {
    "Id": String,
    "MatchCriteria": String
  }
]

PrivatePoolOptions屬性

屬性名稱

類型

必須

允許更新

描述

約束

Id

String

私人池ID。即彈性保障服務ID或容量預定服務ID。

MatchCriteria

String

彈性保障服務或容量預定服務在生效後會產生私人池容量,供執行個體啟動時選擇。

取值:

  • Open:開放模式。將自動匹配開放類型的私人池容量。如果沒有合格私人池容量,則使用公用池資源啟動。該模式下無需設定PrivatePoolOptions.Id參數。

  • Target:指定模式。使用指定的私人池容量啟動執行個體,如果該私人池容量不可用,則執行個體會啟動失敗。該模式下必須指定私人池ID,即PrivatePoolOptions.Id參數為必填項。

  • None(預設值):不使用模式。執行個體啟動將不使用私人池容量。

以下任一情境,執行個體啟動的私人池容量選項只能取值None或不傳值。

  • 建立搶佔式執行個體。

  • 建立傳統網路類型的ECS執行個體。

  • 在Dedicated HostDDH上建立ECS執行個體。

NetworkOptions文法

"NetworkOptions": {
  "EnableJumboFrame": Boolean
}

NetworkOptions屬性

屬性名稱

類型

必須

允許更新

描述

約束

EnableJumboFrame

Boolean

執行個體是否開啟Jumbo frame特性。

取值:

  • false:不開啟Jumbo frame,該執行個體下的所有網卡(包括主網卡及輔助網卡)MTU取值為1500。

  • true:開啟Jumbo frame,該執行個體下的所有網卡(包括主網卡及輔助網卡)的MTU取值為8500。

預設值:true。

說明

只有八代以上部分執行個體規格支援開啟Jumbo frame特性。更多資訊請參見巨型幀(Jumbo Frames)

CpuOptions文法

"CpuOptions": {
  "ThreadsPerCore": Integer,
  "Core": Integer
}

CpuOptions屬性

屬性名稱

類型

必須

允許更新

描述

約束

ThreadsPerCore

Integer

CPU線程數。

ECS 執行個體的vCPU 數=CpuOptions.Core取值*CpuOptions.ThreadsPerCore取值。

Core

Integer

CPU核心數。

該參數不支援自訂設定,只能採用預設值。

預設值:請參見更改CPU選項

ImageOptions文法

"ImageOptions": {
  "LoginAsNonRoot": Boolean
}

ImageOptions屬性

屬性名稱

類型

必須

允許更新

描述

約束

LoginAsNonRoot

Boolean

使用該鏡像的執行個體是否支援使用ecs-user使用者登入。

取值:

  • true:是

  • false:否

SecurityOptions文法

"SecurityOptions": {
  "TrustedSystemMode": String
}

SecurityOptions屬性

屬性名稱

類型

必須

允許更新

描述

約束

TrustedSystemMode

String

可信系統模式。

取值:vTPM。目前,可信系統模式支援的執行個體規格類型系列:g7、c7、r7。安全增強型(g7t、c7t、r7t)。當您建立以上執行個體規格類型系列的ECS執行個體時,需要設定該參數。具體說明如下:如果您使用阿里雲可信系統,請將該參數值設定為vTPM,在執行個體啟動時即可通過阿里雲可信系統完成可信校正。如果您不使用阿里雲可信系統,可以不設定該參數值,但您需要注意,如果您所建立的ECS 執行個體使用了Enclave機密計算模式(SecurityOptions.ConfidentialComputingMode=Enclave),則該ECS執行個體也會啟用可信系統。通過OpenAPI建立可信系統的ECS執行個體時,只能調用RunInstances實現,CreateInstance目前不支援設定SecurityOptions.TrustedSystemMode參數。

說明

如果您在建立執行個體的時候指定其為可信執行個體,那麼當您更換系統硬碟時只能使用支援可信系統的鏡像。

關於可信系統的更多資訊,請參見可信計算能力概述

SchedulerOptions文法

"SchedulerOptions": {
  "ManagedPrivateSpaceId": String,
  "DedicatedHostClusterId": String
}

SchedulerOptions屬性

屬性名稱

類型

必須

允許更新

描述

約束

DedicatedHostClusterId

String

指定ECS執行個體所屬的Dedicated Host叢集,系統會自動選擇該Dedicated Host叢集中的一台Dedicated Host部署ECS執行個體。

說明

僅在Tenancy設定為host時生效。

在您同時指定了Dedicated Host(DedicatedHostId)和Dedicated Host叢集(SchedulerOptions.DedicatedHostClusterId)時:

  • 如果Dedicated Host屬於Dedicated Host叢集,則優先將ECS執行個體部署在指定的Dedicated Host上。

  • 如果Dedicated Host不屬於Dedicated Host叢集,則ECS執行個體建立失敗。

您可以通過DescribeDedicatedHostClusters查詢Dedicated Host叢集 ID 列表。

ManagedPrivateSpaceId

String

受管私人資源集區ID。

傳回值

Fn::GetAtt

  • InstanceIds:執行個體ID,訪問執行個體的唯一標識。由系統產生,全域唯一。

  • PrivateIps:VPC類型執行個體的私網IP列表。當NetworkType為vpc時,該參數生效。例如:一個帶有格式的JSON Array:["172.16.XX.XX", "172.16.XX.XX", … "172.16.XX.XX"],最多100個IP,用半形逗號(,)隔開。

  • InnerIps:Classic類型執行個體的私網IP列表。當NetworkType為classic時,該參數生效。例如:一個帶有格式的JSON Array:["10.1.XX.XX", "10.1.XX.XX", …, "10.1.XX.XX"],最多100個IP,用半形逗號(,)隔開。

  • PublicIps:Classic類型執行個體的公網IP列表。當NetworkType為classic時,該參數生效。例如:一個帶有格式的JSON Array:["42.1.XX.XX", "42.1.XX.XX", … "42.1.XX.XX"],最多100個IP,用半形逗號(,)隔開。

  • HostNames:所有執行個體的主機名稱列表。

  • OrderId:執行個體的訂單ID列表。

  • ZoneIds:可用性區域ID。

  • RelatedOrderIds:已建立的 ECS 執行個體的相關訂單 ID 列表。

  • Ipv6AddressIds:已建立ECS執行個體的IPv6地址ID列表。

    說明

    傳回型別是兩層列表。如果執行個體沒有任何IPv6地址,則列表中相應位置的元素為空白。如果所有執行個體都沒有任何IP地址,則將返回null。

  • Ipv6Addresses:已建立ECS執行個體的IPv6地址清單。

    說明

    傳回型別是兩層列表。如果執行個體沒有任何IPv6地址,則列表中相應位置的元素為空白。如果所有執行個體都沒有任何IP地址,則將返回null。

樣本

情境 1 :建立兩台ECS執行個體並實現免密登入。

快速建立

ROSTemplateFormatVersion: '2015-09-01'
Description: Creates VPC ECS instance
Parameters:
  VpcId:
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
    Type: String
    Description:
      en: Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud
      zh-cn: 現有專用網路的執行個體ID
    Label:
      en: VPC ID
      zh-cn: Virtual Private Cloud執行個體ID
  VSwitchZoneId:
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
    Type: String
    Description:
      zh-cn: 交換器可用性區域
      en: VSwitch Availability Zone
    Label:
      zh-cn: 交換器可用性區域
      en: VSwitch Availability Zone
  VSwitchId:
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
      ZoneId: ${VSwitchZoneId}
    Type: String
    Description:
      en: Instance ID of existing business network switches, console-Virtual Private Cloud-VSwitches under query
      zh-cn: 現有業務網路交換器的執行個體ID
    Label:
      en: VSwitch ID
      zh-cn: 交換器執行個體ID
  SecurityGroupId:
    Type: String
    AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
    Description:
      en: Please search the business security group ID starting with(sg-xxx)from console-ECS-Network & Security
      zh-cn: 現有業務安全性群組的執行個體ID
    Label:
      en: Business Security Group ID
      zh-cn: 業務安全性群組ID
  InstanceType:
    Type: String
    Description:
      zh-cn: 填寫vSwitch可用性區域下可使用的規格。
      en: Fill in the specifications that can be used under the VSwitch availability zone.
    Label:
      zh-cn: 執行個體規格
      en: Instance Type
    AssociationProperty: ALIYUN::ECS::Instance::InstanceType
    AssociationPropertyMetadata:
      ZoneId: ${VSwitchZoneId}
  SystemDiskCategory:
    Type: String
    Label:
      en: System Disk Type
      zh-cn: 系統硬碟類型
    Description:
      en: System Disk Type
      zh-cn: 系統硬碟類型
    AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
    AssociationPropertyMetadata:
      ZoneId: ${VSwitchZoneId}
      InstanceType: ${InstanceType}
Resources:
  OpsEcsInstance:
    Type: ALIYUN::ECS::InstanceGroup
    Properties:
      MaxAmount: 1
      HostName: OpsEcsInstance
      UserData:
        Fn::Sub:
          - |
            #!/bin/bash
            RootPassword=${RootPassword}
            ProdIP=${ProdIP}
            SSHConfig() {
            echo '[ ! -f /root/.ssh/id_rsa.pub ] && ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa &>/dev/null' >> /tmp/auto_ssh.sh
            echo 'while read line;do' >> /tmp/auto_ssh.sh
            echo '        ip=`echo $line | cut -d " " -f1`' >> /tmp/auto_ssh.sh
            echo '        user_name=`echo $line | cut -d " " -f2`' >> /tmp/auto_ssh.sh
            echo '        pass_word=`echo $line | cut -d " " -f3`' >> /tmp/auto_ssh.sh
            echo 'expect <<EOF' >> /tmp/auto_ssh.sh
            echo '        spawn ssh-copy-id -i /root/.ssh/id_rsa.pub $user_name@$ip' >> /tmp/auto_ssh.sh
            echo '        expect {' >> /tmp/auto_ssh.sh
            echo '                  "yes/no" { send "yes\n";exp_continue}' >> /tmp/auto_ssh.sh
            echo '                  "password" { send "$pass_word\n"}' >> /tmp/auto_ssh.sh
            echo '        }' >> /tmp/auto_ssh.sh
            echo '        expect eof' >> /tmp/auto_ssh.sh
            echo 'EOF' >> /tmp/auto_ssh.sh
            echo 'done < /tmp/host_ip.txt' >> /tmp/auto_ssh.sh
            }
            SetHostsConfig() {
            echo "`ifconfig eth0 | awk '/inet /{print $2}'` root ${RootPassword}" >> /tmp/host_ip.txt
            echo "${ProdIP} root ${RootPassword}" >> /tmp/host_ip.txt
            sh /tmp/auto_ssh.sh
            }
            main() {
            yum install -y expect
            SSHConfig
            SetHostsConfig
            rm -rf /tmp/host_ip.txt
            }
            main
          - ProdIP:
              Fn::Select:
                - '0'
                - Fn::GetAtt:
                    - ProdEcsInstance
                    - PrivateIps
            RootPassword: Admin@123!
      VpcId:
        Ref: VpcId
      SecurityGroupId:
        Ref: SecurityGroupId
      VSwitchId:
        Ref: VSwitchId
      ImageId: centos_7
      AllocatePublicIP: false
      InstanceType:
        Ref: InstanceType
      SystemDiskSize: 40
      SystemDiskCategory:
        Ref: SystemDiskCategory
      Password: Admin@123!
  ProdEcsInstance:
    Type: ALIYUN::ECS::InstanceGroup
    Properties:
      MaxAmount: 1
      HostName: ProdEcsInstance
      SystemDiskCategory:
        Ref: SystemDiskCategory
      VpcId:
        Ref: VpcId
      SecurityGroupId:
        Ref: SecurityGroupId
      SystemDiskSize: 40
      ImageId: centos_7
      VSwitchId:
        Ref: VSwitchId
      Password: Admin@123!
      InstanceType:
        Ref: InstanceType
      AllocatePublicIP: false
Outputs: {}                  
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Creates VPC ECS instance",
  "Parameters": {
    "VpcId": {
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
      "Type": "String",
      "Description": {
        "en": "Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud",
        "zh-cn": "現有專用網路的執行個體ID"
      },
      "Label": {
        "en": "VPC ID",
        "zh-cn": "Virtual Private Cloud執行個體ID"
      }
    },
    "VSwitchZoneId": {
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
      "Type": "String",
      "Description": {
        "zh-cn": "交換器可用性區域",
        "en": "VSwitch Availability Zone"
      },
      "Label": {
        "zh-cn": "交換器可用性區域",
        "en": "VSwitch Availability Zone"
      }
    },
    "VSwitchId": {
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}",
        "ZoneId": "${VSwitchZoneId}"
      },
      "Type": "String",
      "Description": {
        "en": "Instance ID of existing business network switches, console-Virtual Private Cloud-VSwitches under query",
        "zh-cn": "現有業務網路交換器的執行個體ID"
      },
      "Label": {
        "en": "VSwitch ID",
        "zh-cn": "交換器執行個體ID"
      }
    },
    "SecurityGroupId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}"
      },
      "Description": {
        "en": "Please search the business security group ID starting with(sg-xxx)from console-ECS-Network & Security",
        "zh-cn": "現有業務安全性群組的執行個體ID"
      },
      "Label": {
        "en": "Business Security Group ID",
        "zh-cn": "業務安全性群組ID"
      }
    },
    "InstanceType": {
      "Type": "String",
      "Description": {
        "zh-cn": "填寫vSwitch可用性區域下可使用的規格。",
        "en": "Fill in the specifications that can be used under the VSwitch availability zone."
      },
      "Label": {
        "zh-cn": "執行個體規格",
        "en": "Instance Type"
      },
      "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
      "AssociationPropertyMetadata": {
        "ZoneId": "${VSwitchZoneId}"
      }
    },
    "SystemDiskCategory": {
      "Type": "String",
      "Label": {
        "en": "System Disk Type",
        "zh-cn": "系統硬碟類型"
      },
      "Description": {
        "en": "System Disk Type",
        "zh-cn": "系統硬碟類型"
      },
      "AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
      "AssociationPropertyMetadata": {
        "ZoneId": "${VSwitchZoneId}",
        "InstanceType": "${InstanceType}"
      }
    }
  },
  "Resources": {
    "OpsEcsInstance": {
      "Type": "ALIYUN::ECS::InstanceGroup",
      "Properties": {
        "MaxAmount": 1,
        "HostName": "OpsEcsInstance",
        "UserData": {
          "Fn::Sub": [
            "#!/bin/bash\nRootPassword=${RootPassword}\nProdIP=${ProdIP}\nSSHConfig() {\necho '[ ! -f /root/.ssh/id_rsa.pub ] && ssh-keygen -t rsa -P \"\" -f ~/.ssh/id_rsa &>/dev/null' >> /tmp/auto_ssh.sh\necho 'while read line;do' >> /tmp/auto_ssh.sh\necho '        ip=`echo $line | cut -d \" \" -f1`' >> /tmp/auto_ssh.sh\necho '        user_name=`echo $line | cut -d \" \" -f2`' >> /tmp/auto_ssh.sh\necho '        pass_word=`echo $line | cut -d \" \" -f3`' >> /tmp/auto_ssh.sh\necho 'expect <<EOF' >> /tmp/auto_ssh.sh\necho '        spawn ssh-copy-id -i /root/.ssh/id_rsa.pub $user_name@$ip' >> /tmp/auto_ssh.sh\necho '        expect {' >> /tmp/auto_ssh.sh\necho '                  \"yes/no\" { send \"yes\\n\";exp_continue}' >> /tmp/auto_ssh.sh\necho '                  \"password\" { send \"$pass_word\\n\"}' >> /tmp/auto_ssh.sh\necho '        }' >> /tmp/auto_ssh.sh\necho '        expect eof' >> /tmp/auto_ssh.sh\necho 'EOF' >> /tmp/auto_ssh.sh\necho 'done < /tmp/host_ip.txt' >> /tmp/auto_ssh.sh\n}\nSetHostsConfig() {\necho \"`ifconfig eth0 | awk '/inet /{print $2}'` root ${RootPassword}\" >> /tmp/host_ip.txt\necho \"${ProdIP} root ${RootPassword}\" >> /tmp/host_ip.txt\nsh /tmp/auto_ssh.sh\n}\nmain() {\nyum install -y expect\nSSHConfig\nSetHostsConfig\nrm -rf /tmp/host_ip.txt\n}\nmain\n",
            {
              "ProdIP": {
                "Fn::Select": [
                  "0",
                  {
                    "Fn::GetAtt": [
                      "ProdEcsInstance",
                      "PrivateIps"
                    ]
                  }
                ]
              },
              "RootPassword": "Admin@123!"
            }
          ]
        },
        "VpcId": {
          "Ref": "VpcId"
        },
        "SecurityGroupId": {
          "Ref": "SecurityGroupId"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "ImageId": "centos_7",
        "AllocatePublicIP": false,
        "InstanceType": {
          "Ref": "InstanceType"
        },
        "SystemDiskSize": 40,
        "SystemDiskCategory": {
          "Ref": "SystemDiskCategory"
        },
        "Password": "Admin@123!"
      }
    },
    "ProdEcsInstance": {
      "Type": "ALIYUN::ECS::InstanceGroup",
      "Properties": {
        "MaxAmount": 1,
        "HostName": "ProdEcsInstance",
        "SystemDiskCategory": {
          "Ref": "SystemDiskCategory"
        },
        "VpcId": {
          "Ref": "VpcId"
        },
        "SecurityGroupId": {
          "Ref": "SecurityGroupId"
        },
        "SystemDiskSize": 40,
        "ImageId": "centos_7",
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "Password": "Admin@123!",
        "InstanceType": {
          "Ref": "InstanceType"
        },
        "AllocatePublicIP": false
      }
    }
  },
  "Outputs": {}
}

情境 2 :批量建立ECS執行個體並更新執行個體配置

UpdatePolicy簡介

當我們使用ALIYUN::ECS::InstanceGroup建立一組ECS執行個體後,需要對已建立的這組ECS進行配置批次更新時,可以使用UpdatePolicy屬性去完成對ECS執行個體配置更新策略的控制。UpdatePolicy屬性文法參考:

UpdatePolicy文法

"UpdatePolicy": {
  "RollingUpdateForOrigInstances": Map
}

UpdatePolicy屬性

屬性名稱

類型

必須

允許更新

描述

約束

RollingUpdateForOrigInstances

Map

控制更新已有的ECS執行個體的策略。

該策略內容對新增的ECS不會生效。

詳見RollingUpdateForOrigInstances屬性

RollingUpdateForOrigInstances文法

"RollingUpdateForOrigInstances": {
  "MaxBatchSize": Integer,
  "PauseTime": Integer
}

RollingUpdateForOrigInstances屬性

屬性名稱

類型

必須

允許更新

描述

約束

MaxBatchSize

Integer

每個批次更新的ECS執行個體數量。

取值範圍:1~1000。

PauseTime

Integer

各個批次更新之間暫停時間(單位:秒)預設為0。

取值範圍:0~3600。

使用以下模板建立一組相同配置的ECS執行個體(包含5台ECS)。

ROSTemplateFormatVersion: '2015-09-01'
Resources:
  Instance:
    Type: ALIYUN::ECS::InstanceGroup
    Properties:
      MaxAmount: 5
      InstanceType: xxxx
      ImageId: centos
      VpcId: vpc-2xxxx
      VSwitchId: vsw-xxxx
      SecurityGroupId: sg-xxxxx
      Password: Ros1gregrge2345
      InstanceChargeType: PostPaid
      NetworkType: vpc
      SystemDiskCategory: xxx
      SystemDiskSize: 100
      InternetMaxBandwidthOut: 5
      AllocatePublicIP: true
{
    "ROSTemplateFormatVersion": "2015-09-01",
    "Resources": {
        "Instance": {
            "Type": "ALIYUN::ECS::InstanceGroup",
            "Properties": {
                "MaxAmount": 5,
                "InstanceType": "xxxx",
                "ImageId": "centos",
                "VpcId": "vpc-2xxxx",
                "VSwitchId": "vsw-xxxx",
                "SecurityGroupId": "sg-xxxxx",
                "Password": "Ros1gregrge2345",
                "InstanceChargeType": "PostPaid",
                "NetworkType": "vpc",
                "SystemDiskCategory": "xxx",
                "SystemDiskSize": 100,
                "InternetMaxBandwidthOut": 5,
                "AllocatePublicIP": true
            }
        }
    }
}

建立資源棧成功後對已建立的ECS執行個體進行配置更新,更新時可以配置UpdatePolicy屬性。

ROSTemplateFormatVersion: '2015-09-01'
Resources:
  Instance:
    Type: ALIYUN::ECS::InstanceGroup
    UpdatePolicy:
      RollingUpdateForOrigInstances:
        MaxBatchSize: 2
        PauseTime: 0
    Properties:
      MaxAmount: 10
      InstanceType: xxxx
      ImageId: centos
      VpcId: vpc-2xxxx
      VSwitchId: vsw-xxxx
      SecurityGroupId: sg-xxxxx
      Password: Ros1gregrge2345
      InstanceChargeType: PostPaid
      NetworkType: vpc
      SystemDiskCategory: xxx
      SystemDiskSize: 100
      InternetMaxBandwidthOut: 5
      AllocatePublicIP: true
{
    "ROSTemplateFormatVersion": "2015-09-01",
    "Resources": {
        "Instance": {
            "Type": "ALIYUN::ECS::InstanceGroup",
            "UpdatePolicy": {
                "RollingUpdateForOrigInstances": {
                    "MaxBatchSize": 2,
                    "PauseTime": 0
                }
            },
            "Properties": {
                "MaxAmount": 10,
                "InstanceType": "xxxx",
                "ImageId": "centos",
                "VpcId": "vpc-2xxxx",
                "VSwitchId": "vsw-xxxx",
                "SecurityGroupId": "sg-xxxxx",
                "Password": "Ros1gregrge2345",
                "InstanceChargeType": "PostPaid",
                "NetworkType": "vpc",
                "SystemDiskCategory": "xxx",
                "SystemDiskSize": 100,
                "InternetMaxBandwidthOut": 5,
                "AllocatePublicIP": true
            }
        }
    }
}

指定MaxBatchSize=2。 更新前MaxAmount=5,更新後MaxAmount=10,在更新資源棧的過程中,原有的5台機器,會分3個批次(2/2/1)進行變更配置更新。新增的5台機器會被一次性統一建立。

情境 3 :建立兩台ECS執行個體並綁定至傳統型負載平衡CLB服務組

快速建立

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 建立SLB與2個ECS執行個體,配置網路與安全性群組,將ECS執行個體加入SLB後端。
  en: Create an SLB (Server Load Balancer) with two ECS (Elastic Compute Service) instances, configure the network and security groups, then add the ECS instances to the SLB backend.
Parameters:
  SystemDiskCategory:
    AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
    AssociationPropertyMetadata:
      InstanceType: ${ECSInstanceType}
      ZoneId: ${ZoneId}
    Type: String
    Label:
      zh-cn: 系統硬碟類型
      en: System Disk Category
  AddressType:
    Default: internet
    Label:
      zh-cn: 網路類型
      en: Address Type
    Type: String
    Description:
      zh-cn: Server Load Balancer執行個體的網路類型,可選值:internet:公網訪問,intranet:內網訪問。
      en: 'Network type of LoadBalancer. Optional value: Internet: public network access, Intranet: Intranet access.'
    AllowedValues:
      - internet
      - intranet
  ECSInternetChargeType:
    AssociationPropertyMetadata:
      LocaleKey: InternetChargeType
    Description:
      zh-cn: 訪問公網計費方式。
      en: The charge type of public internet ECS instance.
    Default: PayByTraffic
    Label:
      zh-cn: 公網付費方式
      en: Internet Charge Type
    AllowedValues:
      - PayByBandwidth
      - PayByTraffic
    Type: String
  ECSInstanceType:
    AssociationProperty: ALIYUN::ECS::Instance::ECSInstanceType
    AssociationPropertyMetadata:
      ZoneId: ${ZoneId}
    Type: String
    Description:
      zh-cn: <font color='blue'><b>1.選擇機型前請先確認當前可用性區域下該機型是否有貨,部分機型需要提前報備</b></font><br><font color='blue'><b>2.可選機型列表</font><br></b></font>[ecs.n1.large <font color='green'>2vCPU 4GiB</font>]<br></b>[ecs.n1.xlarge <font color='green'>8vCPU 16GiB</font>]<br></b>[ecs.n1.3xlarge <font color='green'>16vCPU 32GiB</font>]
      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</b></font><br><font color='blue'><b>2.List of optional models</font><br></b></font>[ecs.n1.large <font color='green'>2vCPU 4GiB</font>]<br></b>[ecs.n1.xlarge <font color='green'>8vCPU 16GiB</font>]<br></b>[ecs.n1.3xlarge <font color='green'>16vCPU 32GiB</font>]
    Label:
      zh-cn: 執行個體規格
      en: Instance Type
  Password:
    ConstraintDescription:
      zh-cn: 長度8-30,必須包含大寫字母、小寫字母、數字、特殊符號三種;特殊字元包括:()`~!@#$%^&*_-+=|{}[]:;' <>,.?/
      en: 'Length 8-30, must contain upper case letters, lower case letters, Numbers, special symbols three; special characters include: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
    Description:
      zh-cn: 長度8-30,必須包含大寫字母、小寫字母、數字、特殊符號三個;<br>特殊字元包括:()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
      en: The 8-30 long login password of instance, consists of the uppercase, lowercase letter and number. <br> special characters include()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
    MinLength: '8'
    Label:
      zh-cn: 執行個體密碼
      en: Instance Password
    AllowedPattern: '[0-9A-Za-z\_\-&:;''<>,=%`~!@#\(\)\$\^\*\+\|\{\}\[\]\.\?\/]+$'
    NoEcho: true
    MaxLength: '30'
    Type: String
  ImageId:
    Default: centos_7_04_64_20G_alibase_201701015.vhd
    AssociationProperty: ALIYUN::ECS::Image::ImageId
    AssociationPropertyMetadata:
      InstanceType: ${ECSInstanceType}
      SupportedImageOwnerAlias:
        - system
        - self
        - others
    Type: String
    Label:
      zh-cn: 鏡像ID
      en: Image ID
  Bandwidth:
    Description:
      zh-cn: 固定頻寬計費方式的公網類型執行個體的頻寬峰值。
      en: The bandwidth peak of a public network type instance of fixed bandwidth billing.
    Default: 1
    MaxValue: 1000
    MinValue: 1
    Label:
      zh-cn: 頻寬峰值
      en: The Peak Bandwidth
    Type: Number
  SLBInternetChargeType:
    AssociationPropertyMetadata:
      LocaleKey: InternetChargeType
    Description:
      zh-cn: 公網類型執行個體的付費方式。
      en: The charge type of public internet SLB instance.
    Default: paybytraffic
    Label:
      zh-cn: 公網付費方式
      en: Internet Charge Type
    AllowedValues:
      - paybybandwidth
      - paybytraffic
    Type: String
  LoadBalancerSpec:
    Default: slb.s1.small
    Type: String
    Description:
      zh-cn: 執行個體規格,詳見:</b><a href='https://www.alibabacloud.com/help/document_detail/85939.html' target='_blank'><b><font color='blue'>效能保障型</b></font></a>
      en: Instance specifications, see detail:</b><a href='https://www.alibabacloud.com/help/doc-detail/85939.html' target='_blank'><b><font color='blue'>Performance support type</b></font></a>
    Label:
      zh-cn: 執行個體規格
      en: Instance Specification
  ZoneId:
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
    Type: String
    Description:
      zh-cn: 可用性區域ID,需確認所選可用性區域下是否支援ECS、VPC、VSwitch等資源。
      en: The available zone ID, you should confirm the zone support ECS、VPC、VSwitch or not.
    Label:
      zh-cn: 可用性區域ID
      en: Zone ID
Outputs:
  BackendServerInstanceId:
    Description:
      zh-cn: 建立ECS的執行個體IDs
      en: The instance IDs of create EcsInstanceGroup
    Value:
      Fn::GetAtt:
        - EcsInstanceGroup
        - InstanceIds
  BackendServerPublicIp:
    Description:
      zh-cn: 建立ECS的執行個體公用IPs。
      en: The instance public IPs of create EcsInstanceGroup.
    Value:
      Fn::GetAtt:
        - EcsInstanceGroup
        - PublicIps
  SlbIpAddress:
    Description:
      zh-cn: 負載平衡器的IP地址。
      en: The IP address of the load balancer.
    Value:
      Fn::GetAtt:
        - LoadBalancer
        - IpAddress
  LoadBalancerId:
    Description:
      zh-cn: 已建立Server Load Balancer的ID。
      en: The ID of load balance created.
    Value:
      Fn::GetAtt:
        - LoadBalancer
        - LoadBalancerId
Resources:
  SecurityGroup:
    Type: ALIYUN::ECS::SecurityGroup
    Properties:
      VpcId:
        Ref: Vpc
      SecurityGroupName: MySecurityGroup
  Attachment:
    Type: ALIYUN::SLB::BackendServerAttachment
    Properties:
      BackendServers:
        - ServerId:
            Fn::Select:
              - '0'
              - Fn::GetAtt:
                  - EcsInstanceGroup
                  - InstanceIds
          Weight: 100
        - ServerId:
            Fn::Select:
              - '1'
              - Fn::GetAtt:
                  - EcsInstanceGroup
                  - InstanceIds
          Weight: 100
      LoadBalancerId:
        Ref: LoadBalancer
  Vpc:
    Type: ALIYUN::ECS::VPC
    Properties:
      CidrBlock: 192.168.0.0/16
  EcsInstanceGroup:
    Type: ALIYUN::ECS::InstanceGroup
    Properties:
      SystemDiskCategory:
        Ref: SystemDiskCategory
      VpcId:
        Fn::GetAtt:
          - Vpc
          - VpcId
      SecurityGroupId:
        Fn::GetAtt:
          - SecurityGroup
          - SecurityGroupId
      ImageId:
        Ref: ImageId
      IoOptimized: optimized
      InternetChargeType:
        Ref: ECSInternetChargeType
      VSwitchId:
        Ref: VSwitch
      Password:
        Ref: Password
      InstanceType:
        Ref: ECSInstanceType
      MaxAmount: 2
  VSwitch:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      VpcId:
        Ref: Vpc
      CidrBlock: 192.168.1.0/24
      ZoneId:
        Ref: ZoneId
  LoadBalancer:
    Type: ALIYUN::SLB::LoadBalancer
    Properties:
      InternetChargeType:
        Ref: SLBInternetChargeType
      Bandwidth:
        Ref: Bandwidth
      AddressType:
        Ref: AddressType
      LoadBalancerSpec:
        Ref: LoadBalancerSpec
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - ZoneId
          - ECSInternetChargeType
          - ECSInstanceType
          - ImageId
          - SystemDiskCategory
          - Password
        Label:
          default:
            zh-cn: 雲端服務器
            en: ECS
      - Parameters:
          - LoadBalancerSpec
          - AddressType
          - SLBInternetChargeType
          - Bandwidth
        Label:
          default:
            zh-cn: 負載平衡
            en: SLB
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "建立SLB與2個ECS執行個體,配置網路與安全性群組,將ECS執行個體加入SLB後端。",
    "en": "Create an SLB (Server Load Balancer) with two ECS (Elastic Compute Service) instances, configure the network and security groups, then add the ECS instances to the SLB backend."
  },
  "Parameters": {
    "SystemDiskCategory": {
      "AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
      "AssociationPropertyMetadata": {
        "InstanceType": "${ECSInstanceType}",
        "ZoneId": "${ZoneId}"
      },
      "Type": "String",
      "Label": {
        "zh-cn": "系統硬碟類型",
        "en": "System Disk Category"
      }
    },
    "AddressType": {
      "Default": "internet",
      "Label": {
        "zh-cn": "網路類型",
        "en": "Address Type"
      },
      "Type": "String",
      "Description": {
        "zh-cn": "Server Load Balancer執行個體的網路類型,可選值:internet:公網訪問,intranet:內網訪問。",
        "en": "Network type of LoadBalancer. Optional value: Internet: public network access, Intranet: Intranet access."
      },
      "AllowedValues": [
        "internet",
        "intranet"
      ]
    },
    "ECSInternetChargeType": {
      "AssociationPropertyMetadata": {
        "LocaleKey": "InternetChargeType"
      },
      "Description": {
        "zh-cn": "訪問公網計費方式。",
        "en": "The charge type of public internet ECS instance."
      },
      "Default": "PayByTraffic",
      "Label": {
        "zh-cn": "公網付費方式",
        "en": "Internet Charge Type"
      },
      "AllowedValues": [
        "PayByBandwidth",
        "PayByTraffic"
      ],
      "Type": "String"
    },
    "ECSInstanceType": {
      "AssociationProperty": "ALIYUN::ECS::Instance::ECSInstanceType",
      "AssociationPropertyMetadata": {
        "ZoneId": "${ZoneId}"
      },
      "Type": "String",
      "Description": {
        "zh-cn": "<font color='blue'><b>1.選擇機型前請先確認當前可用性區域下該機型是否有貨,部分機型需要提前報備</b></font><br><font color='blue'><b>2.可選機型列表</font><br></b></font>[ecs.n1.large <font color='green'>2vCPU 4GiB</font>]<br></b>[ecs.n1.xlarge <font color='green'>8vCPU 16GiB</font>]<br></b>[ecs.n1.3xlarge <font color='green'>16vCPU 32GiB</font>]",
        "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</b></font><br><font color='blue'><b>2.List of optional models</font><br></b></font>[ecs.n1.large <font color='green'>2vCPU 4GiB</font>]<br></b>[ecs.n1.xlarge <font color='green'>8vCPU 16GiB</font>]<br></b>[ecs.n1.3xlarge <font color='green'>16vCPU 32GiB</font>]"
      },
      "Label": {
        "zh-cn": "執行個體規格",
        "en": "Instance Type"
      }
    },
    "Password": {
      "ConstraintDescription": {
        "zh-cn": "長度8-30,必須包含大寫字母、小寫字母、數字、特殊符號三種;特殊字元包括:()`~!@#$%^&*_-+=|{}[]:;' <>,.?/",
        "en": "Length 8-30, must contain upper case letters, lower case letters, Numbers, special symbols three; special characters include: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
      },
      "Description": {
        "zh-cn": "長度8-30,必須包含大寫字母、小寫字母、數字、特殊符號三個;<br>特殊字元包括:()`~!@#$%^&*_-+=|{}[]:;'<>,.?/",
        "en": "The 8-30 long login password of instance, consists of the uppercase, lowercase letter and number. <br> special characters include()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
      },
      "MinLength": "8",
      "Label": {
        "zh-cn": "執行個體密碼",
        "en": "Instance Password"
      },
      "AllowedPattern": "[0-9A-Za-z\\_\\-&:;'<>,=%`~!@#\\(\\)\\$\\^\\*\\+\\|\\{\\}\\[\\]\\.\\?\\/]+$",
      "NoEcho": true,
      "MaxLength": "30",
      "Type": "String"
    },
    "ImageId": {
      "Default": "centos_7_04_64_20G_alibase_201701015.vhd",
      "AssociationProperty": "ALIYUN::ECS::Image::ImageId",
      "AssociationPropertyMetadata": {
        "InstanceType": "${ECSInstanceType}",
        "SupportedImageOwnerAlias": [
          "system",
          "self",
          "others"
        ]
      },
      "Type": "String",
      "Label": {
        "zh-cn": "鏡像ID",
        "en": "Image ID"
      }
    },
    "Bandwidth": {
      "Description": {
        "zh-cn": "固定頻寬計費方式的公網類型執行個體的頻寬峰值。",
        "en": "The bandwidth peak of a public network type instance of fixed bandwidth billing."
      },
      "Default": 1,
      "MaxValue": 1000,
      "MinValue": 1,
      "Label": {
        "zh-cn": "頻寬峰值",
        "en": "The Peak Bandwidth"
      },
      "Type": "Number"
    },
    "SLBInternetChargeType": {
      "AssociationPropertyMetadata": {
        "LocaleKey": "InternetChargeType"
      },
      "Description": {
        "zh-cn": "公網類型執行個體的付費方式。",
        "en": "The charge type of public internet SLB instance."
      },
      "Default": "paybytraffic",
      "Label": {
        "zh-cn": "公網付費方式",
        "en": "Internet Charge Type"
      },
      "AllowedValues": [
        "paybybandwidth",
        "paybytraffic"
      ],
      "Type": "String"
    },
    "LoadBalancerSpec": {
      "Default": "slb.s1.small",
      "Type": "String",
      "Description": {
        "zh-cn": "執行個體規格,詳見:</b><a href='https://www.alibabacloud.com/help/document_detail/85939.html' target='_blank'><b><font color='blue'>效能保障型</b></font></a>",
        "en": "Instance specifications, see detail:</b><a href='https://www.alibabacloud.com/help/doc-detail/85939.html' target='_blank'><b><font color='blue'>Performance support type</b></font></a>"
      },
      "Label": {
        "zh-cn": "執行個體規格",
        "en": "Instance Specification"
      }
    },
    "ZoneId": {
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
      "Type": "String",
      "Description": {
        "zh-cn": "可用性區域ID,需確認所選可用性區域下是否支援ECS、VPC、VSwitch等資源。",
        "en": "The available zone ID, you should confirm the zone support ECS、VPC、VSwitch or not."
      },
      "Label": {
        "zh-cn": "可用性區域ID",
        "en": "Zone ID"
      }
    }
  },
  "Outputs": {
    "BackendServerInstanceId": {
      "Description": {
        "zh-cn": "建立ECS的執行個體IDs",
        "en": "The instance IDs of create EcsInstanceGroup"
      },
      "Value": {
        "Fn::GetAtt": [
          "EcsInstanceGroup",
          "InstanceIds"
        ]
      }
    },
    "BackendServerPublicIp": {
      "Description": {
        "zh-cn": "建立ECS的執行個體公用IPs。",
        "en": "The instance public IPs of create EcsInstanceGroup."
      },
      "Value": {
        "Fn::GetAtt": [
          "EcsInstanceGroup",
          "PublicIps"
        ]
      }
    },
    "SlbIpAddress": {
      "Description": {
        "zh-cn": "負載平衡器的IP地址。",
        "en": "The IP address of the load balancer."
      },
      "Value": {
        "Fn::GetAtt": [
          "LoadBalancer",
          "IpAddress"
        ]
      }
    },
    "LoadBalancerId": {
      "Description": {
        "zh-cn": "已建立Server Load Balancer的ID。",
        "en": "The ID of load balance created."
      },
      "Value": {
        "Fn::GetAtt": [
          "LoadBalancer",
          "LoadBalancerId"
        ]
      }
    }
  },
  "Resources": {
    "SecurityGroup": {
      "Type": "ALIYUN::ECS::SecurityGroup",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "SecurityGroupName": "MySecurityGroup"
      }
    },
    "Attachment": {
      "Type": "ALIYUN::SLB::BackendServerAttachment",
      "Properties": {
        "BackendServers": [
          {
            "ServerId": {
              "Fn::Select": [
                "0",
                {
                  "Fn::GetAtt": [
                    "EcsInstanceGroup",
                    "InstanceIds"
                  ]
                }
              ]
            },
            "Weight": 100
          },
          {
            "ServerId": {
              "Fn::Select": [
                "1",
                {
                  "Fn::GetAtt": [
                    "EcsInstanceGroup",
                    "InstanceIds"
                  ]
                }
              ]
            },
            "Weight": 100
          }
        ],
        "LoadBalancerId": {
          "Ref": "LoadBalancer"
        }
      }
    },
    "Vpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": "192.168.0.0/16"
      }
    },
    "EcsInstanceGroup": {
      "Type": "ALIYUN::ECS::InstanceGroup",
      "Properties": {
        "SystemDiskCategory": {
          "Ref": "SystemDiskCategory"
        },
        "VpcId": {
          "Fn::GetAtt": [
            "Vpc",
            "VpcId"
          ]
        },
        "SecurityGroupId": {
          "Fn::GetAtt": [
            "SecurityGroup",
            "SecurityGroupId"
          ]
        },
        "ImageId": {
          "Ref": "ImageId"
        },
        "IoOptimized": "optimized",
        "InternetChargeType": {
          "Ref": "ECSInternetChargeType"
        },
        "VSwitchId": {
          "Ref": "VSwitch"
        },
        "Password": {
          "Ref": "Password"
        },
        "InstanceType": {
          "Ref": "ECSInstanceType"
        },
        "MaxAmount": 2
      }
    },
    "VSwitch": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "CidrBlock": "192.168.1.0/24",
        "ZoneId": {
          "Ref": "ZoneId"
        }
      }
    },
    "LoadBalancer": {
      "Type": "ALIYUN::SLB::LoadBalancer",
      "Properties": {
        "InternetChargeType": {
          "Ref": "SLBInternetChargeType"
        },
        "Bandwidth": {
          "Ref": "Bandwidth"
        },
        "AddressType": {
          "Ref": "AddressType"
        },
        "LoadBalancerSpec": {
          "Ref": "LoadBalancerSpec"
        }
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "ZoneId",
            "ECSInternetChargeType",
            "ECSInstanceType",
            "ImageId",
            "SystemDiskCategory",
            "Password"
          ],
          "Label": {
            "default": {
              "zh-cn": "雲端服務器",
              "en": "ECS"
            }
          }
        },
        {
          "Parameters": [
            "LoadBalancerSpec",
            "AddressType",
            "SLBInternetChargeType",
            "Bandwidth"
          ],
          "Label": {
            "default": {
              "zh-cn": "負載平衡",
              "en": "SLB"
            }
          }
        }
      ]
    }
  }
}

更多樣本,請參考包含此資源的公用模板。