Cria uma instância ECS.
Este recurso não recebe mais atualizações. Use o recurso ALIYUN::ECS::InstanceGroup em seu lugar.
Sintaxe
{
"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
}
}
Propriedades
|
Nome da propriedade |
Tipo |
Obrigatório |
Atualização permitida |
Descrição |
Restrição |
|
ResourceGroupId |
String |
Não |
Sim |
ID do grupo de recursos. |
Nenhuma |
|
SpotInterruptionBehavior |
String |
Não |
Não |
Modo de interrupção para uma instância spot. |
Somente Terminate é suportado. Este valor libera a instância imediatamente. Terminate é o valor padrão. |
|
ZoneIds |
List |
Não |
Não |
Lista de zonas. |
Esta propriedade tem efeito apenas quando você seleciona parâmetros no console. |
|
SpotDuration |
Integer |
Não |
Não |
Período de retenção para uma instância spot. |
Valores válidos: 0 a 6. Unidade: horas.
|
|
SecurityGroupIds |
List |
Não |
Não |
Lista de IDs de grupos de segurança. |
Especifique SecurityGroupId ou SecurityGroupIds, mas não ambos. |
|
ImageId |
String |
Não |
Sim |
ID da imagem. Os valores válidos incluem imagens públicas, personalizadas e do Alibaba Cloud Marketplace. |
Para especificar uma imagem pública, insira um ID parcial da imagem em vez do ID completo. Imagens públicas suportam busca aproximada. Por exemplo:
|
|
InstanceType |
String |
Sim |
Sim |
Tipo da instância ECS. |
Tipos suportados: Famílias de instâncias. |
|
SecurityGroupId |
String |
Não |
Não |
ID do grupo de segurança. |
Especifique SecurityGroupId ou SecurityGroupIds, mas não ambos. |
|
SecurityEnhancementStrategy |
String |
Não |
Não |
Define se o hardening de segurança deve ser ativado. |
Valores válidos:
|
|
Description |
String |
Não |
Sim |
Descrição. |
Comprimento: 2 a 256 caracteres. |
|
InstanceName |
String |
Não |
Sim |
Nome da instância. |
O nome deve ter entre 2 e 128 caracteres. Deve começar com uma letra inglesa ou um caractere chinês e não pode começar com Se esta propriedade estiver vazia, o ID da instância será usado por padrão. |
|
Password |
String |
Não |
Sim |
Senha de login da instância ECS. |
Comprimento: 8 a 30 caracteres. A senha deve conter pelo menos três dos seguintes tipos de caracteres: letras maiúsculas, letras minúsculas, dígitos e caracteres especiais. Caracteres especiais válidos: |
|
PasswordInherit |
Boolean |
Não |
Não |
Define se a senha pré-definida na imagem deve ser usada. |
Valores válidos:
Nota
Deixe Password vazio ao usar esta propriedade. Além disso, certifique-se de que a imagem de runtime utilizada tenha uma senha configurada. |
|
HostName |
String |
Não |
Sim |
Hostname da instância ECS. |
O hostname deve ter pelo menos dois caracteres. Não pode começar ou terminar com ponto (.) ou hífen (-), nem conter pontos (.) ou hífens (-) consecutivos.
|
|
AllocatePublicIP |
Boolean |
Não |
Não |
Define se um endereço IP público deve ser atribuído. |
Valor:
Nota
Um IP público é atribuído se InternetMaxBandwidthOut for maior que 0. |
|
PrivateIpAddress |
String |
Não |
Não |
Endereço IP privado em uma virtual private cloud (VPC). |
O endereço IP não pode duplicar o endereço IP de outra instância na VPC. |
|
InternetChargeType |
String |
Não |
Sim |
Método de faturamento para acesso à rede pública. |
Valores válidos:
|
|
InternetMaxBandwidthOut |
Integer |
Não |
Sim |
Largura de banda pública de saída máxima. |
Valores válidos: 0 a 100. Valor padrão: 0. Unidade: Mbit/s. |
|
IoOptimized |
String |
Não |
Não |
Define se uma instância otimizada para I/O deve ser criada. |
Valores válidos:
|
|
DiskMappings |
List |
Não |
Sim |
Discos de dados a serem anexados. |
É possível especificar até 16 discos de dados. |
|
SystemDiskCategory |
String |
Não |
Sim |
Categoria do disco do sistema. |
Valores válidos:
Para instâncias não otimizadas para I/O de um tipo de instância descontinuado, o valor padrão é cloud. Para instâncias de outros tipos, o valor padrão é cloud_efficiency. |
|
SystemDiskDescription |
String |
Não |
Não |
Descrição do disco do sistema. |
Nenhuma |
|
SystemDiskDiskName |
String |
Não |
Não |
Nome do disco do sistema. |
Comprimento: 2 a 128 caracteres. O nome deve começar com uma letra ou um caractere chinês. Não pode começar com |
|
SystemDiskSize |
Number |
Não |
Sim |
Tamanho do disco do sistema. |
Valores válidos: 20 a 500. Unidade: GB. Se você usar uma imagem personalizada para criar um disco do sistema, garanta que o disco do sistema seja maior que o tamanho da imagem personalizada. |
|
Tags |
List |
Não |
Sim |
Tags personalizadas. |
É possível especificar até 20 tags. Formato: |
|
UserData |
String |
Não |
Sim |
Dados de usuário passados durante a criação da instância ECS. |
O conteúdo deve ter menos de 16 KiB. Não codifique o conteúdo em Base64. Escape caracteres especiais com barras invertidas (\). |
|
ZoneId |
String |
Não |
Não |
ID da zona. |
Nenhuma |
|
HpcClusterId |
String |
Não |
Não |
ID do cluster HPC ao qual a instância pertence. |
Nenhuma |
|
VpcId |
String |
Não |
Não |
ID da virtual private cloud (VPC). |
Nenhuma |
|
VSwitchId |
String |
Não |
Não |
ID do vSwitch. |
Nenhuma |
|
InstanceChargeType |
String |
Não |
Não |
Método de faturamento da instância ECS. |
Valores válidos:
|
|
Period |
Number |
Não |
Não |
Período de faturamento. |
Se InstanceChargeType for PrePaid, Period é obrigatório. Se InstanceChargeType for PostPaid, Period é opcional. |
|
KeyPairName |
String |
Não |
Sim |
Nome do par de chaves vinculado à instância ECS. |
Se o tipo de instância for Windows, ignore esta propriedade. Se o tipo de instância for Linux, o login por senha é desativado durante a inicialização. Para melhorar a segurança, utilize login por par de chaves. |
|
RamRoleName |
String |
Não |
Não |
Nome da função RAM da instância. |
|
|
SpotPriceLimit |
String |
Não |
Não |
Preço horário máximo para a instância. |
Até três casas decimais são suportadas. Esta propriedade tem efeito apenas quando SpotStrategy é SpotWithPriceLimit. |
|
SpotStrategy |
String |
Não |
Não |
Estratégia de lance para uma instância de pagamento conforme o uso. |
Especifique esta propriedade quando InstanceChargeType estiver definido como PostPaid. Valores:
|
|
DedicatedHostId |
String |
Não |
Não |
Dedicated Host onde a instância ECS será criada. |
Consulte a lista de IDs de Dedicated Host chamando a API DescribeDedicatedHosts. Não é possível criar instâncias spot em Dedicated Hosts. Se você especificar DedicatedHostId, o sistema ignorará automaticamente as configurações SpotStrategy e SpotPriceLimit na solicitação. |
|
PeriodUnit |
String |
Não |
Não |
Duração da compra. |
Valores válidos:
|
|
AutoRenewPeriod |
Number |
Não |
Não |
Duração de cada renovação automática. |
AutoRenewPeriod é uma propriedade obrigatória quando AutoRenew está definido como True. Valores:
|
|
AutoRenew |
String |
Não |
Não |
Define se a renovação automática deve ser ativada. |
Valores válidos:
Esta propriedade é obrigatória quando você define a propriedade InstanceChargeType como PrePaid. |
|
DeletionProtection |
Boolean |
Não |
Sim |
Configuração de proteção contra liberação da instância. Define se a liberação da instância é permitida através do console ou da operação DeleteInstance. |
Valores:
Nota
Esta propriedade aplica-se apenas a instâncias de pagamento conforme o uso. Ela restringe apenas operações manuais de liberação e não afeta operações de liberação iniciadas pelo sistema. |
|
DeploymentSetId |
String |
Não |
Não |
ID do conjunto de implantação. |
Nenhuma |
|
SystemDiskPerformanceLevel |
String |
Não |
Sim |
Defina o nível de desempenho ao criar um SSD empresarial como disco do sistema. |
Valores válidos:
Guia de seleção de ESSD: SSDs empresariais. |
|
CreditSpecification
|
String |
Não |
Sim |
Modo de execução para uma instância burstable. |
Valores válidos:
|
|
PrivatePoolOptions |
Map |
Não |
Não |
Opções de capacidade de pool privado para inicialização da instância. |
|
|
StorageSetId |
String |
Não |
Não |
ID do conjunto de armazenamento. |
Nenhuma |
|
HttpTokens |
String |
Não |
Sim |
Define se o modo reforçado (IMDSv2) deve ser imposto ao acessar metadados da instância. |
Valores válidos:
Nota
Padrões de acesso: Metadados da instância. |
|
SubscriptionDeletionForce |
Boolean |
Não |
Não |
Esta propriedade aplica-se apenas a instâncias de assinatura. Se esta propriedade for true, a instância é convertida para pagamento conforme o uso antes da exclusão. Se for false, a exclusão forçada não ocorre. Esta ação gera taxas adicionais. Use com cautela. |
Nenhuma |
|
HttpEndpoint |
String |
Não |
Sim |
Define se o endpoint de metadados da instância deve ser ativado. |
Valores válidos incluem:
Nota
|
|
Tenancy |
String |
Não |
Não |
Define se a instância deve ser criada em um Dedicated Host. |
Valores válidos:
|
|
StorageSetPartitionNumber |
Integer |
Não |
Não |
Número máximo de partições no conjunto de armazenamento. |
Valores válidos: inteiros maiores ou iguais a 2. |
|
DeploymentSetGroupNo |
Integer |
Não |
Não |
Se o conjunto de implantação usar a política AvailabilityGroup, use este parâmetro para especificar o número do grupo da instância no conjunto de implantação. |
Valores válidos: 1 a 7. |
|
Affinity |
String |
Não |
Não |
Define se a instância de Dedicated Host está associada ao Dedicated Host. |
Valores válidos:
|
|
UseAdditionalService |
Boolean |
Não |
Não |
Define se as configurações de sistema VM fornecidas pelo Alibaba Cloud devem ser usadas (Windows: NTP e KMS; Linux: NTP e YUM). |
Valores válidos:
|
|
ImageFamily |
String |
Não |
Não |
Nome da família de imagens. |
Especifique este parâmetro para consultar a imagem disponível mais recente pertencente à família de imagens atual e usá-la para criar uma instância.
Nota
Famílias de imagens disponíveis: imagem pública. |
Sintaxe de DiskMappings
"DiskMappings": [
{
"Category": String,
"DiskName": String,
"Description": String,
"Device": String,
"SnapshotId": String,
"PerformanceLevel": String,
"Size": String
}
]
Propriedades de DiskMappings
|
Nome da propriedade |
Tipo |
Obrigatório |
Atualização permitida |
Descrição |
Restrição |
|
Size |
String |
Sim |
Não |
Tamanho do disco de dados. |
Intervalo válido: 20 a 500. Unidade: GB. |
|
Category |
String |
Não |
Não |
Categoria do disco de dados. |
Valores válidos:
Para instâncias otimizadas para I/O, o valor padrão é cloud_efficiency. Para instâncias não otimizadas para I/O, o valor padrão é cloud. Se uma imagem personalizada contiver um disco de dados, defina a propriedade Category para a categoria de disco de dados desejada em um modelo ROS ao criar uma instância ECS. Por exemplo:
|
|
DiskName |
String |
Não |
Não |
Nome do disco de dados. |
Comprimento: 2 a 128 caracteres. O nome deve começar com uma letra ou um caractere chinês. Não pode começar com |
|
Description |
String |
Não |
Não |
Descrição. |
Comprimento: 2 a 256 caracteres. A descrição não pode começar com |
|
Device |
String |
Não |
Não |
Destino de montagem. |
Nenhuma |
|
PerformanceLevel |
String |
Não |
Não |
Nível de desempenho de um SSD empresarial usado como disco de dados. |
Valores válidos:
Guia de seleção de ESSD: SSD empresarial. |
|
SnapshotId |
String |
Não |
Não |
ID do snapshot usado para o disco de dados. |
Nenhuma |
Sintaxe de Tags
"Tags": [
{
"Value": String,
"Key": String
}
]
Propriedades de Tags
|
Nome da propriedade |
Tipo |
Obrigatório |
Atualização permitida |
Descrição |
Restrição |
|
Key |
String |
Sim |
Não |
Chave da tag. |
Comprimento: 1 a 128 caracteres. A chave não pode começar com |
|
Value |
String |
Não |
Não |
Valor da tag. |
Comprimento: 0 a 128 caracteres. O valor não pode começar com |
Sintaxe de PrivatePoolOptions
"PrivatePoolOptions": [
{
"Id": String,
"MatchCriteria": String
}
]
Propriedades de PrivatePoolOptions
|
Nome da propriedade |
Tipo |
Obrigatório |
Atualização permitida |
Descrição |
Restrição |
|
Id |
String |
Não |
Não |
ID do pool privado. Este é o ID do serviço de garantia elástica ou serviço de reserva de capacidade. |
Nenhuma |
|
MatchCriteria |
String |
Não |
Não |
Após o serviço de garantia elástica ou serviço de reserva de capacidade entrar em vigor, ele gera capacidade de pool privado para inicialização da instância. |
Valores válidos:
Em qualquer um dos cenários a seguir, a opção de capacidade de pool privado para inicialização de uma instância só pode ser definida como
|
Valores de retorno
Fn::GetAtt
InstanceId: ID da instância. Este é um identificador globalmente único gerado pelo sistema.
PrivateIp: Endereço IP privado de uma instância do tipo VPC.
InnerIp: Endereço IP interno de uma instância do tipo clássico.
PublicIp: Endereço IP público de uma instância do tipo clássico.
ZoneId: ID da zona.
HostName: Hostname da instância ECS.
PrimaryNetworkInterfaceId: ID da NIC primária.
SecurityGroupIds: Lista de IDs de grupos de segurança para a instância criada.
Exemplos
Cenário 1: Criar duas instâncias ECS e ativar login sem senha.
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: 专有网络VPC实例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": "专有网络VPC实例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": {}
}
Cenário 2: Criar uma instância ECS com múltiplos endereços IP privados.
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"
}
}
}
]
}
}
}
Cenário 3: Criar uma instância ECS e um Elastic IP Address (EIP), e anexar múltiplos discos de dados.
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: 新建交换机的网段,所属虚拟专有网络的子网
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": "新建交换机的网段,所属虚拟专有网络的子网",
"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"
}
}
}
]
}
}
}
Para mais exemplos, consulte modelos públicos que incluem este recurso.