開發人員和管理員可以編寫模板,在模板中定義所需的阿里雲資源(例如ECS執行個體、安全性群組等)、資源間的依賴關係等。Resource Orchestration Service (ROS)的編排引擎將根據模板自動完成所有資源的建立和配置,實現自動化部署及營運。本文為您介紹如何通過一個Resource Orchestration Service模板,自動化建立Elastic Compute Service執行個體。
Resource Orchestration Service是阿里雲提供的一項簡化雲端運算資源管理的服務。更多詳情請參見什麼是Resource Orchestration Service服務。
支援的ECS資源清單
目前支援編排的資源套件括普通資源和資料來源資源。更多詳情請參見Resource Orchestration Service支援ECS資源類型清單。
普通資源
ALIYUN::ECS::AssignIpv6Addresses:為彈性網卡分配一個或多個IPv6地址
ALIYUN::ECS::AssignPrivateIpAddresses:為一塊彈性網卡分配一個或多個輔助私人IP地址
ALIYUN::ECS::Command:建立雲助手命令
ALIYUN::ECS::CopyImage:複製一個自訂鏡像到其他地區
ALIYUN::ECS::CustomImage:建立自訂鏡像
ALIYUN::ECS::DedicatedHost:建立Dedicated Host
ALIYUN::ECS::Disk:建立資料盤
ALIYUN::ECS::DiskAttachment:將資料盤關聯到相應的ECS
ALIYUN::ECS::ForwardEntry:配置NAT Gateway中的轉寄表
ALIYUN::ECS::HpcCluster:建立一個HPC叢集
ALIYUN::ECS::Instance:建立單個ECS執行個體
ALIYUN::ECS::InstanceClone:基於某個ECS複製單個新的ECS執行個體
ALIYUN::ECS::InstanceGroup:建立一個或多個ECS執行個體
ALIYUN::ECS::InstanceGroupClone:基於某個ECS執行個體複製一個或多個新的ECS執行個體
ALIYUN::ECS::Invocation:為ECS執行個體觸發一條雲助手命令
ALIYUN::ECS::JoinSecurityGroup:添加ECS到安全性群組
ALIYUN::ECS::LaunchTemplate:建立ECS執行個體啟動模板
ALIYUN::ECS::NetworkInterfaceAttachment:附加彈性網卡到專用網路
ALIYUN::ECS::PrefixList:建立首碼列表
ALIYUN::ECS::Route:建立自訂路由表條目
ALIYUN::ECS::RunCommand:在一台或多台ECS執行個體中執行一段Shell、PowerShell或者Bat類型的指令碼
ALIYUN::ECS::SNatEntry:配置NAT Gateway中的SNAT表
ALIYUN::ECS::SecurityGroup:建立安全性群組
ALIYUN::ECS::SecurityGroupClone:複製安全性群組
ALIYUN::ECS::SecurityGroupEgress:配置安全性群組流量出規則
ALIYUN::ECS::SecurityGroupIngress:配置安全性群組流量入規則
ALIYUN::ECS::Snapshot:建立磁碟快照
ALIYUN::ECS::SSHKeyPair:建立SSH金鑰組
ALIYUN::ECS::SSHKeyPairAttachment:綁定SSH密鑰和ECS執行個體
ALIYUN::ECS::VPC:建立專用網路
ALIYUN::ECS::VSwitch:建立專用網路中的虛擬交換器
ALIYUN::ECS::RamRoleAttachment:用於為一台或多台ECS執行個體授予執行個體RAM角色
ALIYUN::ECS::Activation:建立一個啟用碼
ALIYUN::ECS::ImageSharePermission:管理鏡像共用許可權
ALIYUN::ECS::CapacityReservation:建立容量預定服務
ALIYUN::ECS::ElasticityAssurance:建立彈性保障服務
ALIYUN::ECS::ImagePipeline:建立一個鏡像模板
ALIYUN::ECS::ImageComponent:建立一個鏡像組件
ALIYUN::ECS::SecurityGroupEgresses:給安全性群組大量繫結多條出方向的訪問規則
ALIYUN::ECS::SecurityGroupIngresses:給安全性群組大量繫結多條入方向的訪問規則
ALIYUN::ECS::SnapshotGroup:為指定ECS執行個體中的雲端硬碟建立快照一致性組,快照一致性組包含一個或多個雲端硬碟對應的快照
資料來源資源
DATASOURCE::ECS::DedicatedHosts:查詢Dedicated Host的詳細資料
DATASOURCE::ECS::DeploymentSets:查詢一個或多個部署集的屬性列表
DATASOURCE::ECS::Disks:查詢您已經建立的Block Storage(包括雲端硬碟以及本地碟)
DATASOURCE::ECS::HpcClusters:查詢可用的HPC叢集
DATASOURCE::ECS::Images:查詢可用的鏡像資源
DATASOURCE::ECS::Instances:查詢ECS執行個體的詳細資料
DATASOURCE::ECS::KeyPairs:查詢一個或多個金鑰組
DATASOURCE::ECS::NetworkInterfaces:查詢彈性網卡(ENI)的詳細資料
DATASOURCE::ECS::RecommendInstanceTypes:查詢ECS執行個體規格
DATASOURCE::ECS::SecurityGroups:查詢安全性群組的基本資料
DATASOURCE::ECS::Snapshots:查詢一台ECS執行個體或一塊雲端硬碟所有的快照列表
DATASOURCE::ECS::Zones:查詢可用性區域
DATASOURCE::ECS::ManagedInstances:查詢受管理的執行個體列表
DATASOURCE::ECS::Commands:查詢手動建立的所有可用命令
DATASOURCE::ECS::DedicatedHostClusters:查詢Dedicated Host叢集的列表資訊
DATASOURCE::ECS::Activation:查詢單個啟用碼詳情
DATASOURCE::ECS::AutoSnapshotPolicy:查詢單個自動快照策略
DATASOURCE::ECS::Command:查詢您手動建立的單一可用的命令詳情
DATASOURCE::ECS::DedicatedHostCluster:查詢一個Dedicated Host叢集的詳細資料
DATASOURCE::ECS::DeploymentSet:查詢一個部署集的屬性詳情
DATASOURCE::ECS::Disk:查詢單個雲端硬碟詳情
DATASOURCE::ECS::HpcCluster:查詢單個HPC叢集
DATASOURCE::ECS::Instance:查詢一台ECS執行個體的詳細資料
DATASOURCE::ECS::KeyPair:查詢一個金鑰組詳情
DATASOURCE::ECS::LaunchTemplate:查詢一個執行個體啟動模板詳情
DATASOURCE::ECS::SecurityGroup:查詢單個安全性群組詳情
DATASOURCE::ECS::Snapshot:查詢單個快照詳情
DATASOURCE::ECS::LaunchTemplates:查詢多個可用的執行個體啟動模板
調用樣本
接下來我們將以Resource Orchestration Service官方提供的建立ECS的模板為您示範完整使用流程。
許可權說明
預設情況下Resource Orchestration Service直接使用當前登入控制台的使用者憑證,若您使用的是阿里雲帳號,可跳過以下授權內容。若您本案例使用的是RAM使用者,需要給RAM使用者授予以下許可權:
雲產品 | 授予許可權 |
Virtual Private Cloud | AliyunVPCFullAccess: 查詢VPC列表和交換器列表以及建立EIP。 |
Elastic Compute Service | AliyunECSFullAccess:建立ECS執行個體。 |
Resource Orchestration Service | AliyunROSFullAccess:建立資源棧等操作。 |
Elastic IP Address | AliyunEIPFullAccess:建立Elastic IP Address等操作。 |
所需資源清單
Elastic Compute Service執行個體的資源架構如下圖所示:
地區:選擇ECS執行個體所在地區。無需指定,預設使用您控制台指定的地區。
網路及可用性區域:每個阿里雲地區都有一個預設Virtual Private Cloud,並且每個預設Virtual Private Cloud在每個可用性區域中都有一個預設子網。
執行個體規格:執行個體規格,例如2vCPU 4GiB。
鏡像:為執行個體確定作業系統。例如Alibaba Cloud Linux、Windows Server等。
儲存:Block StorageEBS,包括系統硬碟和資料盤,可按需進行選擇。
Elastic IP Address:為執行個體建立一個公網IP,可以通過該IP訪問該ECS執行個體。
安全性群組:一種虛擬防火牆,能夠控制ECS執行個體的出入站流量。
金鑰組:一種安全便捷的登入認證方式,用於證明個人身份的安全憑證。建立金鑰組後,公有密鑰在您的ECS執行個體上,而私人密鑰在您的本機電腦上。
對應Resource Orchestration Service中的資源如下:
地區:無需指定,預設使用您控制台指定的地區。
網路及可用性區域:ALIYUN::ECS::VPC
執行個體規格:DATASOURCE::ECS::Instance
Elastic IP Address:ALIYUN::VPC::EIP
建立並執行資源棧
登入Resource Orchestration Service控制台,單擊頂部導覽列地區下拉框,選擇您需要的地區。
單擊左側功能表列中的資源棧,選擇建立資源棧 > 使用ROS,本案例直接使用Resource Orchestration Service官方提供的樣本模板。
確認模板內容,然後單擊下一步。
該樣本中,使用已有Virtual Private Cloud、交換器、安全性群組,建立兩台個ECS執行個體,綁定EIP。YAML和JSON文法內容如下:
YAML文法
ROSTemplateFormatVersion: '2015-09-01' Description: en: Use Count to create a VPC type ECS, and then bind EIP (existing VPC). zh-cn: 使用Count建立VPC類型ECS,並依次綁定EIP(已有VPC)。 Parameters: VPC: Type: String Label: en: VPC ID zh-cn: Virtual Private Cloud執行個體ID Description: en: Please search the ID starting with (vpc-xxx)from console-Virtual Private Cloud zh-cn: 現有Virtual Private Cloud絡的執行個體ID,控制台-VPC-專用網路下查詢 AssociationProperty: ALIYUN::ECS::VPC::VPCId VSwitch: Type: String Label: en: VSwitch ID zh-cn: 交換器執行個體ID Description: en: Existing VSwitch ID, query under console-VPC-VSwitch, <font color='red'>VSwitch must be under VPC. ECS will be created under this VSwitch</font> zh-cn: 現有交換器ID,控制台-VPC-交換器下查詢,<font color='red'>交換器必須在VPC下。ECS將建立在此交換器下</font> AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId AssociationPropertyMetadata: VpcId: ${VPC} ZoneId: ${ECSZoneId} SecurityGroup: Type: String Label: en: Business Security Group ID zh-cn: 業務安全性群組ID Description: en: Please search the business security group ID starting with(sg-xxx)from console-ECS-Network & Security zh-cn: 現有業務安全性群組的執行個體ID,控制台-ECS-網路與安全-安全性群組下查詢。<br><font color='red'>安全性群組必須歸屬在VPC下。</font> AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId AssociationPropertyMetadata: VpcId: ${VPC} EIPBandwidth: Type: Number Label: en: EIP Bandwidth zh-cn: 彈性公網頻寬 Description: en: 'EIP Bandwidth, Value range: [1,200], unit: Mbps.' zh-cn: 彈性公網地址頻寬。取值範圍:1~200, 單位:Mbps。 Default: 2 MinValue: 1 MaxValue: 200 EIPInternetChargeType: Type: String Label: en: EIP Charge Type zh-cn: 彈性公網地址的收費類型 AssociationPropertyMetadata: LocaleKey: InternetChargeType Default: PayByTraffic AllowedValues: - PayByBandwidth - PayByTraffic Count: Type: Number Label: en: Count zh-cn: 數量 Description: en: 'The number of ecs and eip to be created, value range: [1,140]' zh-cn: 需要建立的ecs和eip的數量,取值範圍:[1,140] Default: 1 MinValue: 1 MaxValue: 140 ECSZoneId: Type: String Label: en: VSwitch Availability Zone zh-cn: 交換器可用性區域 Description: en: 'Availability zone ID.<br><b>Note: <font color=''blue''>Before selecting, please confirm whether the availability zone supports the specification of creating ECS resources. It is recommended to be different from other switch availability zones</font></b ><br><font color=''red''>The switch availability zone and the selected switch instance ID must be in the same availability zone.</font>' zh-cn: 可用性區域ID。<br><b>註: <font color='blue'>選擇前請確認該可用性區域是否支援建立ECS資源的規格,建議與其他交換器可用性區域不同</font></b><br><font color='red'>交換器可用性區域和已選擇的交換器執行個體ID必須在同一個可用性區域。</font> AssociationProperty: ALIYUN::ECS::Instance:ZoneId ECSImageId: Type: String Label: en: Image zh-cn: 鏡像 Description: en: Image ID,Please use Centos7, see detail:<b><a href='https://www.alibabacloud.com/help/en/doc-detail/112977.html' target='_blank'><font color='blue'>Find the mirror</font></a></b> zh-cn: 鏡像ID, 請使用Centos7, 詳見:<b><a href='https://help.aliyun.com/document_detail/112977.html' target='_blank'><font color='blue'>尋找鏡像</font></a></b> AssociationProperty: ALIYUN::ECS::Image::ImageId AssociationPropertyMetadata: InstanceType: ${ECSInstanceType} SupportedImageOwnerAlias: - system - self - others Default: centos_7_04_64_20G_alibase_201701015.vhd ECSInstanceType: Type: String Label: en: Instance Type zh-cn: 執行個體規格 Description: en: <font color='blue'><b>1.Before selecting 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>] 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>] AssociationProperty: ALIYUN::ECS::Instance::InstanceType AssociationPropertyMetadata: ZoneId: ECSZoneId ECSDiskCategory: Type: String 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>]' AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory AssociationPropertyMetadata: LocaleKey: DiskCategory InstanceType: ${ECSInstanceType} ECSSysDiskSize: Type: Number Label: en: System Disk Space zh-cn: 系統硬碟空間 Description: en: 'System disk size, range of values: 40-500, units: GB.' zh-cn: 系統硬碟大小, 取值範圍:[40, 500], 單位:GB。 Default: 40 MinValue: 40 MaxValue: 500 ECSPassword: Type: String Label: en: Instance Password zh-cn: 執行個體密碼 Description: en: Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in). zh-cn: 伺服器登入密碼,長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。 ConstraintDescription: en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in). zh-cn: 長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。 Default: Null AllowedPattern: '[0-9A-Za-z\_\-\&:;''<>,=%`~!@#\(\)\$\^\*\+\|\{\}\[\]\.\?\/]+$' MinLength: 8 MaxLength: 30 NoEcho: true KeyPairName: Type: String Label: en: Key Pair Name zh-cn: 金鑰組名稱 Description: en: If it is a Windows ECS instance, ignore this parameter. The default is blank.<br>If you have filled in <font color='green'>key pair name</font>, <font color='green'>instance password< The content of /font> will still be set in the instance, but the password login method in the Linux system will be forbidden.<br><font color='red'>Please enter the name of the existing key pair. If you use the instance password Login, the key pair name does not need to be filled in</font> zh-cn: 如果是Windows ECS執行個體,則忽略該參數。預設為空白。<br>如果已填寫<font color='green'>金鑰組名稱</font>,<font color='green'>執行個體密碼</font>的內容仍會被設定到執行個體中,但是Linux系統中的密碼登入方式會被禁止。<br><font color='red'>請輸入已有金鑰組的名稱。如使用執行個體密碼登入,金鑰組名稱不需要填寫</font> AssociationProperty: ALIYUN::ECS::KeyPair::KeyPairName Default: Null PayType: Type: String Label: en: ECS Instance Charge Type zh-cn: ECS付費類型 AssociationProperty: ChargeType AssociationPropertyMetadata: LocaleKey: InstanceChargeType Default: PostPaid AllowedValues: - PostPaid - PrePaid PayPeriodUnit: Type: String Label: en: Pay Period Unit zh-cn: 購買資源時間長度周期 AssociationProperty: PayPeriodUnit AssociationPropertyMetadata: Visible: Condition: Fn::Not: Fn::Equals: - ${PayType} - PostPaid Default: Month AllowedValues: - Month - Year PayPeriod: Type: Number Label: en: Period zh-cn: 購買資源時間長度 AssociationProperty: PayPeriod AssociationPropertyMetadata: Visible: Condition: Fn::Not: Fn::Equals: - ${PayType} - PostPaid Default: 1 AllowedValues: - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 Resources: ECSInstanceGroup: Type: ALIYUN::ECS::InstanceGroup Properties: ZoneId: Ref: ECSZoneId VpcId: Ref: VPC VSwitchId: Ref: VSwitch SecurityGroupId: Ref: SecurityGroup ImageId: Ref: ECSImageId AllocatePublicIP: 'false' InstanceChargeType: Ref: PayType Period: Ref: PayPeriod PeriodUnit: Ref: PayPeriodUnit InstanceType: Ref: ECSInstanceType IoOptimized: optimized KeyPairName: Ref: KeyPairName MaxAmount: Ref: Count Password: Ref: ECSPassword SystemDiskCategory: Ref: ECSDiskCategory SystemDiskSize: Ref: ECSSysDiskSize ElasticIp: Type: ALIYUN::VPC::EIP Properties: Bandwidth: Ref: EIPBandwidth InternetChargeType: Ref: EIPInternetChargeType Count: Ref: Count ElasticIpAssociation: Type: ALIYUN::VPC::EIPAssociation Properties: InstanceId: Fn::Select: - Ref: ALIYUN::Index - Fn::GetAtt: - ECSInstanceGroup - InstanceIds AllocationId: Fn::Select: - Ref: ALIYUN::Index - Ref: ElasticIp Count: Ref: Count Outputs: EipAddress: Description: IP address of created EIP. Value: Fn::GetAtt: - ElasticIp - EipAddress SecurityGroupId: Description: generated security group id for security group. Value: Ref: SecurityGroup VSwitchId: Description: generated security vswitch id for VPC. Value: Ref: VSwitch VpcId: Description: generated security vpc id for VPC. Value: Ref: VPC Metadata: ALIYUN::ROS::Interface: ParameterGroups: - Parameters: - VPC - ECSZoneId - VSwitch - SecurityGroup Label: default: 'VPC ' - Parameters: - EIPBandwidth - EIPInternetChargeType Label: default: EIP - Parameters: - PayType - PayPeriodUnit - PayPeriod Label: default: en: ECS PayType Configuration zh-cn: ECS付費類型配置 - Parameters: - ECSInstanceType - ECSImageId - ECSDiskCategory - ECSSysDiskSize - Count - ECSPassword - KeyPairName Label: default: ECS TemplateTags: - acs:example:彈性計算:使用Count建立VPC類型ECS,並依次綁定EIP(已有VPC)
JSON文法
{ "ROSTemplateFormatVersion": "2015-09-01", "Description": { "en": "Use Count to create a VPC type ECS, and then bind EIP (existing VPC).", "zh-cn": "使用Count建立VPC類型ECS,並依次綁定EIP(已有VPC)。" }, "Parameters": { "VPC": { "Type": "String", "Label": { "en": "VPC ID", "zh-cn": "Virtual Private Cloud執行個體ID" }, "Description": { "en": "Please search the ID starting with (vpc-xxx)from console-Virtual Private Cloud", "zh-cn": "現有Virtual Private Cloud絡的執行個體ID,控制台-VPC-專用網路下查詢" }, "AssociationProperty": "ALIYUN::ECS::VPC::VPCId" }, "VSwitch": { "Type": "String", "Label": { "en": "VSwitch ID", "zh-cn": "交換器執行個體ID" }, "Description": { "en": "Existing VSwitch ID, query under console-VPC-VSwitch, <font color='red'>VSwitch must be under VPC. ECS will be created under this VSwitch</font>", "zh-cn": "現有交換器ID,控制台-VPC-交換器下查詢,<font color='red'>交換器必須在VPC下。ECS將建立在此交換器下</font>" }, "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId", "AssociationPropertyMetadata": { "VpcId": "${VPC}", "ZoneId": "${ECSZoneId}" } }, "SecurityGroup": { "Type": "String", "Label": { "en": "Business Security Group ID", "zh-cn": "業務安全性群組ID" }, "Description": { "en": "Please search the business security group ID starting with(sg-xxx)from console-ECS-Network & Security", "zh-cn": "現有業務安全性群組的執行個體ID,控制台-ECS-網路與安全-安全性群組下查詢。<br><font color='red'>安全性群組必須歸屬在VPC下。</font>" }, "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId", "AssociationPropertyMetadata": { "VpcId": "${VPC}" } }, "EIPBandwidth": { "Type": "Number", "Label": { "en": "EIP Bandwidth", "zh-cn": "彈性公網頻寬" }, "Description": { "en": "EIP Bandwidth, Value range: [1,200], unit: Mbps.", "zh-cn": "彈性公網地址頻寬。取值範圍:1~200, 單位:Mbps。" }, "Default": 1, "MinValue": 1, "MaxValue": 200 }, "EIPInternetChargeType": { "Type": "String", "Label": { "en": "EIP Charge Type", "zh-cn": "彈性公網地址的收費類型" }, "AssociationPropertyMetadata": { "LocaleKey": "InternetChargeType" }, "Default": "PayByTraffic", "AllowedValues": [ "PayByBandwidth", "PayByTraffic" ] }, "Count": { "Type": "Number", "Label": { "en": "Count", "zh-cn": "數量" }, "Description": { "en": "The number of ecs and eip to be created, value range: [1,140]", "zh-cn": "需要建立的ecs和eip的數量,取值範圍:[1,140]" }, "Default": 2, "MinValue": 1, "MaxValue": 140 }, "ECSZoneId": { "Type": "String", "Label": { "en": "VSwitch Availability Zone", "zh-cn": "交換器可用性區域" }, "Description": { "en": "Availability zone ID.<br><b>Note: <font color='blue'>Before selecting, please confirm whether the availability zone supports the specification of creating ECS resources. It is recommended to be different from other switch availability zones</font></b ><br><font color='red'>The switch availability zone and the selected switch instance ID must be in the same availability zone.</font>", "zh-cn": "可用性區域ID。<br><b>註: <font color='blue'>選擇前請確認該可用性區域是否支援建立ECS資源的規格,建議與其他交換器可用性區域不同</font></b><br><font color='red'>交換器可用性區域和已選擇的交換器執行個體ID必須在同一個可用性區域。</font>" }, "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId" }, "ECSImageId": { "Type": "String", "Label": { "en": "Image", "zh-cn": "鏡像" }, "Description": { "en": "Image ID,Please use Centos7, see detail:<b><a href='https://www.alibabacloud.com/help/en/doc-detail/112977.html' target='_blank'><font color='blue'>Find the mirror</font></a></b>", "zh-cn": "鏡像ID, 請使用Centos7, 詳見:<b><a href='https://help.aliyun.com/document_detail/112977.html' target='_blank'><font color='blue'>尋找鏡像</font></a></b>" }, "AssociationProperty": "ALIYUN::ECS::Image::ImageId", "AssociationPropertyMetadata": { "InstanceType": "${ECSInstanceType}", "SupportedImageOwnerAlias": [ "system", "self", "others" ] }, "Default": "centos_7_04_64_20G_alibase_201701015.vhd" }, "ECSInstanceType": { "Type": "String", "Label": { "en": "Instance Type", "zh-cn": "執行個體規格" }, "Description": { "en": "<font color='blue'><b>1.Before selecting 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>]", "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>]" }, "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType", "AssociationPropertyMetadata": { "ZoneId": "ECSZoneId" } }, "ECSDiskCategory": { "Type": "String", "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>]" }, "AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory", "AssociationPropertyMetadata": { "LocaleKey": "DiskCategory", "InstanceType": "${ECSInstanceType}" } }, "ECSSysDiskSize": { "Type": "Number", "Label": { "en": "System Disk Space", "zh-cn": "系統硬碟空間" }, "Description": { "en": "System disk size, range of values: 40-500, units: GB.", "zh-cn": "系統硬碟大小, 取值範圍:[40, 500], 單位:GB。" }, "Default": 40, "MinValue": 40, "MaxValue": 500 }, "ECSPassword": { "Type": "String", "Label": { "en": "Instance Password", "zh-cn": "執行個體密碼" }, "Description": { "en": "Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).", "zh-cn": "伺服器登入密碼,長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。" }, "ConstraintDescription": { "en": "Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).", "zh-cn": "長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。" }, "Default": null, "AllowedPattern": "[0-9A-Za-z\\_\\-\\&:;'<>,=%`~!@#\\(\\)\\$\\^\\*\\+\\|\\{\\}\\[\\]\\.\\?\\/]+$", "MinLength": 8, "MaxLength": 30, "NoEcho": true }, "KeyPairName": { "Type": "String", "Label": { "en": "Key Pair Name", "zh-cn": "金鑰組名稱" }, "Description": { "en": "If it is a Windows ECS instance, ignore this parameter. The default is blank.<br>If you have filled in <font color='green'>key pair name</font>, <font color='green'>instance password< The content of /font> will still be set in the instance, but the password login method in the Linux system will be forbidden.<br><font color='red'>Please enter the name of the existing key pair. If you use the instance password Login, the key pair name does not need to be filled in</font>", "zh-cn": "如果是Windows ECS執行個體,則忽略該參數。預設為空白。<br>如果已填寫<font color='green'>金鑰組名稱</font>,<font color='green'>執行個體密碼</font>的內容仍會被設定到執行個體中,但是Linux系統中的密碼登入方式會被禁止。<br><font color='red'>請輸入已有金鑰組的名稱。如使用執行個體密碼登入,金鑰組名稱不需要填寫</font>" }, "AssociationProperty": "ALIYUN::ECS::KeyPair::KeyPairName", "Default": null }, "PayType": { "Type": "String", "Label": { "en": "ECS Instance Charge Type", "zh-cn": "ECS付費類型" }, "AssociationProperty": "ChargeType", "AssociationPropertyMetadata": { "LocaleKey": "InstanceChargeType" }, "Default": "PostPaid", "AllowedValues": [ "PostPaid", "PrePaid" ] }, "PayPeriodUnit": { "Type": "String", "Label": { "en": "Pay Period Unit", "zh-cn": "購買資源時間長度周期" }, "AssociationProperty": "PayPeriodUnit", "AssociationPropertyMetadata": { "Visible": { "Condition": { "Fn::Not": { "Fn::Equals": [ "${PayType}", "PostPaid" ] } } } }, "Default": "Month", "AllowedValues": [ "Month", "Year" ] }, "PayPeriod": { "Type": "Number", "Label": { "en": "Period", "zh-cn": "購買資源時間長度" }, "AssociationProperty": "PayPeriod", "AssociationPropertyMetadata": { "Visible": { "Condition": { "Fn::Not": { "Fn::Equals": [ "${PayType}", "PostPaid" ] } } } }, "Default": 1, "AllowedValues": [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ] } }, "Resources": { "ECSInstanceGroup": { "Type": "ALIYUN::ECS::InstanceGroup", "Properties": { "ZoneId": { "Ref": "ECSZoneId" }, "VpcId": { "Ref": "VPC" }, "VSwitchId": { "Ref": "VSwitch" }, "SecurityGroupId": { "Ref": "SecurityGroup" }, "ImageId": { "Ref": "ECSImageId" }, "AllocatePublicIP": "false", "InstanceChargeType": { "Ref": "PayType" }, "Period": { "Ref": "PayPeriod" }, "PeriodUnit": { "Ref": "PayPeriodUnit" }, "InstanceType": { "Ref": "ECSInstanceType" }, "IoOptimized": "optimized", "KeyPairName": { "Ref": "KeyPairName" }, "MaxAmount": { "Ref": "Count" }, "Password": { "Ref": "ECSPassword" }, "SystemDiskCategory": { "Ref": "ECSDiskCategory" }, "SystemDiskSize": { "Ref": "ECSSysDiskSize" } } }, "ElasticIp": { "Type": "ALIYUN::VPC::EIP", "Properties": { "Bandwidth": { "Ref": "EIPBandwidth" }, "InternetChargeType": { "Ref": "EIPInternetChargeType" } }, "Count": { "Ref": "Count" } }, "ElasticIpAssociation": { "Type": "ALIYUN::VPC::EIPAssociation", "Properties": { "InstanceId": { "Fn::Select": [ { "Ref": "ALIYUN::Index" }, { "Fn::GetAtt": [ "ECSInstanceGroup", "InstanceIds" ] } ] }, "AllocationId": { "Fn::Select": [ { "Ref": "ALIYUN::Index" }, { "Ref": "ElasticIp" } ] } }, "Count": { "Ref": "Count" } } }, "Outputs": { "EipAddress": { "Description": "IP address of created EIP.", "Value": { "Fn::GetAtt": [ "ElasticIp", "EipAddress" ] } }, "SecurityGroupId": { "Description": "generated security group id for security group.", "Value": { "Ref": "SecurityGroup" } }, "VSwitchId": { "Description": "generated security vswitch id for VPC.", "Value": { "Ref": "VSwitch" } }, "VpcId": { "Description": "generated security vpc id for VPC.", "Value": { "Ref": "VPC" } } }, "Metadata": { "ALIYUN::ROS::Interface": { "ParameterGroups": [ { "Parameters": [ "VPC", "ECSZoneId", "VSwitch", "SecurityGroup" ], "Label": { "default": "VPC " } }, { "Parameters": [ "EIPBandwidth", "EIPInternetChargeType" ], "Label": { "default": "EIP" } }, { "Parameters": [ "PayType", "PayPeriodUnit", "PayPeriod" ], "Label": { "default": { "en": "ECS PayType Configuration", "zh-cn": "ECS付費類型配置" } } }, { "Parameters": [ "ECSInstanceType", "ECSImageId", "ECSDiskCategory", "ECSSysDiskSize", "Count", "ECSPassword", "KeyPairName" ], "Label": { "default": "ECS" } } ], "TemplateTags": [ "acs:example:彈性計算:使用Count建立VPC類型ECS,並依次綁定EIP(已有VPC)" ] } } }
根據介面,選擇Virtual Private Cloud、交換器、可用性區域、安全性群組等,然後單擊建立,執行資源棧。
輸出結果。
建立完成後,您可以通過OpenAPI、SDK或者控制台查看狀態為
運行中
的ECS執行個體。
參考文檔
Resource Orchestration Service提供搭建環境、搭建網站、搭建應用和AIGC實踐等情境的資源一鍵部署,更多使用案例可參考: