ROS參考
開發(fā)者和管理員可以編寫模板,在模板中定義所需的阿里云資源(例如ECS實例、安全組等)、資源間的依賴關系等。資源編排 ROS(Resource Orchestration Service)的編排引擎將根據(jù)模板自動完成所有資源的創(chuàng)建和配置,實現(xiàn)自動化部署及運維。本文為您介紹如何通過一個資源編排模板,自動化創(chuàng)建云服務器 ECS實例。
資源編排是阿里云提供的一項簡化云計算資源管理的服務。更多詳情請參見什么是資源編排服務。
支持的ECS資源列表
目前支持編排的資源包括普通資源和數(shù)據(jù)源資源。更多詳情請參見資源編排支持ECS資源類型清單。
ALIYUN::ECS::AutoProvisioningGroup:創(chuàng)建彈性供應組
ALIYUN::ECS::AssignIpv6Addresses:為彈性網(wǎng)卡分配一個或多個IPv6地址
ALIYUN::ECS::AssignPrivateIpAddresses:為一塊彈性網(wǎng)卡分配一個或多個輔助私有IP地址
ALIYUN::ECS::Command:新建云助手命令
ALIYUN::ECS::CopyImage:復制一個自定義鏡像到其他地域
ALIYUN::ECS::CustomImage:創(chuàng)建自定義鏡像
ALIYUN::ECS::DedicatedHost:創(chuàng)建專有宿主機
ALIYUN::ECS::DeploymentSet:創(chuàng)建部署集
ALIYUN::ECS::Disk:創(chuàng)建數(shù)據(jù)盤
ALIYUN::ECS::DiskAttachment:將數(shù)據(jù)盤關聯(lián)到相應的ECS
ALIYUN::ECS::ForwardEntry:配置NAT網(wǎng)關中的轉(zhuǎn)發(fā)表
ALIYUN::ECS::HpcCluster:創(chuàng)建一個HPC集群
ALIYUN::ECS::Instance:創(chuàng)建單個ECS實例
ALIYUN::ECS::InstanceClone:基于某個ECS克隆單個新的ECS實例
ALIYUN::ECS::InstanceGroup:創(chuàng)建一個或多個ECS實例
ALIYUN::ECS::InstanceGroupClone:基于某個ECS實例克隆一個或多個新的ECS實例
ALIYUN::ECS::Invocation:為ECS實例觸發(fā)一條云助手命令
ALIYUN::ECS::JoinSecurityGroup:添加ECS到安全組
ALIYUN::ECS::LaunchTemplate:創(chuàng)建ECS實例啟動模板
ALIYUN::ECS::NetworkInterface:創(chuàng)建彈性網(wǎng)卡
ALIYUN::ECS::NetworkInterfaceAttachment:附加彈性網(wǎng)卡到專有網(wǎng)絡
ALIYUN::ECS::NetworkInterfacePermission:授權彈性網(wǎng)卡
ALIYUN::ECS::PrefixList:創(chuàng)建前綴列表
ALIYUN::ECS::Route:創(chuàng)建自定義路由表條目
ALIYUN::ECS::RunCommand:在一臺或多臺ECS實例中執(zhí)行一段Shell、PowerShell或者Bat類型的腳本
ALIYUN::ECS::SNatEntry:配置NAT網(wǎng)關中的SNAT表
ALIYUN::ECS::SecurityGroup:創(chuàng)建安全組
ALIYUN::ECS::SecurityGroupEgress:配置安全組流量出規(guī)則
ALIYUN::ECS::SecurityGroupIngress:配置安全組流量入規(guī)則
ALIYUN::ECS::Snapshot:創(chuàng)建磁盤快照
ALIYUN::ECS::SSHKeyPair:創(chuàng)建SSH密鑰對
ALIYUN::ECS::SSHKeyPairAttachment:綁定SSH密鑰和ECS實例
ALIYUN::ECS::VPC:創(chuàng)建專有網(wǎng)絡
ALIYUN::ECS::VSwitch:創(chuàng)建專有網(wǎng)絡中的虛擬交換機
ALIYUN::ECS::RamRoleAttachment:用于為一臺或多臺ECS實例授予實例RAM角色
ALIYUN::ECS::Activation:創(chuàng)建一個激活碼
ALIYUN::ECS::ImageSharePermission:管理鏡像共享權限
ALIYUN::ECS::CapacityReservation:創(chuàng)建容量預定服務
ALIYUN::ECS::ElasticityAssurance:創(chuàng)建彈性保障服務
ALIYUN::ECS::ImagePipeline:創(chuàng)建一個鏡像模板
ALIYUN::ECS::ImageComponent:創(chuàng)建一個鏡像組件
ALIYUN::ECS::SecurityGroupEgresses:給安全組批量綁定多條出方向的訪問規(guī)則
ALIYUN::ECS::SecurityGroupIngresses:給安全組批量綁定多條入方向的訪問規(guī)則
ALIYUN::ECS::SnapshotGroup:為指定ECS實例中的云盤創(chuàng)建快照一致性組,快照一致性組包含一個或多個云盤對應的快照
DATASOURCE::ECS::DedicatedHosts:查詢專有宿主機的詳細信息
DATASOURCE::ECS::DeploymentSets:查詢一個或多個部署集的屬性列表
DATASOURCE::ECS::Disks:查詢您已經(jīng)創(chuàng)建的塊存儲(包括云盤以及本地盤)
DATASOURCE::ECS::HpcClusters:查詢可用的HPC集群
DATASOURCE::ECS::Images:查詢可用的鏡像資源
DATASOURCE::ECS::Instances:查詢ECS實例的詳細信息
DATASOURCE::ECS::KeyPairs:查詢一個或多個密鑰對
DATASOURCE::ECS::NetworkInterfaces:查詢彈性網(wǎng)卡(ENI)的詳細信息
DATASOURCE::ECS::RecommendInstanceTypes:查詢ECS實例規(guī)格
DATASOURCE::ECS::SecurityGroups:查詢安全組的基本信息
DATASOURCE::ECS::Snapshots:查詢一臺ECS實例或一塊云盤所有的快照列表
DATASOURCE::ECS::Zones:查詢可用區(qū)
DATASOURCE::ECS::ManagedInstances:查詢托管實例列表
DATASOURCE::ECS::Commands:查詢手動創(chuàng)建的所有可用命令
DATASOURCE::ECS::DedicatedHostClusters:查詢專有宿主機集群的列表信息
DATASOURCE::ECS::Activation:查詢單個激活碼詳情
DATASOURCE::ECS::AutoSnapshotPolicy:查詢單個自動快照策略
DATASOURCE::ECS::Command:查詢您手動創(chuàng)建的單一可用的命令詳情
DATASOURCE::ECS::DedicatedHostCluster:查詢一個專有宿主機集群的詳細信息
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:查詢多個可用的實例啟動模板
調(diào)用示例
接下來我們將以資源編排官方提供的創(chuàng)建ECS的模板為您演示完整使用流程。
權限說明
默認情況下資源編排直接使用當前登錄控制臺的用戶憑證,若您使用的是阿里云賬號,可跳過以下授權內(nèi)容。若您本案例使用的是RAM用戶,需要給RAM用戶授予以下權限:
云產(chǎn)品 | 授予權限 |
專有網(wǎng)絡 VPC | AliyunVPCFullAccess: 查詢VPC列表和交換機列表以及創(chuàng)建EIP。 |
云服務器 ECS | AliyunECSFullAccess:創(chuàng)建ECS實例。 |
資源編排 | AliyunROSFullAccess:創(chuàng)建資源棧等操作。 |
彈性公網(wǎng) IP | AliyunEIPFullAccess:創(chuàng)建彈性公網(wǎng)IP等操作。 |
所需資源清單
云服務器 ECS實例的資源架構(gòu)如下圖所示:
地域:選擇ECS實例所在地域。無需指定,默認使用您控制臺指定的地域。
網(wǎng)絡及可用區(qū):每個阿里云地域都有一個默認專有網(wǎng)絡VPC,并且每個默認專有網(wǎng)絡VPC在每個可用區(qū)中都有一個默認子網(wǎng)。
實例規(guī)格:實例規(guī)格,例如2vCPU 4GiB。
鏡像:為實例確定操作系統(tǒng)。例如Alibaba Cloud Linux、Windows Server等。
存儲:塊存儲EBS,包括系統(tǒng)盤和數(shù)據(jù)盤,可按需進行選擇。
彈性公網(wǎng)IP:為實例創(chuàng)建一個公網(wǎng)IP,可以通過該IP訪問該ECS實例。
安全組:一種虛擬防火墻,能夠控制ECS實例的出入站流量。
密鑰對:一種安全便捷的登錄認證方式,用于證明個人身份的安全憑證。創(chuàng)建密鑰對后,公有密鑰在您的ECS實例上,而私有密鑰在您的本地計算機上。
對應資源編排中的資源如下:
地域:無需指定,默認使用您控制臺指定的地域。
網(wǎng)絡及可用區(qū):ALIYUN::ECS::VPC
實例規(guī)格:DATASOURCE::ECS::Instance
彈性公網(wǎng)IP:ALIYUN::VPC::EIP
創(chuàng)建并執(zhí)行資源棧
您可以通過一鍵部署快速完成以下操作。
登錄資源編排ROS控制臺,單擊頂部導航欄地域下拉框,選擇您需要的地域。
單擊左側(cè)菜單欄中的資源棧,選擇
,本案例直接使用資源編排官方提供的示例模板。確認模板內(nèi)容,然后單擊下一步。
該示例中,使用已有專有網(wǎng)絡VPC、交換機、安全組,創(chuàng)建兩臺個ECS實例,綁定EIP。YAML和JSON語法內(nèi)容如下:
ROSTemplateFormatVersion: '2015-09-01' Description: en: Use Count to create a VPC type ECS, and then bind EIP (existing VPC). zh-cn: 使用Count創(chuàng)建VPC類型ECS,并依次綁定EIP(已有VPC)。 Parameters: VPC: Type: String Label: en: VPC ID zh-cn: 專有網(wǎng)絡VPC實例ID Description: en: Please search the ID starting with (vpc-xxx)from console-Virtual Private Cloud zh-cn: 現(xiàn)有虛擬專有網(wǎng)絡的實例ID,控制臺-VPC-專有網(wǎng)絡下查詢 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: 現(xiàn)有交換機ID,控制臺-VPC-交換機下查詢,<font color='red'>交換機必須在VPC下。ECS將創(chuàng)建在此交換機下</font> AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId AssociationPropertyMetadata: VpcId: ${VPC} ZoneId: ${ECSZoneId} SecurityGroup: Type: String Label: en: Business Security Group ID zh-cn: 業(yè)務安全組ID Description: en: Please search the business security group ID starting with(sg-xxx)from console-ECS-Network & Security zh-cn: 現(xiàn)有業(yè)務安全組的實例ID,控制臺-ECS-網(wǎng)絡與安全-安全組下查詢。<br><font color='red'>安全組必須歸屬在VPC下。</font> AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId AssociationPropertyMetadata: VpcId: ${VPC} EIPBandwidth: Type: Number Label: en: EIP Bandwidth zh-cn: 彈性公網(wǎng)帶寬 Description: en: 'EIP Bandwidth, Value range: [1,200], unit: Mbps.' zh-cn: 彈性公網(wǎng)地址帶寬。取值范圍:1~200, 單位:Mbps。 Default: 2 MinValue: 1 MaxValue: 200 EIPInternetChargeType: Type: String Label: en: EIP Charge Type zh-cn: 彈性公網(wǎng)地址的收費類型 AssociationPropertyMetadata: LocaleKey: InternetChargeType Default: PayByTraffic AllowedValues: - PayByBandwidth - PayByTraffic Count: Type: Number Label: en: Count zh-cn: 數(shù)量 Description: en: 'The number of ecs and eip to be created, value range: [1,140]' zh-cn: 需要創(chuàng)建的ecs和eip的數(shù)量,取值范圍:[1,140] Default: 1 MinValue: 1 MaxValue: 140 ECSZoneId: Type: String Label: en: VSwitch Availability Zone zh-cn: 交換機可用區(qū) 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: 可用區(qū)ID。<br><b>注: <font color='blue'>選擇前請確認該可用區(qū)是否支持創(chuàng)建ECS資源的規(guī)格,建議與其他交換機可用區(qū)不同</font></b><br><font color='red'>交換機可用區(qū)和已選擇的交換機實例ID必須在同一個可用區(qū)。</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 target='_blank'><font color='blue'>Find the mirror</font></a></b> zh-cn: 鏡像ID, 請使用Centos7, 詳見:<b><a href='http://bestwisewords.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: 實例規(guī)格 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.選擇機型前請先確認當前可用區(qū)下該機型是否有貨,部分機型需要提前報備</b></font><br><font color='blue'><b>2.可選機型列表</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU 4GiB 內(nèi)網(wǎng)帶寬1Gbps 內(nèi)網(wǎng)收發(fā)包30萬PPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB 內(nèi)網(wǎng)帶寬1.5Gbps 內(nèi)網(wǎng)收發(fā)包50萬PPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB 內(nèi)網(wǎng)帶寬2.5Gbps 內(nèi)網(wǎng)收發(fā)包80萬PPS</font>] AssociationProperty: ALIYUN::ECS::Instance::InstanceType AssociationPropertyMetadata: ZoneId: ECSZoneId ECSDiskCategory: Type: String Label: en: System Disk Type zh-cn: 系統(tǒng)盤類型 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: 系統(tǒng)盤空間 Description: en: 'System disk size, range of values: 40-500, units: GB.' zh-cn: 系統(tǒng)盤大小, 取值范圍:[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,必須包含三項(大寫字母、小寫字母、數(shù)字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。 ConstraintDescription: en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in). zh-cn: 長度8-30,必須包含三項(大寫字母、小寫字母、數(shù)字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。 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實例,則忽略該參數(shù)。默認為空。<br>如果已填寫<font color='green'>密鑰對名稱</font>,<font color='green'>實例密碼</font>的內(nèi)容仍會被設置到實例中,但是Linux系統(tǒng)中的密碼登錄方式會被禁止。<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創(chuàng)建VPC類型ECS,并依次綁定EIP(已有VPC)
{ "ROSTemplateFormatVersion": "2015-09-01", "Description": { "en": "Use Count to create a VPC type ECS, and then bind EIP (existing VPC).", "zh-cn": "使用Count創(chuàng)建VPC類型ECS,并依次綁定EIP(已有VPC)。" }, "Parameters": { "VPC": { "Type": "String", "Label": { "en": "VPC ID", "zh-cn": "專有網(wǎng)絡VPC實例ID" }, "Description": { "en": "Please search the ID starting with (vpc-xxx)from console-Virtual Private Cloud", "zh-cn": "現(xiàn)有虛擬專有網(wǎng)絡的實例ID,控制臺-VPC-專有網(wǎng)絡下查詢" }, "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": "現(xiàn)有交換機ID,控制臺-VPC-交換機下查詢,<font color='red'>交換機必須在VPC下。ECS將創(chuàng)建在此交換機下</font>" }, "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId", "AssociationPropertyMetadata": { "VpcId": "${VPC}", "ZoneId": "${ECSZoneId}" } }, "SecurityGroup": { "Type": "String", "Label": { "en": "Business Security Group ID", "zh-cn": "業(yè)務安全組ID" }, "Description": { "en": "Please search the business security group ID starting with(sg-xxx)from console-ECS-Network & Security", "zh-cn": "現(xiàn)有業(yè)務安全組的實例ID,控制臺-ECS-網(wǎng)絡與安全-安全組下查詢。<br><font color='red'>安全組必須歸屬在VPC下。</font>" }, "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId", "AssociationPropertyMetadata": { "VpcId": "${VPC}" } }, "EIPBandwidth": { "Type": "Number", "Label": { "en": "EIP Bandwidth", "zh-cn": "彈性公網(wǎng)帶寬" }, "Description": { "en": "EIP Bandwidth, Value range: [1,200], unit: Mbps.", "zh-cn": "彈性公網(wǎng)地址帶寬。取值范圍:1~200, 單位:Mbps。" }, "Default": 1, "MinValue": 1, "MaxValue": 200 }, "EIPInternetChargeType": { "Type": "String", "Label": { "en": "EIP Charge Type", "zh-cn": "彈性公網(wǎng)地址的收費類型" }, "AssociationPropertyMetadata": { "LocaleKey": "InternetChargeType" }, "Default": "PayByTraffic", "AllowedValues": [ "PayByBandwidth", "PayByTraffic" ] }, "Count": { "Type": "Number", "Label": { "en": "Count", "zh-cn": "數(shù)量" }, "Description": { "en": "The number of ecs and eip to be created, value range: [1,140]", "zh-cn": "需要創(chuàng)建的ecs和eip的數(shù)量,取值范圍:[1,140]" }, "Default": 2, "MinValue": 1, "MaxValue": 140 }, "ECSZoneId": { "Type": "String", "Label": { "en": "VSwitch Availability Zone", "zh-cn": "交換機可用區(qū)" }, "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": "可用區(qū)ID。<br><b>注: <font color='blue'>選擇前請確認該可用區(qū)是否支持創(chuàng)建ECS資源的規(guī)格,建議與其他交換機可用區(qū)不同</font></b><br><font color='red'>交換機可用區(qū)和已選擇的交換機實例ID必須在同一個可用區(qū)。</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 target='_blank'><font color='blue'>Find the mirror</font></a></b>", "zh-cn": "鏡像ID, 請使用Centos7, 詳見:<b><a href='http://bestwisewords.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": "實例規(guī)格" }, "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.選擇機型前請先確認當前可用區(qū)下該機型是否有貨,部分機型需要提前報備</b></font><br><font color='blue'><b>2.可選機型列表</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU 4GiB 內(nèi)網(wǎng)帶寬1Gbps 內(nèi)網(wǎng)收發(fā)包30萬PPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB 內(nèi)網(wǎng)帶寬1.5Gbps 內(nèi)網(wǎng)收發(fā)包50萬PPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB 內(nèi)網(wǎng)帶寬2.5Gbps 內(nèi)網(wǎng)收發(fā)包80萬PPS</font>]" }, "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType", "AssociationPropertyMetadata": { "ZoneId": "ECSZoneId" } }, "ECSDiskCategory": { "Type": "String", "Label": { "en": "System Disk Type", "zh-cn": "系統(tǒng)盤類型" }, "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": "系統(tǒng)盤空間" }, "Description": { "en": "System disk size, range of values: 40-500, units: GB.", "zh-cn": "系統(tǒng)盤大小, 取值范圍:[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,必須包含三項(大寫字母、小寫字母、數(shù)字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。" }, "ConstraintDescription": { "en": "Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).", "zh-cn": "長度8-30,必須包含三項(大寫字母、小寫字母、數(shù)字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。" }, "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實例,則忽略該參數(shù)。默認為空。<br>如果已填寫<font color='green'>密鑰對名稱</font>,<font color='green'>實例密碼</font>的內(nèi)容仍會被設置到實例中,但是Linux系統(tǒng)中的密碼登錄方式會被禁止。<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創(chuàng)建VPC類型ECS,并依次綁定EIP(已有VPC)" ] } } }
根據(jù)界面,選擇專有網(wǎng)絡VPC、交換機、可用區(qū)、安全組等,然后單擊創(chuàng)建,執(zhí)行資源棧。
輸出結(jié)果。
創(chuàng)建完成后,您可以通過OpenAPI、SDK或者控制臺查看狀態(tài)為
運行中
的ECS實例。
參考文檔
資源編排提供搭建環(huán)境、搭建網(wǎng)站、搭建應用和AIGC實踐等場景的資源一鍵部署,更多使用案例可參考: