ALIYUN::ECS::Instance類型用於建立ECS執行個體。
本資源已停止迭代更新,建議您使用 ALIYUN::ECS::InstanceGroup 資源。
文法
{
"Type": "ALIYUN::ECS::Instance",
"Properties": {
"DedicatedHostId": String,
"Period": Number,
"AutoRenew": String,
"RamRoleName": String,
"IoOptimized": String,
"InternetChargeType": String,
"PrivateIpAddress": String,
"KeyPairName": String,
"SystemDiskDiskName": String,
"PeriodUnit": String,
"Description": String,
"Tags": List,
"HostName": String,
"AutoRenewPeriod": Number,
"ImageId": String,
"ResourceGroupId": String,
"InstanceChargeType": String,
"VSwitchId": String,
"Password": String,
"PasswordInherit": Boolean,
"InstanceType": String,
"SystemDiskCategory": String,
"SubscriptionDeletionForce": Boolean,
"UserData": String,
"SystemDiskSize": Number,
"ZoneId": String,
"InternetMaxBandwidthOut": Integer,
"VpcId": String,
"SpotStrategy": String,
"InstanceName": String,
"DeletionProtection": Boolean,
"DeploymentSetId": String,
"SecurityGroupIds": List,
"SecurityGroupId": String,
"SecurityEnhancementStrategy": String,
"SpotPriceLimit": String,
"HpcClusterId": String,
"AllocatePublicIP": Boolean,
"SystemDiskDescription": String,
"SystemDiskPerformanceLevel": String,
"DiskMappings": List,
"SpotInterruptionBehavior": String,
"ZoneIds": List,
"SpotDuration": Integer,
"CreditSpecification": String,
"PrivatePoolOptions": Map,
"StorageSetId": String,
"HttpTokens": String,
"HttpEndpoint": String,
"Tenancy": String,
"StorageSetPartitionNumber": Integer,
"DeploymentSetGroupNo": Integer,
"Affinity": String,
"UseAdditionalService": Boolean,
"ImageFamily": String
}
}屬性
屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
ResourceGroupId | String | 否 | 是 | 資源群組ID。 | 無 |
SpotInterruptionBehavior | String | 否 | 否 | 搶佔執行個體中斷模式。 | 目前僅支援Terminate(預設)直接釋放執行個體。 |
ZoneIds | List | 否 | 否 | 可用性區域列表。 | 僅在控制台選取參數時生效。 |
SpotDuration | Integer | 否 | 否 | 搶佔式執行個體的保留時間長度。 | 取值範圍:0~6。 單位:小時。
|
SecurityGroupIds | List | 否 | 否 | 安全性群組ID列表。 | SecurityGroupId和SecurityGroupIds僅能指定其中一個。 |
ImageId | String | 否 | 是 | 鏡像ID。包括公用鏡像、自訂鏡像和雲市場鏡像。 | 支援通過模糊的方式指定公用鏡像ID,無需指定一個完整的公用鏡像ID。例如:
|
InstanceType | String | 是 | 是 | ECS執行個體規格。 | 關於ECS執行個體規格的更多資訊,請參見執行個體規格類型系列。 |
SecurityGroupId | String | 否 | 否 | 安全性群組ID。 | SecurityGroupId和SecurityGroupIds僅能指定其中一個。 |
SecurityEnhancementStrategy | String | 否 | 否 | 是否開啟安全強化。 | 取值:
|
Description | String | 否 | 是 | 描述資訊。 | 長度為2~256個字元。 |
InstanceName | String | 否 | 是 | 執行個體名稱。 | 長度為2~128個字元。必須以英文字母或漢字開頭,不能以 如果沒有指定該屬性,預設值為執行個體的InstanceId。 |
Password | String | 否 | 是 | ECS執行個體登入密碼。 | 長度為8~30個字元。必須同時包含大寫英文字母、小寫英文字母、數字和特殊字元中至少三種,支援特殊字元: |
PasswordInherit | Boolean | 否 | 否 | 是否使用鏡像預設的密碼。 | 取值:
說明 使用該屬性時,Password必須為空白,同時您需要確保使用的鏡像已經設定了密碼。 |
HostName | String | 否 | 是 | 雲端服務器的主機名稱。 | 最小長度為2個字元。半形句號(.)和短劃線(-)不能作為主機名稱的首尾字元,且不能連續使用。
|
AllocatePublicIP | Boolean | 否 | 否 | 是否分配公網IP。 | 取值:
說明 如果InternetMaxBandwidthOut取值大於0,則會分配公網IP。 |
PrivateIpAddress | String | 否 | 否 | 在專用網路環境下,指定的內網IP。 | IP地址不能與專用網路下的其它執行個體重複。 |
InternetChargeType | String | 否 | 是 | 訪問公網計費方式。 | 取值:
|
InternetMaxBandwidthOut | Integer | 否 | 是 | 公網出頻寬最大值。 | 取值範圍:0~100。 預設值:0。 單位:Mbps。 |
IoOptimized | String | 否 | 否 | 是否建立I/O最佳化執行個體。 | 取值:
|
DiskMappings | List | 否 | 是 | 需要掛載的資料盤。 | 最多支援16塊資料盤。 更多資訊,請參見DiskMappings文法和DiskMappings屬性。 |
SystemDiskCategory | String | 否 | 是 | 系統硬碟類型。 | 取值:
已停售的執行個體規格且非I/O最佳化執行個體預設值為cloud,否則預設值為cloud_efficiency。 |
SystemDiskDescription | String | 否 | 否 | 系統硬碟描述資訊。 | 無 |
SystemDiskDiskName | String | 否 | 否 | 系統硬碟名稱。 | 長度為2~128個字元。必須以英文字母或漢字開頭,不能以 |
SystemDiskSize | Number | 否 | 是 | 系統硬碟大小。 | 取值範圍:20~500。 單位:GB。 如果使用自訂鏡像建立系統硬碟,需要保證系統硬碟大於自訂鏡像大小。 |
Tags | List | 否 | 是 | 使用者自訂標籤。 | 最多支援20個標籤,格式: |
UserData | String | 否 | 是 | 建立ECS執行個體時傳遞的使用者資料。 | 內容需要限制在16 KB以內,不需要使用Base64轉碼,特殊字元需要使用反斜線(\)轉義。 |
ZoneId | String | 否 | 否 | 可用性區域ID。 | 無 |
HpcClusterId | String | 否 | 否 | 執行個體所屬的HPC叢集ID。 | 無 |
VpcId | String | 否 | 否 | 專用網路ID。 | 無 |
VSwitchId | String | 否 | 否 | 交換器ID。 | 無 |
InstanceChargeType | String | 否 | 否 | ECS執行個體付費類型。 | 取值:
|
Period | Number | 否 | 否 | 付費周期。 | 當InstanceChargeType取值為PrePaid時,Period為必選屬性;當InstanceChargeType取值為PostPaid時,Period為可選屬性。 |
KeyPairName | String | 否 | 是 | ECS執行個體綁定的金鑰組名稱。 | 當執行個體類型為Windows時,請忽略該屬性;當執行個體類型為Linux時,密碼登入方式會被初始化為禁止。為提高執行個體安全性,建議您使用金鑰組的串連方式。 |
RamRoleName | String | 否 | 否 | 執行個體RAM角色名稱。 | 更多資訊,請參見CreateRole和ListRoles。 |
SpotPriceLimit | String | 否 | 否 | 執行個體的每小時最高價格。 | 支援最多3位小數。當SpotStrategy取值為SpotWithPriceLimit時,該屬性生效。 |
SpotStrategy | String | 否 | 否 | 隨用隨付執行個體的競價策略。 | 當InstanceChargeType取值為PostPaid時,SpotStrategy為必選屬性。 取值:
|
DedicatedHostId | String | 否 | 否 | ECS執行個體建立指定Dedicated Host上。 | 您可以通過調用DescribeDedicatedHosts介面查詢Dedicated HostID列表 。由於Dedicated Host不支援建立搶佔式執行個體,指定DedicatedHostId後,請求中的SpotStrategy和SpotPriceLimit設定將被自動忽略。 |
PeriodUnit | String | 否 | 否 | 購買資源的時間長度。 | 取值:
|
AutoRenewPeriod | Number | 否 | 否 | 每次自動續約的時間長度。 | 當AutoRenew取值為True時,AutoRenewPeriod為必選屬性。 取值:
|
AutoRenew | String | 否 | 否 | 是否自動續約。 | 取值:
當InstanceChargeType取值PrePaid時,AutoRenew為必選屬性。 |
DeletionProtection | Boolean | 否 | 是 | 執行個體釋放保護屬性,指定是否支援通過控制台或DeleteInstance介面釋放執行個體。 | 取值:
說明 該屬性僅適用於隨用隨付執行個體,且只能限制手動釋放操作,對系統釋放操作不生效。 |
DeploymentSetId | String | 否 | 否 | 部署集ID。 | 無 |
SystemDiskPerformanceLevel | String | 否 | 是 | 建立ESSD雲端硬碟作為系統硬碟使用時,設定雲端硬碟的效能等級。 | 取值:
關於如何選擇ESSD效能等級,請參見ESSD雲端硬碟。 |
CreditSpecification
| String | 否 | 是 | 設定突發效能執行個體的運行模式。 | 取值:
|
PrivatePoolOptions | Map | 否 | 否 | 執行個體啟動的私人池容量選項。 | 更多資訊,請參考PrivatePoolOptions屬性。 |
StorageSetId | String | 否 | 否 | 儲存集ID。 | 無 |
HttpTokens | String | 否 | 是 | 訪問執行個體中繼資料時是否強制使用加固模式(IMDSv2)。 | 取值:
說明 有關訪問執行個體中繼資料的模式,請參見執行個體中繼資料。 |
SubscriptionDeletionForce | Boolean | 否 | 否 | 該選項僅適用於訂用帳戶執行個體。對於訂用帳戶執行個體,如果此選項為 true,則在刪除前會將執行個體轉換為隨用隨付執行個體;如果為 false,則不會執行強制移除。此操作會產生額外費用,請謹慎選擇。 | 無 |
HttpEndpoint | String | 否 | 是 | 是否啟用執行個體中繼資料的訪問通道。 | 取值範圍:
說明 有關執行個體中繼資料的資訊,請參見執行個體中繼資料。 |
Tenancy | String | 否 | 否 | 是否在Dedicated Host上建立執行個體。 | 取值:
|
StorageSetPartitionNumber | Integer | 否 | 否 | 儲存集中的最大分區數量。 | 取值範圍:大於等於2。 |
DeploymentSetGroupNo | Integer | 否 | 否 | 如果您設定的部署集對應的策略為部署集組高可用策略(AvailabilityGroup),可以通過該參數指定執行個體在部署集中的分組號。 | 取值範圍:1~7。 |
Affinity | String | 否 | 否 | Dedicated Host執行個體是否與Dedicated Host關聯。 | 取值:
|
UseAdditionalService | Boolean | 否 | 否 | 是否使用阿里雲提供的虛擬機器系統配置(Windows:NTP、KMS;Linux:NTP、YUM)。 | 取值:
|
ImageFamily | String | 否 | 否 | 鏡像族系名稱。 | 通過設定該參數來擷取當前鏡像族系內最新可用鏡像來建立執行個體。
說明 阿里雲官方鏡像關聯的鏡像族系資訊請參見公用鏡像。 |
DiskMappings文法
"DiskMappings": [
{
"Category": String,
"DiskName": String,
"Description": String,
"Device": String,
"SnapshotId": String,
"PerformanceLevel": String,
"Size": String
}
]DiskMappings屬性
屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
Size | String | 是 | 否 | 資料盤大小。 | 取值範圍:20~500。 單位:GB。 |
Category | String | 否 | 否 | 資料盤類型。 | 取值:
I/O最佳化執行個體的預設值為cloud_efficiency,非I/O最佳化執行個體的預設值為cloud。 如果自訂鏡像已包含了一個資料盤,那麼建立ECS執行個體時,若要在ROS模板中指定資料盤類型,可以將Category指定為需要的資料盤類型。例如: |
DiskName | String | 否 | 否 | 資料盤名稱。 | 長度為2~128個字元。必須以英文字母或漢字開頭,不能以 |
Description | String | 否 | 否 | 描述資訊。 | 長度為2~256個字元,不能以 |
Device | String | 否 | 否 | 掛載點。 | 無 |
PerformanceLevel | String | 否 | 否 | 建立ESSD雲端硬碟作為資料盤使用時,設定雲端硬碟的效能等級。 | 取值:
關於如何選擇ESSD效能等級,請參見ESSD雲端硬碟。 |
SnapshotId | String | 否 | 否 | 資料盤使用的快照ID。 | 無 |
Tags文法
"Tags": [
{
"Value": String,
"Key": String
}
]Tags屬性
屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
Key | String | 是 | 否 | 標籤鍵。 | 長度為1~128個字元,不能以 |
Value | String | 否 | 否 | 標籤值。 | 長度為0~128個字元,不能以 |
PrivatePoolOptions文法
"PrivatePoolOptions": [
{
"Id": String,
"MatchCriteria": String
}
]PrivatePoolOptions屬性
屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
Id | String | 否 | 否 | 私人池ID。即彈性保障服務ID或容量預定服務ID。 | 無 |
MatchCriteria | String | 否 | 否 | 彈性保障服務或容量預定服務在生效後會產生私人池容量,供執行個體啟動時選擇。 | 取值:
以下任一情境,執行個體啟動的私人池容量選項只能取值
|
傳回值
Fn::GetAtt
InstanceId:執行個體ID。由系統產生,執行個體的全域唯一標識。
PrivateIp:VPC類型執行個體的私網IP地址。
InnerIp:Classic類型執行個體的內網IP地址。
PublicIp:Classic類型執行個體的公網IP地址。
ZoneId:可用性區域ID。
HostName:雲端服務器的主機名稱。
PrimaryNetworkInterfaceId:主網卡ID。
SecurityGroupIds:已建立執行個體的安全性群組ID列表。
樣本
情境 1 :建立兩台ECS執行個體並實現免密登入。
ROSTemplateFormatVersion: '2015-09-01'
Description: Creates VPC ECS instance
Metadata: {}
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: 可用性區域ID。<br><b>註: <font color='blue'>選擇前請確認該可用性區域是否支援建立ECS資源的規格,建議與其他交換器可用性區域不同</font></b>
en: Availability Zone ID.<br><b>note:<font color='blue'>before selecting, please confirm that the Availability Zone supports the specification of creating ECS resources,which is recommended to be different from other VSwitch Availability Zone</font></b>
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
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
ZoneId: ${VSwitchZoneId}
InstanceType: ${InstanceType}
Label:
en: System Disk Type
zh-cn: 系統硬碟類型
Description:
en: '<font color=''blue''><b>Optional values:</b></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>]'
zh-cn: '<font color=''blue''><b>可選值:</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>]'
SystemDiskSize:
Default: 40
Type: Number
Description:
zh-cn: 系統硬碟大小, 取值範圍:[40, 500], 單位:GB。
en: 'System disk size, range of values: 40-500, units: GB.'
Label:
zh-cn: 系統硬碟空間
en: System Disk Space
Resources:
OpsEcsInstance:
Type: ALIYUN::ECS::Instance
Properties:
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::GetAtt:
- ProdEcsInstance
- PrivateIp
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::Instance
Properties:
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",
"Metadata": {},
"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": "可用性區域ID。<br><b>註: <font color='blue'>選擇前請確認該可用性區域是否支援建立ECS資源的規格,建議與其他交換器可用性區域不同</font></b>",
"en": "Availability Zone ID.<br><b>note:<font color='blue'>before selecting, please confirm that the Availability Zone supports the specification of creating ECS resources,which is recommended to be different from other VSwitch Availability Zone</font></b>"
},
"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",
"AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
"AssociationPropertyMetadata": {
"ZoneId": "${VSwitchZoneId}",
"InstanceType": "${InstanceType}"
},
"Label": {
"en": "System Disk Type",
"zh-cn": "系統硬碟類型"
},
"Description": {
"en": "<font color='blue'><b>Optional values:</b></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>]",
"zh-cn": "<font color='blue'><b>可選值:</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>]"
}
},
"SystemDiskSize": {
"Default": 40,
"Type": "Number",
"Description": {
"zh-cn": "系統硬碟大小, 取值範圍:[40, 500], 單位:GB。",
"en": "System disk size, range of values: 40-500, units: GB."
},
"Label": {
"zh-cn": "系統硬碟空間",
"en": "System Disk Space"
}
}
},
"Resources": {
"OpsEcsInstance": {
"Type": "ALIYUN::ECS::Instance",
"Properties": {
"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::GetAtt": [
"ProdEcsInstance",
"PrivateIp"
]
},
"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::Instance",
"Properties": {
"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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 建立ECS執行個體,配置VPC、安全性群組、多IP地址、系統硬碟及網路介面,支援自訂執行個體規格、鏡像和網路設定。
en: Create an ECS instance, configure VPC, security group, multiple IP addresses, system disk and network interface, and support customizing instance specifications, mirroring and network settings.
Parameters:
EcsInstanceType:
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: VSwitchZoneId
Type: String
Description:
zh-cn: <font color='blue'><b>1.選擇機型前請先確認當前可用性區域下該機型是否有貨,部分機型需要提前報備</b></font><br><font color='blue'><b>2.可選機型列表</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU 4GiB 內網頻寬1Gbps 內網收發包30萬PPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB 內網頻寬1.5Gbps 內網收發包50萬PPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB 內網頻寬2.5Gbps 內網收發包80萬PPS</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.c5.large <font color='green'>2vCPU 4GiB Intranet bandwidth1Gbps In-grid sending and receiving packages30MillionPPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB Intranet bandwidth1.5Gbps In-grid sending and receiving packages50MillionPPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB Intranet bandwidth2.5Gbps In-grid sending and receiving packages80MillionPPS</font>]
Label:
zh-cn: 執行個體規格
en: Instance Type
VSwitchZoneId:
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Type: String
Description:
zh-cn: 可用性區域ID,<br><b>註: <font color='blue'>選擇可用性區域前請確認該可用性區域是否支援建立ECS資源的規格</font></b>
en: Availability Zone ID,<br><b>note: <font color='blue'>Before selecting, please confirm that the Availability Zone supports the specification of creating ECS resources</font></b>
Label:
zh-cn: 交換器可用性區域
en: VSwitch Availability Zone
EcsSystemDiskSize:
Default: 40
Type: Number
Description:
zh-cn: 系統硬碟大小, 取值範圍:[40, 500], 單位:GB。
en: 'System disk size, range of values: 40-500, units: GB.'
Label:
zh-cn: 系統硬碟空間
en: System Disk Space
EcsPassword:
Description:
zh-cn: 伺服器登入密碼,長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。
en: Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).
Type: String
Label:
zh-cn: 執行個體密碼
en: Instance Password
NoEcho: true
AssociationProperty: ALIYUN::ECS::Instance::Password
ConstraintDescription:
zh-cn: 長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。
en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).
EcsImageId:
AssociationPropertyMetadata:
InstanceType: ${EcsInstanceType}
SupportedImageOwnerAlias:
- system
- self
- others
Description:
zh-cn: 執行個體鏡像,詳見:<b><a href='https://www.alibabacloud.com/help/document_detail/112977.html' target='_blank'><font color='blue'>尋找鏡像</font></a></b>
en: 'Instance Image ID. see detail: <b><a href=''https://www.alibabacloud.com/help/doc-detail/112977.html'' target=''_blank''><font color=''blue''>Find the mirror</font></a></b>'
Default: centos_7_04_64_20G_alibase_201701015.vhd
Label:
zh-cn: 鏡像ID
en: Image ID
AssociationProperty: ALIYUN::ECS::Image::ImageId
Type: String
EcsSystemDiskCategory:
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
LocaleKey: DiskCategory
InstanceType: ${EcsInstanceType}
Type: String
Description:
zh-cn: '<font color=''blue''><b>可選值:</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>]'
en: '<font color=''blue''><b>Optional values:</b></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>]'
Label:
zh-cn: 系統硬碟類型
en: System Disk Type
IpAddressCount:
Description:
zh-cn: 取值範圍:1-9。
en: 'Allowed values: 1~9.'
Default: 1
MaxValue: 9
MinValue: 1
Label:
zh-cn: 網卡分配IPv4數量
en: Number of IPv4 Network Card
Type: Number
Outputs:
InstanceId:
Value:
Ref: EcsInstance
EIP:
Value:
Fn::GetAtt:
- Eip
- EipAddress
PrimaryPrivateIPAddress:
Value:
Fn::GetAtt:
- EcsInstance
- PrivateIp
AddPrivateIPAddressList:
Value:
Fn::GetAtt:
- EcsAssignPrivateIpAddresses
- PrivateIpAddresses
Resources:
EcsAssignPrivateIpAddresses:
Type: ALIYUN::ECS::AssignPrivateIpAddresses
Properties:
NetworkInterfaceId:
Ref: EcsENI
SecondaryPrivateIpAddressCount:
Ref: IpAddressCount
DependsOn:
- EcsENI
EcsENI:
Type: ALIYUN::ECS::NetworkInterface
Properties:
SecurityGroupId:
Ref: EcsSecurityGroup
VSwitchId:
Ref: EcsVSwitch
EcsSecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: EcsVpc
SecurityGroupName:
Fn::Join:
- _
- - StackId
- Ref: ALIYUN::StackId
Eip:
Type: ALIYUN::VPC::EIP
Properties:
InternetChargeType: PayByTraffic
InstanceChargeType: Postpaid
EcsVSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
VSwitchName:
Fn::Join:
- _
- - StackId
- Ref: ALIYUN::StackId
VpcId:
Ref: EcsVpc
CidrBlock: 192.168.0.0/24
ZoneId:
Ref: VSwitchZoneId
EcsEniAttachment:
Type: ALIYUN::ECS::NetworkInterfaceAttachment
Properties:
InstanceId:
Ref: EcsInstance
NetworkInterfaceId:
Ref: EcsENI
DependsOn:
- EcsInstance
- EipAssociation
EcsInstance:
Type: ALIYUN::ECS::Instance
Properties:
SystemDiskCategory:
Ref: EcsSystemDiskCategory
VpcId:
Ref: EcsVpc
SecurityGroupId:
Ref: EcsSecurityGroup
SystemDiskSize:
Ref: EcsSystemDiskSize
ImageId:
Ref: EcsImageId
AllocatePublicIP: false
InstanceChargeType: PostPaid
VSwitchId:
Ref: EcsVSwitch
IoOptimized: optimized
Password:
Ref: EcsPassword
InstanceType:
Ref: EcsInstanceType
EcsVpc:
Type: ALIYUN::ECS::VPC
Properties:
VpcName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
CidrBlock: 192.168.0.0/16
EipAssociation:
Type: ALIYUN::VPC::EIPAssociation
Properties:
InstanceId:
Ref: EcsENI
AllocationId:
Ref: Eip
Mode: NAT
DependsOn:
- EcsAssignPrivateIpAddresses
- Eip
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VSwitchZoneId
- IpAddressCount
Label:
default:
zh-cn: 專用網路
en: VPC
- Parameters:
- EcsInstanceType
- EcsImageId
- EcsSystemDiskCategory
- EcsSystemDiskSize
- EcsPassword
Label:
default:
zh-cn: 雲端服務器
en: ECS
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "建立ECS執行個體,配置VPC、安全性群組、多IP地址、系統硬碟及網路介面,支援自訂執行個體規格、鏡像和網路設定。",
"en": "Create an ECS instance, configure VPC, security group, multiple IP addresses, system disk and network interface, and support customizing instance specifications, mirroring and network settings."
},
"Parameters": {
"EcsInstanceType": {
"AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
"AssociationPropertyMetadata": {
"ZoneId": "VSwitchZoneId"
},
"Type": "String",
"Description": {
"zh-cn": "<font color='blue'><b>1.選擇機型前請先確認當前可用性區域下該機型是否有貨,部分機型需要提前報備</b></font><br><font color='blue'><b>2.可選機型列表</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU 4GiB 內網頻寬1Gbps 內網收發包30萬PPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB 內網頻寬1.5Gbps 內網收發包50萬PPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB 內網頻寬2.5Gbps 內網收發包80萬PPS</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.c5.large <font color='green'>2vCPU 4GiB Intranet bandwidth1Gbps In-grid sending and receiving packages30MillionPPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB Intranet bandwidth1.5Gbps In-grid sending and receiving packages50MillionPPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB Intranet bandwidth2.5Gbps In-grid sending and receiving packages80MillionPPS</font>]"
},
"Label": {
"zh-cn": "執行個體規格",
"en": "Instance Type"
}
},
"VSwitchZoneId": {
"AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
"Type": "String",
"Description": {
"zh-cn": "可用性區域ID,<br><b>註: <font color='blue'>選擇可用性區域前請確認該可用性區域是否支援建立ECS資源的規格</font></b>",
"en": "Availability Zone ID,<br><b>note: <font color='blue'>Before selecting, please confirm that the Availability Zone supports the specification of creating ECS resources</font></b>"
},
"Label": {
"zh-cn": "交換器可用性區域",
"en": "VSwitch Availability Zone"
}
},
"EcsSystemDiskSize": {
"Default": 40,
"Type": "Number",
"Description": {
"zh-cn": "系統硬碟大小, 取值範圍:[40, 500], 單位:GB。",
"en": "System disk size, range of values: 40-500, units: GB."
},
"Label": {
"zh-cn": "系統硬碟空間",
"en": "System Disk Space"
}
},
"EcsPassword": {
"Description": {
"zh-cn": "伺服器登入密碼,長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。",
"en": "Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)."
},
"Type": "String",
"Label": {
"zh-cn": "執行個體密碼",
"en": "Instance Password"
},
"NoEcho": true,
"AssociationProperty": "ALIYUN::ECS::Instance::Password",
"ConstraintDescription": {
"zh-cn": "長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。",
"en": "Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)."
}
},
"EcsImageId": {
"AssociationPropertyMetadata": {
"InstanceType": "${EcsInstanceType}",
"SupportedImageOwnerAlias": [
"system",
"self",
"others"
]
},
"Description": {
"zh-cn": "執行個體鏡像,詳見:<b><a href='https://www.alibabacloud.com/help/document_detail/112977.html' target='_blank'><font color='blue'>尋找鏡像</font></a></b>",
"en": "Instance Image ID. see detail: <b><a href='https://www.alibabacloud.com/help/doc-detail/112977.html' target='_blank'><font color='blue'>Find the mirror</font></a></b>"
},
"Default": "centos_7_04_64_20G_alibase_201701015.vhd",
"Label": {
"zh-cn": "鏡像ID",
"en": "Image ID"
},
"AssociationProperty": "ALIYUN::ECS::Image::ImageId",
"Type": "String"
},
"EcsSystemDiskCategory": {
"AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
"AssociationPropertyMetadata": {
"LocaleKey": "DiskCategory",
"InstanceType": "${EcsInstanceType}"
},
"Type": "String",
"Description": {
"zh-cn": "<font color='blue'><b>可選值:</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>]",
"en": "<font color='blue'><b>Optional values:</b></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>]"
},
"Label": {
"zh-cn": "系統硬碟類型",
"en": "System Disk Type"
}
},
"IpAddressCount": {
"Description": {
"zh-cn": "取值範圍:1-9。",
"en": "Allowed values: 1~9."
},
"Default": 1,
"MaxValue": 9,
"MinValue": 1,
"Label": {
"zh-cn": "網卡分配IPv4數量",
"en": "Number of IPv4 Network Card"
},
"Type": "Number"
}
},
"Outputs": {
"InstanceId": {
"Value": {
"Ref": "EcsInstance"
}
},
"EIP": {
"Value": {
"Fn::GetAtt": [
"Eip",
"EipAddress"
]
}
},
"PrimaryPrivateIPAddress": {
"Value": {
"Fn::GetAtt": [
"EcsInstance",
"PrivateIp"
]
}
},
"AddPrivateIPAddressList": {
"Value": {
"Fn::GetAtt": [
"EcsAssignPrivateIpAddresses",
"PrivateIpAddresses"
]
}
}
},
"Resources": {
"EcsAssignPrivateIpAddresses": {
"Type": "ALIYUN::ECS::AssignPrivateIpAddresses",
"Properties": {
"NetworkInterfaceId": {
"Ref": "EcsENI"
},
"SecondaryPrivateIpAddressCount": {
"Ref": "IpAddressCount"
}
},
"DependsOn": [
"EcsENI"
]
},
"EcsENI": {
"Type": "ALIYUN::ECS::NetworkInterface",
"Properties": {
"SecurityGroupId": {
"Ref": "EcsSecurityGroup"
},
"VSwitchId": {
"Ref": "EcsVSwitch"
}
}
},
"EcsSecurityGroup": {
"Type": "ALIYUN::ECS::SecurityGroup",
"Properties": {
"VpcId": {
"Ref": "EcsVpc"
},
"SecurityGroupName": {
"Fn::Join": [
"_",
[
"StackId",
{
"Ref": "ALIYUN::StackId"
}
]
]
}
}
},
"Eip": {
"Type": "ALIYUN::VPC::EIP",
"Properties": {
"InternetChargeType": "PayByTraffic",
"InstanceChargeType": "Postpaid"
}
},
"EcsVSwitch": {
"Type": "ALIYUN::ECS::VSwitch",
"Properties": {
"VSwitchName": {
"Fn::Join": [
"_",
[
"StackId",
{
"Ref": "ALIYUN::StackId"
}
]
]
},
"VpcId": {
"Ref": "EcsVpc"
},
"CidrBlock": "192.168.0.0/24",
"ZoneId": {
"Ref": "VSwitchZoneId"
}
}
},
"EcsEniAttachment": {
"Type": "ALIYUN::ECS::NetworkInterfaceAttachment",
"Properties": {
"InstanceId": {
"Ref": "EcsInstance"
},
"NetworkInterfaceId": {
"Ref": "EcsENI"
}
},
"DependsOn": [
"EcsInstance",
"EipAssociation"
]
},
"EcsInstance": {
"Type": "ALIYUN::ECS::Instance",
"Properties": {
"SystemDiskCategory": {
"Ref": "EcsSystemDiskCategory"
},
"VpcId": {
"Ref": "EcsVpc"
},
"SecurityGroupId": {
"Ref": "EcsSecurityGroup"
},
"SystemDiskSize": {
"Ref": "EcsSystemDiskSize"
},
"ImageId": {
"Ref": "EcsImageId"
},
"AllocatePublicIP": false,
"InstanceChargeType": "PostPaid",
"VSwitchId": {
"Ref": "EcsVSwitch"
},
"IoOptimized": "optimized",
"Password": {
"Ref": "EcsPassword"
},
"InstanceType": {
"Ref": "EcsInstanceType"
}
}
},
"EcsVpc": {
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"VpcName": {
"Fn::Join": [
"-",
[
"StackId",
{
"Ref": "ALIYUN::StackId"
}
]
]
},
"CidrBlock": "192.168.0.0/16"
}
},
"EipAssociation": {
"Type": "ALIYUN::VPC::EIPAssociation",
"Properties": {
"InstanceId": {
"Ref": "EcsENI"
},
"AllocationId": {
"Ref": "Eip"
},
"Mode": "NAT"
},
"DependsOn": [
"EcsAssignPrivateIpAddresses",
"Eip"
]
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"VSwitchZoneId",
"IpAddressCount"
],
"Label": {
"default": {
"zh-cn": "專用網路",
"en": "VPC"
}
}
},
{
"Parameters": [
"EcsInstanceType",
"EcsImageId",
"EcsSystemDiskCategory",
"EcsSystemDiskSize",
"EcsPassword"
],
"Label": {
"default": {
"zh-cn": "雲端服務器",
"en": "ECS"
}
}
}
]
}
}
}情境 3 :建立ECS和彈性IP並掛載多個資料盤。
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 建立ECS執行個體,配置彈性IP,掛載2個資料盤,設定網路環境與安全性群組規則。
en: Create an ECS instance, configure elastic IP, mount 2 data disks, and set network environment and security group rules.
Parameters:
FirstDataDiskCategory:
AssociationProperty: ALIYUN::ECS::Disk::DataDiskCategory
AssociationPropertyMetadata:
InstanceType: ${InstanceType}
ZoneId: ${ZoneId}
Type: String
Label:
zh-cn: 資料盤1的磁碟類別
en: First Data Disk Category
SystemDiskCategory:
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
InstanceType: InstanceType
ZoneId: ZoneId
Type: String
Label:
zh-cn: 系統硬碟類型
en: System Disk Type
SecondDataDiskSize:
Default: 40
Type: Number
Description:
zh-cn: 第二個資料盤的大小,單位為GB。值範圍:cloud:[5,2000]、cloud_efficiency:[20,32768]、cloud_ssd:[20,32768]、ephemeral_ssd:[5,800]。該值應等於或大於特定快照。
en: 'The size of the Second volume, unit in GB.Value range: cloud: [5,2000], cloud_efficiency: [20,32768], cloud_ssd: [20,32768], ephemeral_ssd: [5,800].The value should be equal to or greater than the specific snapshot.'
Label:
zh-cn: 資料盤2的磁碟大小
en: Second Data Disk Size
SystemDiskSize:
Default: 40
Type: Number
Description:
zh-cn: 系統硬碟的大小,單位為GB。值範圍:cloud:[5,2000]、cloud_efficiency:[20,32768]、cloud_ssd:[20,32768]、ephemeral_ssd:[5,800]。該值應等於或大於特定快照。
en: 'Disk size of the system disk, unit in GB.Value range: cloud: [5,2000], cloud_efficiency: [20,32768], cloud_ssd: [20,32768], ephemeral_ssd: [5,800].The value should be equal to or greater than the specific snapshot.'
Label:
zh-cn: 系統硬碟大小
en: System Disk Space
VpcCidrBlock:
Default: 192.168.0.0/16
Label:
zh-cn: 專用網路網段
en: VPC CIDR Block
Type: String
Description:
zh-cn: 建立專用網路IP位址區段範圍,推薦使用以下的IP位址區段<br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>
en: New proprietary network IP address segment range, recommended use of the following IP address segments<br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>
AllowedValues:
- 192.168.0.0/16
- 172.16.0.0/12
- 10.0.0.0/8
FirstDataDiskSize:
Default: 40
Type: Number
Description:
zh-cn: 第一個資料盤的大小,單位為GB。值範圍:cloud:[5,2000]、cloud_efficiency:[20,32768]、cloud_ssd:[20,32768]、ephemeral_ssd:[5,800]。該值應等於或大於特定快照。
en: 'The size of the first volume, unit in GB.Value range: cloud: [5,2000], cloud_efficiency: [20,32768], cloud_ssd: [20,32768], ephemeral_ssd: [5,800].The value should be equal to or greater than the specific snapshot.'
Label:
zh-cn: 資料盤1的磁碟容量
en: First Data Disk Size
SecondDataDiskCategory:
AssociationProperty: ALIYUN::ECS::Disk::DataDiskCategory
AssociationPropertyMetadata:
InstanceType: ${InstanceType}
ZoneId: ${ZoneId}
Type: String
Label:
zh-cn: 資料盤2的磁碟類別
en: Second Data Disk Category
VSwitchCidrBlock:
Default: 192.168.0.0/24
Type: String
Description:
zh-cn: 建立交換器的網段,所屬Virtual Private Cloud絡的子網
en: Network segments of new switches, subnets of virtual proprietary networks
Label:
zh-cn: 交換器網段
en: VSwitch CIDR Block
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,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。
en: Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).
MinLength: 8
Label:
zh-cn: 執行個體密碼
en: Instance Password
AllowedPattern: '[a-zA-Z0-9-\(\)\`\~\!@\#\$%\^&\*-+=\|\{\}\[\]\:\;\‘\,\.\?\/]*'
NoEcho: true
MaxLength: 30
Type: String
InstanceType:
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
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.c5.large <font color='green'>2vCPU 4GiB 內網頻寬1Gbps 內網收發包30萬PPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB 內網頻寬1.5Gbps 內網收發包50萬PPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB 內網頻寬2.5Gbps 內網收發包80萬PPS</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.c5.large <font color='green'>2vCPU 4GiB Intranet bandwidth1Gbps In-grid sending and receiving packages30MillionPPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB Intranet bandwidth1.5Gbps In-grid sending and receiving packages50MillionPPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB Intranet bandwidth2.5Gbps In-grid sending and receiving packages80MillionPPS</font>]
Label:
zh-cn: 執行個體規格
en: Instance Type
ZoneId:
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Type: String
Description:
zh-cn: 可用性區域ID。<br><b>註: <font color='blue'>選擇前請確認該可用性區域是否支援建立ECS資源的規格,建議與其他交換器可用性區域不同</font></b>
en: Availability Zone ID.<br><b>note:<font color='blue'>before selecting, please confirm that the Availability Zone supports the specification of creating ECS resources,which is recommended to be different from other VSwitch Availability Zone</font></b>
Label:
zh-cn: 交換器可用性區域
en: VSwitch Availability Zone
ImageId:
AssociationPropertyMetadata:
InstanceType: ${InstanceType}
SupportedImageOwnerAlias:
- system
- self
- others
Description:
zh-cn: 鏡像ID, 詳見:<b><a href='https://www.alibabacloud.com/help/document_detail/112977.html' target='_blank'><font color='blue'>尋找鏡像</font></a></b>
en: Image ID,See detail:<b><a href='https://www.alibabacloud.com/help/doc-detail/112977.html' target='_blank'><font color='blue'>Find the mirror</font></a></b>
Default: centos_7_04_64_20G_alibase_201701015.vhd
Label:
zh-cn: 鏡像ID
en: Image ID
AssociationProperty: ALIYUN::ECS::Image::ImageId
Type: String
Outputs:
VpcId:
Description: Id of created VPC.
Value:
Fn::GetAtt:
- Vpc
- VpcId
InstanceId:
Description: The instance id of created ecs instance.
Value:
Fn::GetAtt:
- WebServer
- InstanceId
SecurityGroupId:
Description: generated security group id for security group.
Value:
Fn::GetAtt:
- SecurityGroup
- SecurityGroupId
EipId:
Description: ID that Aliyun assigns to represent the allocation of the address for use with VPC. Returned only for VPC elastic IP addresses.
Value:
Fn::GetAtt:
- Eip
- AllocationId
ZoneId:
Description: Zone ID of created instance.
Value:
Fn::GetAtt:
- WebServer
- ZoneId
VSwitchId:
Description: Id of created VSwitch.
Value:
Fn::GetAtt:
- VSwitch
- VSwitchId
Resources:
EIPBind:
Type: ALIYUN::VPC::EIPAssociation
Properties:
InstanceId:
Ref: WebServer
AllocationId:
Ref: Eip
Metadata:
ALIYUN::ROS::Designer:
id: ece3b051-66c9-46d6-9961-f184d342b21f
Eip:
Type: ALIYUN::VPC::EIP
Properties:
InternetChargeType: PayByTraffic
Bandwidth: 1
Metadata:
ALIYUN::ROS::Designer:
id: a914d36e-d429-46d6-bbd0-a22acd07b096
SecurityGroupEgress:
Type: ALIYUN::ECS::SecurityGroupEgress
Properties:
DestCidrIp: 0.0.0.0/0
IpProtocol: all
SecurityGroupId:
Ref: SecurityGroup
NicType: intranet
PortRange: '-1/-1'
Metadata:
ALIYUN::ROS::Designer:
id: faa26b3c-3507-41e9-9959-5db9a9e67446
SecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: Vpc
Metadata:
ALIYUN::ROS::Designer:
id: fde92bb4-877d-4e7b-b9dd-be6f5e552544
SecurityGroupIngress:
Type: ALIYUN::ECS::SecurityGroupIngress
Properties:
IpProtocol: all
SecurityGroupId:
Ref: SecurityGroup
NicType: intranet
SourceCidrIp: 0.0.0.0/0
PortRange: '-1/-1'
Metadata:
ALIYUN::ROS::Designer:
id: 2a6cfdef-e236-4966-a976-dd7e7bbc37a5
WebServer:
Type: ALIYUN::ECS::Instance
Properties:
UserData:
Fn::Join:
- ''
- - |
#!/bin/sh
- |
logs=~/mount_logs
- |
i=1
- |
total=2
- |
while [ $i -le $total ]
- |
do
- |2
disk_suffix=`echo $i|awk '{printf "%c", 97+$i}'`
- |
fdisk -S 56 /dev/vd$disk_suffix <<ESXU
- |
n
- |
p
- |
1
- |+
- |+
- |
w
- |
ESXU
- |2
echo "/dev/vd$disk_suffix is fdisked!" >> $logs
- |2
mkfs.ext4 /dev/vd${disk_suffix}1
- |2
if [ $? -eq 0 ];then
- |2
echo "/dev/vd${disk_suffix}1 is formated!" >> $logs
- |2
fi
- |2
touch ~/test_ftab
- |2
mkdir $disk_suffix$i
- |2
disk_uuid=`blkid | grep /dev/vd${disk_suffix}1 |awk '{printf $2}'|sed 's/\"//g'`
- |
cat << ESXU > ~/test_ftab
- |
$disk_uuid $disk_suffix$i ext4 defaults 0 0
- |
ESXU
- |2
cat ~/test_ftab >> /etc/fstab
- |2
mount -a
- |2
chmod -R 777 $disk_suffix$i
- |2
rm -rf ~/test_ftab
- |2
echo "/dev/vd${disk_suffix}1 is mounted!" >> $logs
- |2
let i+=1
- |
done
SystemDiskCategory:
Ref: SystemDiskCategory
VpcId:
Ref: Vpc
SecurityGroupId:
Ref: SecurityGroup
SystemDiskSize:
Ref: SystemDiskSize
ImageId:
Ref: ImageId
AllocatePublicIP: 'false'
VSwitchId:
Ref: VSwitch
IoOptimized: optimized
Password:
Ref: Password
DiskMappings:
- Category:
Ref: FirstDataDiskCategory
Size:
Ref: FirstDataDiskSize
- Category:
Ref: SecondDataDiskCategory
Size:
Ref: SecondDataDiskSize
InstanceType:
Ref: InstanceType
Metadata:
ALIYUN::ROS::Designer:
id: 4f476130-0cde-4cff-a973-2cb026e18f13
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock:
Ref: VpcCidrBlock
Metadata:
ALIYUN::ROS::Designer:
id: adfdd097-9c30-49ff-8738-ae3b59eada43
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
CidrBlock:
Ref: VSwitchCidrBlock
ZoneId:
Ref: ZoneId
Metadata:
ALIYUN::ROS::Designer:
id: bd814869-3bd7-4551-a5db-0ec7ad3d3246
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- ZoneId
- VpcCidrBlock
- VSwitchCidrBlock
Label:
default:
zh-cn: 基礎資源配置(必填)
en: Infrastructure Configuration
- Parameters:
- InstanceType
- ImageId
- Password
Label:
default:
zh-cn: ECS 配置(必填)
en: ECS Configuration
- Parameters:
- SystemDiskSize
- SystemDiskCategory
- FirstDataDiskSize
- FirstDataDiskCategory
- SecondDataDiskSize
- SecondDataDiskCategory
Label:
default:
zh-cn: ECS 磁碟配置(必填)
en: ECS Disk Configuration
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "建立ECS執行個體,配置彈性IP,掛載2個資料盤,設定網路環境與安全性群組規則。",
"en": "Create an ECS instance, configure elastic IP, mount 2 data disks, and set network environment and security group rules."
},
"Parameters": {
"FirstDataDiskCategory": {
"AssociationProperty": "ALIYUN::ECS::Disk::DataDiskCategory",
"AssociationPropertyMetadata": {
"InstanceType": "${InstanceType}",
"ZoneId": "${ZoneId}"
},
"Type": "String",
"Label": {
"zh-cn": "資料盤1的磁碟類別",
"en": "First Data Disk Category"
}
},
"SystemDiskCategory": {
"AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
"AssociationPropertyMetadata": {
"InstanceType": "InstanceType",
"ZoneId": "ZoneId"
},
"Type": "String",
"Label": {
"zh-cn": "系統硬碟類型",
"en": "System Disk Type"
}
},
"SecondDataDiskSize": {
"Default": 40,
"Type": "Number",
"Description": {
"zh-cn": "第二個資料盤的大小,單位為GB。值範圍:cloud:[5,2000]、cloud_efficiency:[20,32768]、cloud_ssd:[20,32768]、ephemeral_ssd:[5,800]。該值應等於或大於特定快照。",
"en": "The size of the Second volume, unit in GB.Value range: cloud: [5,2000], cloud_efficiency: [20,32768], cloud_ssd: [20,32768], ephemeral_ssd: [5,800].The value should be equal to or greater than the specific snapshot."
},
"Label": {
"zh-cn": "資料盤2的磁碟大小",
"en": "Second Data Disk Size"
}
},
"SystemDiskSize": {
"Default": 40,
"Type": "Number",
"Description": {
"zh-cn": "系統硬碟的大小,單位為GB。值範圍:cloud:[5,2000]、cloud_efficiency:[20,32768]、cloud_ssd:[20,32768]、ephemeral_ssd:[5,800]。該值應等於或大於特定快照。",
"en": "Disk size of the system disk, unit in GB.Value range: cloud: [5,2000], cloud_efficiency: [20,32768], cloud_ssd: [20,32768], ephemeral_ssd: [5,800].The value should be equal to or greater than the specific snapshot."
},
"Label": {
"zh-cn": "系統硬碟大小",
"en": "System Disk Space"
}
},
"VpcCidrBlock": {
"Default": "192.168.0.0/16",
"Label": {
"zh-cn": "專用網路網段",
"en": "VPC CIDR Block"
},
"Type": "String",
"Description": {
"zh-cn": "建立專用網路IP位址區段範圍,推薦使用以下的IP位址區段<br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>",
"en": "New proprietary network IP address segment range, recommended use of the following IP address segments<br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>"
},
"AllowedValues": [
"192.168.0.0/16",
"172.16.0.0/12",
"10.0.0.0/8"
]
},
"FirstDataDiskSize": {
"Default": 40,
"Type": "Number",
"Description": {
"zh-cn": "第一個資料盤的大小,單位為GB。值範圍:cloud:[5,2000]、cloud_efficiency:[20,32768]、cloud_ssd:[20,32768]、ephemeral_ssd:[5,800]。該值應等於或大於特定快照。",
"en": "The size of the first volume, unit in GB.Value range: cloud: [5,2000], cloud_efficiency: [20,32768], cloud_ssd: [20,32768], ephemeral_ssd: [5,800].The value should be equal to or greater than the specific snapshot."
},
"Label": {
"zh-cn": "資料盤1的磁碟容量",
"en": "First Data Disk Size"
}
},
"SecondDataDiskCategory": {
"AssociationProperty": "ALIYUN::ECS::Disk::DataDiskCategory",
"AssociationPropertyMetadata": {
"InstanceType": "${InstanceType}",
"ZoneId": "${ZoneId}"
},
"Type": "String",
"Label": {
"zh-cn": "資料盤2的磁碟類別",
"en": "Second Data Disk Category"
}
},
"VSwitchCidrBlock": {
"Default": "192.168.0.0/24",
"Type": "String",
"Description": {
"zh-cn": "建立交換器的網段,所屬Virtual Private Cloud絡的子網",
"en": "Network segments of new switches, subnets of virtual proprietary networks"
},
"Label": {
"zh-cn": "交換器網段",
"en": "VSwitch CIDR Block"
}
},
"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,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。",
"en": "Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)."
},
"MinLength": 8,
"Label": {
"zh-cn": "執行個體密碼",
"en": "Instance Password"
},
"AllowedPattern": "[a-zA-Z0-9-\\(\\)\\`\\~\\!@\\#\\$%\\^&\\*-+=\\|\\{\\}\\[\\]\\:\\;\\‘\\,\\.\\?\\/]*",
"NoEcho": true,
"MaxLength": 30,
"Type": "String"
},
"InstanceType": {
"AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
"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.c5.large <font color='green'>2vCPU 4GiB 內網頻寬1Gbps 內網收發包30萬PPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB 內網頻寬1.5Gbps 內網收發包50萬PPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB 內網頻寬2.5Gbps 內網收發包80萬PPS</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.c5.large <font color='green'>2vCPU 4GiB Intranet bandwidth1Gbps In-grid sending and receiving packages30MillionPPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB Intranet bandwidth1.5Gbps In-grid sending and receiving packages50MillionPPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB Intranet bandwidth2.5Gbps In-grid sending and receiving packages80MillionPPS</font>]"
},
"Label": {
"zh-cn": "執行個體規格",
"en": "Instance Type"
}
},
"ZoneId": {
"AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
"Type": "String",
"Description": {
"zh-cn": "可用性區域ID。<br><b>註: <font color='blue'>選擇前請確認該可用性區域是否支援建立ECS資源的規格,建議與其他交換器可用性區域不同</font></b>",
"en": "Availability Zone ID.<br><b>note:<font color='blue'>before selecting, please confirm that the Availability Zone supports the specification of creating ECS resources,which is recommended to be different from other VSwitch Availability Zone</font></b>"
},
"Label": {
"zh-cn": "交換器可用性區域",
"en": "VSwitch Availability Zone"
}
},
"ImageId": {
"AssociationPropertyMetadata": {
"InstanceType": "${InstanceType}",
"SupportedImageOwnerAlias": [
"system",
"self",
"others"
]
},
"Description": {
"zh-cn": "鏡像ID, 詳見:<b><a href='https://www.alibabacloud.com/help/document_detail/112977.html' target='_blank'><font color='blue'>尋找鏡像</font></a></b>",
"en": "Image ID,See detail:<b><a href='https://www.alibabacloud.com/help/doc-detail/112977.html' target='_blank'><font color='blue'>Find the mirror</font></a></b>"
},
"Default": "centos_7_04_64_20G_alibase_201701015.vhd",
"Label": {
"zh-cn": "鏡像ID",
"en": "Image ID"
},
"AssociationProperty": "ALIYUN::ECS::Image::ImageId",
"Type": "String"
}
},
"Outputs": {
"VpcId": {
"Description": "Id of created VPC.",
"Value": {
"Fn::GetAtt": [
"Vpc",
"VpcId"
]
}
},
"InstanceId": {
"Description": "The instance id of created ecs instance.",
"Value": {
"Fn::GetAtt": [
"WebServer",
"InstanceId"
]
}
},
"SecurityGroupId": {
"Description": "generated security group id for security group.",
"Value": {
"Fn::GetAtt": [
"SecurityGroup",
"SecurityGroupId"
]
}
},
"EipId": {
"Description": "ID that Aliyun assigns to represent the allocation of the address for use with VPC. Returned only for VPC elastic IP addresses.",
"Value": {
"Fn::GetAtt": [
"Eip",
"AllocationId"
]
}
},
"ZoneId": {
"Description": "Zone ID of created instance.",
"Value": {
"Fn::GetAtt": [
"WebServer",
"ZoneId"
]
}
},
"VSwitchId": {
"Description": "Id of created VSwitch.",
"Value": {
"Fn::GetAtt": [
"VSwitch",
"VSwitchId"
]
}
}
},
"Resources": {
"EIPBind": {
"Type": "ALIYUN::VPC::EIPAssociation",
"Properties": {
"InstanceId": {
"Ref": "WebServer"
},
"AllocationId": {
"Ref": "Eip"
}
},
"Metadata": {
"ALIYUN::ROS::Designer": {
"id": "ece3b051-66c9-46d6-9961-f184d342b21f"
}
}
},
"Eip": {
"Type": "ALIYUN::VPC::EIP",
"Properties": {
"InternetChargeType": "PayByTraffic",
"Bandwidth": 1
},
"Metadata": {
"ALIYUN::ROS::Designer": {
"id": "a914d36e-d429-46d6-bbd0-a22acd07b096"
}
}
},
"SecurityGroupEgress": {
"Type": "ALIYUN::ECS::SecurityGroupEgress",
"Properties": {
"DestCidrIp": "0.0.0.0/0",
"IpProtocol": "all",
"SecurityGroupId": {
"Ref": "SecurityGroup"
},
"NicType": "intranet",
"PortRange": "-1/-1"
},
"Metadata": {
"ALIYUN::ROS::Designer": {
"id": "faa26b3c-3507-41e9-9959-5db9a9e67446"
}
}
},
"SecurityGroup": {
"Type": "ALIYUN::ECS::SecurityGroup",
"Properties": {
"VpcId": {
"Ref": "Vpc"
}
},
"Metadata": {
"ALIYUN::ROS::Designer": {
"id": "fde92bb4-877d-4e7b-b9dd-be6f5e552544"
}
}
},
"SecurityGroupIngress": {
"Type": "ALIYUN::ECS::SecurityGroupIngress",
"Properties": {
"IpProtocol": "all",
"SecurityGroupId": {
"Ref": "SecurityGroup"
},
"NicType": "intranet",
"SourceCidrIp": "0.0.0.0/0",
"PortRange": "-1/-1"
},
"Metadata": {
"ALIYUN::ROS::Designer": {
"id": "2a6cfdef-e236-4966-a976-dd7e7bbc37a5"
}
}
},
"WebServer": {
"Type": "ALIYUN::ECS::Instance",
"Properties": {
"UserData": {
"Fn::Join": [
"",
[
"#!/bin/sh\n",
"logs=~/mount_logs\n",
"i=1\n",
"total=2\n",
"while [ $i -le $total ]\n",
"do\n",
" disk_suffix=`echo $i|awk '{printf \"%c\", 97+$i}'`\n",
"fdisk -S 56 /dev/vd$disk_suffix <<ESXU\n",
"n\n",
"p\n",
"1\n",
"\n",
"\n",
"w\n",
"ESXU\n",
" echo \"/dev/vd$disk_suffix is fdisked!\" >> $logs\n",
" mkfs.ext4 /dev/vd${disk_suffix}1\n",
" if [ $? -eq 0 ];then\n",
" echo \"/dev/vd${disk_suffix}1 is formated!\" >> $logs\n",
" fi\n",
" touch ~/test_ftab\n",
" mkdir $disk_suffix$i\n",
" disk_uuid=`blkid | grep /dev/vd${disk_suffix}1 |awk '{printf $2}'|sed 's/\\\"//g'`\n",
"cat << ESXU > ~/test_ftab\n",
"$disk_uuid $disk_suffix$i ext4 defaults 0 0\n",
"ESXU\n",
" cat ~/test_ftab >> /etc/fstab\n",
" mount -a\n",
" chmod -R 777 $disk_suffix$i\n",
" rm -rf ~/test_ftab\n",
" echo \"/dev/vd${disk_suffix}1 is mounted!\" >> $logs\n",
" let i+=1\n",
"done\n"
]
]
},
"SystemDiskCategory": {
"Ref": "SystemDiskCategory"
},
"VpcId": {
"Ref": "Vpc"
},
"SecurityGroupId": {
"Ref": "SecurityGroup"
},
"SystemDiskSize": {
"Ref": "SystemDiskSize"
},
"ImageId": {
"Ref": "ImageId"
},
"AllocatePublicIP": "false",
"VSwitchId": {
"Ref": "VSwitch"
},
"IoOptimized": "optimized",
"Password": {
"Ref": "Password"
},
"DiskMappings": [
{
"Category": {
"Ref": "FirstDataDiskCategory"
},
"Size": {
"Ref": "FirstDataDiskSize"
}
},
{
"Category": {
"Ref": "SecondDataDiskCategory"
},
"Size": {
"Ref": "SecondDataDiskSize"
}
}
],
"InstanceType": {
"Ref": "InstanceType"
}
},
"Metadata": {
"ALIYUN::ROS::Designer": {
"id": "4f476130-0cde-4cff-a973-2cb026e18f13"
}
}
},
"Vpc": {
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"CidrBlock": {
"Ref": "VpcCidrBlock"
}
},
"Metadata": {
"ALIYUN::ROS::Designer": {
"id": "adfdd097-9c30-49ff-8738-ae3b59eada43"
}
}
},
"VSwitch": {
"Type": "ALIYUN::ECS::VSwitch",
"Properties": {
"VpcId": {
"Fn::GetAtt": [
"Vpc",
"VpcId"
]
},
"CidrBlock": {
"Ref": "VSwitchCidrBlock"
},
"ZoneId": {
"Ref": "ZoneId"
}
},
"Metadata": {
"ALIYUN::ROS::Designer": {
"id": "bd814869-3bd7-4551-a5db-0ec7ad3d3246"
}
}
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"ZoneId",
"VpcCidrBlock",
"VSwitchCidrBlock"
],
"Label": {
"default": {
"zh-cn": "基礎資源配置(必填)",
"en": "Infrastructure Configuration"
}
}
},
{
"Parameters": [
"InstanceType",
"ImageId",
"Password"
],
"Label": {
"default": {
"zh-cn": "ECS 配置(必填)",
"en": "ECS Configuration"
}
}
},
{
"Parameters": [
"SystemDiskSize",
"SystemDiskCategory",
"FirstDataDiskSize",
"FirstDataDiskCategory",
"SecondDataDiskSize",
"SecondDataDiskCategory"
],
"Label": {
"default": {
"zh-cn": "ECS 磁碟配置(必填)",
"en": "ECS Disk Configuration"
}
}
}
]
}
}
}更多樣本,請參考包含此資源的公用模板。