Crea una instancia ECS.
Este recurso ya no recibe actualizaciones. Utilice el recurso ALIYUN::ECS::InstanceGroup en su lugar.
Sintaxis
{
"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
}
}
Propiedades
|
Nombre de la propiedad |
Tipo |
Obligatorio |
Actualización permitida |
Descripción |
Restricción |
|
ResourceGroupId |
String |
No |
Sí |
ID del resource group. |
Ninguna |
|
SpotInterruptionBehavior |
String |
No |
No |
Modo de interrupción para una instancia spot. |
Solo se admite Terminate. Este valor libera la instancia de inmediato. Terminate es el valor predeterminado. |
|
ZoneIds |
List |
No |
No |
Lista de zonas. |
Esta propiedad solo surte efecto cuando selecciona parámetros en la consola. |
|
SpotDuration |
Integer |
No |
No |
Periodo de retención para una instancia spot. |
Valores válidos: 0 a 6. Unidad: horas.
|
|
SecurityGroupIds |
List |
No |
No |
Lista de IDs de security group. |
Puede especificar SecurityGroupId o SecurityGroupIds, pero no ambos. |
|
ImageId |
String |
No |
Sí |
ID de la imagen. Los valores válidos incluyen imágenes públicas, imágenes personalizadas e imágenes de Alibaba Cloud Marketplace. |
Para especificar una imagen pública, puede introducir un ID parcial de imagen en lugar del ID completo. Las imágenes públicas admiten búsqueda difusa. Por ejemplo:
|
|
InstanceType |
String |
Sí |
Sí |
Tipo de instancia ECS. |
Tipos compatibles: Instance families. |
|
SecurityGroupId |
String |
No |
No |
ID del security group. |
Puede especificar SecurityGroupId o SecurityGroupIds, pero no ambos. |
|
SecurityEnhancementStrategy |
String |
No |
No |
Indica si se debe habilitar el endurecimiento de seguridad. |
Valores válidos:
|
|
Description |
String |
No |
Sí |
Descripción. |
Longitud: 2 a 256 caracteres. |
|
InstanceName |
String |
No |
Sí |
Nombre de la instancia. |
El nombre debe tener entre 2 y 128 caracteres de longitud. Debe comenzar con una letra inglesa o un carácter chino y no puede empezar con Si deja esta propiedad vacía, se utiliza el ID de la instancia de forma predeterminada. |
|
Password |
String |
No |
Sí |
Contraseña de inicio de sesión para la instancia ECS. |
Longitud: 8 a 30 caracteres. La contraseña debe contener como mínimo tres de los siguientes tipos de caracteres: letras mayúsculas, letras minúsculas, dígitos y caracteres especiales. Caracteres especiales válidos: |
|
PasswordInherit |
Boolean |
No |
No |
Indica si se debe usar la contraseña preestablecida en la imagen. |
Valores válidos:
Nota
Deje Password vacío cuando utilice esta propiedad. Además, asegúrese de que la imagen de tiempo de ejecución que utiliza tenga una contraseña configurada. |
|
HostName |
String |
No |
Sí |
Nombre de host de la instancia ECS. |
El nombre de host debe tener al menos dos caracteres de longitud. No puede comenzar ni terminar con un punto (.) o un guion (-), ni contener puntos (.) o guiones (-) consecutivos.
|
|
AllocatePublicIP |
Boolean |
No |
No |
Indica si se debe asignar una dirección IP pública. |
Valor:
Nota
Se asigna una IP pública si InternetMaxBandwidthOut es mayor que 0. |
|
PrivateIpAddress |
String |
No |
No |
Dirección IP privada en una virtual private cloud (VPC). |
La dirección IP no puede duplicar la dirección IP de otra instancia en la VPC. |
|
InternetChargeType |
String |
No |
Sí |
Método de facturación para el acceso a la red pública. |
Valores válidos:
|
|
InternetMaxBandwidthOut |
Integer |
No |
Sí |
Ancho de banda público de salida máximo. |
Valores válidos: 0 a 100. Valor predeterminado: 0. Unidad: Mbit/s. |
|
IoOptimized |
String |
No |
No |
Indica si se debe crear una instancia optimizada para E/S. |
Valores válidos:
|
|
DiskMappings |
List |
No |
Sí |
Discos de datos que se van a conectar. |
Puede especificar hasta 16 discos de datos. |
|
SystemDiskCategory |
String |
No |
Sí |
Categoría del disco del sistema. |
Valores válidos:
Para instancias no optimizadas para E/S de un tipo de instancia retirado, el valor predeterminado es cloud. Para instancias de otros tipos, el valor predeterminado es cloud_efficiency. |
|
SystemDiskDescription |
String |
No |
No |
Descripción del disco del sistema. |
Ninguna |
|
SystemDiskDiskName |
String |
No |
No |
Nombre del disco del sistema. |
Longitud: 2 a 128 caracteres. El nombre debe comenzar con una letra o un carácter chino. No puede empezar con |
|
SystemDiskSize |
Number |
No |
Sí |
Tamaño del disco del sistema. |
Valores válidos: 20 a 500. Unidad: GB. Si utiliza una imagen personalizada para crear un disco del sistema, debe asegurarse de que el disco del sistema sea más grande que el tamaño de la imagen personalizada. |
|
Tags |
List |
No |
Sí |
Etiquetas personalizadas. |
Puede especificar hasta 20 etiquetas. Formato: |
|
UserData |
String |
No |
Sí |
Datos de usuario pasados al crear la instancia ECS. |
El contenido debe ser menor a 16 KiB. No codifique el contenido en Base64. Escape los caracteres especiales con barras invertidas (\). |
|
ZoneId |
String |
No |
No |
ID de la zona. |
Ninguna |
|
HpcClusterId |
String |
No |
No |
ID del clúster HPC al que pertenece la instancia. |
Ninguna |
|
VpcId |
String |
No |
No |
ID de la virtual private cloud (VPC). |
Ninguna |
|
VSwitchId |
String |
No |
No |
ID del vSwitch. |
Ninguna |
|
InstanceChargeType |
String |
No |
No |
Método de facturación para la instancia ECS. |
Valores válidos:
|
|
Period |
Number |
No |
No |
Periodo de facturación. |
Si InstanceChargeType es PrePaid, Period es obligatorio. Si InstanceChargeType es PostPaid, Period es opcional. |
|
KeyPairName |
String |
No |
Sí |
Nombre del key pair vinculado a la instancia ECS. |
Si el tipo de instancia es Windows, ignore esta propiedad. Si el tipo de instancia es Linux, el inicio de sesión basado en contraseña se deshabilita durante la inicialización. Para mejorar la seguridad, utilice el inicio de sesión basado en key pair. |
|
RamRoleName |
String |
No |
No |
Nombre del rol RAM de la instancia. |
|
|
SpotPriceLimit |
String |
No |
No |
Precio horario máximo para la instancia. |
Se admiten hasta tres decimales. Esta propiedad solo surte efecto cuando SpotStrategy es SpotWithPriceLimit. |
|
SpotStrategy |
String |
No |
No |
Estrategia de puja para una instancia pay-as-you-go. |
Debe especificar esta propiedad cuando InstanceChargeType está establecido en PostPaid. Valores:
|
|
DedicatedHostId |
String |
No |
No |
Dedicated Host en el que se creará la instancia ECS. |
Puede consultar la lista de IDs de Dedicated Host llamando a la API DescribeDedicatedHosts. No puede crear instancias spot en Dedicated Hosts. Si especifica DedicatedHostId, el sistema ignora automáticamente las configuraciones SpotStrategy y SpotPriceLimit en la solicitud. |
|
PeriodUnit |
String |
No |
No |
Duración de la compra. |
Valores válidos:
|
|
AutoRenewPeriod |
Number |
No |
No |
Duración de cada renovación automática. |
AutoRenewPeriod es una propiedad obligatoria cuando AutoRenew está establecido en True. Valores:
|
|
AutoRenew |
String |
No |
No |
Indica si se debe habilitar la renovación automática. |
Valores válidos:
Esta propiedad es obligatoria cuando establece la propiedad InstanceChargeType en PrePaid. |
|
DeletionProtection |
Boolean |
No |
Sí |
Configuración de protección contra liberación de la instancia. Indica si se permite liberar la instancia a través de la consola o la operación DeleteInstance. |
Valores:
Nota
Esta propiedad solo aplica a instancias pay-as-you-go. Solo restringe las operaciones de liberación manual. No afecta las operaciones de liberación iniciadas por el sistema. |
|
DeploymentSetId |
String |
No |
No |
ID del conjunto de despliegue. |
Ninguna |
|
SystemDiskPerformanceLevel |
String |
No |
Sí |
Puede establecer el nivel de rendimiento cuando crea un SSD empresarial como disco del sistema. |
Valores válidos:
Guía de selección de ESSD: Enterprise SSDs. |
|
CreditSpecification
|
String |
No |
Sí |
Modo de ejecución para una instancia burstable. |
Valores válidos:
|
|
PrivatePoolOptions |
Map |
No |
No |
Opciones de capacidad de pool privado para el inicio de la instancia. |
|
|
StorageSetId |
String |
No |
No |
ID del conjunto de almacenamiento. |
Ninguna |
|
HttpTokens |
String |
No |
Sí |
Indica si se debe aplicar el modo endurecido (IMDSv2) al acceder a los metadatos de la instancia. |
Valores válidos:
Nota
Patrones de acceso: Instance metadata. |
|
SubscriptionDeletionForce |
Boolean |
No |
No |
Esta propiedad solo aplica a instancias de suscripción. Si esta propiedad es true, la instancia se convierte a una instancia pay-as-you-go antes de la eliminación. Si esta propiedad es false, no se produce la eliminación forzada. Esta acción genera cargos adicionales. Proceda con precaución. |
Ninguna |
|
HttpEndpoint |
String |
No |
Sí |
Indica si se debe habilitar el endpoint de metadatos de la instancia. |
Valores válidos:
Nota
|
|
Tenancy |
String |
No |
No |
Indica si se debe crear la instancia en un Dedicated Host. |
Valores válidos:
|
|
StorageSetPartitionNumber |
Integer |
No |
No |
Número máximo de particiones en el conjunto de almacenamiento. |
Valores válidos: enteros mayores o iguales a 2. |
|
DeploymentSetGroupNo |
Integer |
No |
No |
Si el conjunto de despliegue utiliza la directiva AvailabilityGroup, use este parámetro para especificar el número de grupo de la instancia en el conjunto de despliegue. |
Valores válidos: 1 a 7. |
|
Affinity |
String |
No |
No |
Indica si la instancia de Dedicated Host está asociada con el Dedicated Host. |
Valores válidos:
|
|
UseAdditionalService |
Boolean |
No |
No |
Indica si se deben utilizar las configuraciones del sistema VM proporcionadas por Alibaba Cloud (Windows: NTP y KMS; Linux: NTP y YUM). |
Valores válidos:
|
|
ImageFamily |
String |
No |
No |
Nombre de la familia de imágenes. |
Puede especificar este parámetro para consultar la última imagen disponible que pertenece a la familia de imágenes actual y usar la imagen para crear una instancia.
Nota
Familias de imágenes disponibles: public image. |
Sintaxis de DiskMappings
"DiskMappings": [
{
"Category": String,
"DiskName": String,
"Description": String,
"Device": String,
"SnapshotId": String,
"PerformanceLevel": String,
"Size": String
}
]
Propiedades de DiskMappings
|
Nombre de la propiedad |
Tipo |
Obligatorio |
Actualización permitida |
Descripción |
Restricción |
|
Size |
String |
Sí |
No |
Tamaño del disco de datos. |
Rango válido: 20 a 500. Unidad: GB. |
|
Category |
String |
No |
No |
Categoría del disco de datos. |
Valores válidos:
Para instancias optimizadas para E/S, el valor predeterminado es cloud_efficiency. Para instancias no optimizadas para E/S, el valor predeterminado es cloud. Si una imagen personalizada contiene un disco de datos, puede establecer la propiedad Category en la categoría de disco de datos que desea utilizar en una plantilla ROS cuando crea una instancia ECS. Por ejemplo:
|
|
DiskName |
String |
No |
No |
Nombre del disco de datos. |
Longitud: 2 a 128 caracteres. El nombre debe comenzar con una letra o un carácter chino. No puede empezar con |
|
Description |
String |
No |
No |
Descripción. |
Longitud: 2 a 256 caracteres. La descripción no puede empezar con |
|
Device |
String |
No |
No |
Destino de montaje. |
Ninguna |
|
PerformanceLevel |
String |
No |
No |
Nivel de rendimiento de un SSD empresarial utilizado como disco de datos. |
Valores válidos:
Guía de selección de ESSD: enterprise SSD. |
|
SnapshotId |
String |
No |
No |
ID de la instantánea utilizada para el disco de datos. |
Ninguna |
Sintaxis de Tags
"Tags": [
{
"Value": String,
"Key": String
}
]
Propiedades de Tags
|
Nombre de la propiedad |
Tipo |
Obligatorio |
Actualización permitida |
Descripción |
Restricción |
|
Key |
String |
Sí |
No |
Clave de la etiqueta. |
Longitud: 1 a 128 caracteres. La clave no puede comenzar con |
|
Value |
String |
No |
No |
Valor de la etiqueta. |
Longitud: 0 a 128 caracteres. El valor no puede comenzar con |
Sintaxis de PrivatePoolOptions
"PrivatePoolOptions": [
{
"Id": String,
"MatchCriteria": String
}
]
Propiedades de PrivatePoolOptions
|
Nombre de la propiedad |
Tipo |
Obligatorio |
Actualización permitida |
Descripción |
Restricción |
|
Id |
String |
No |
No |
ID del pool privado. Este es el ID del servicio de garantía elástica o del servicio de reserva de capacidad. |
Ninguna |
|
MatchCriteria |
String |
No |
No |
Después de que el servicio de garantía elástica o el servicio de reserva de capacidad entra en vigor, genera capacidad de pool privado para el inicio de la instancia. |
Valores válidos:
En cualquiera de los siguientes escenarios, la opción de capacidad de pool privado para el inicio de una instancia solo puede establecerse en
|
Valores de retorno
Fn::GetAtt
InstanceId: ID de la instancia. Es un identificador único global generado por el sistema.
PrivateIp: Dirección IP privada de una instancia de tipo VPC.
InnerIp: Dirección IP interna de una instancia de tipo clásico.
PublicIp: Dirección IP pública de una instancia de tipo clásico.
ZoneId: ID de la zona.
HostName: Nombre de host de la instancia ECS.
PrimaryNetworkInterfaceId: ID de la NIC principal.
SecurityGroupIds: Lista de IDs de security group para la instancia creada.
Ejemplos
Escenario 1: Crear dos instancias ECS y habilitar el inicio de sesión sin contraseña.
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": {}
} Escenario 2: Crear una instancia ECS con múltiples direcciones IP privadas.
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"
}
}
}
]
}
}
}Escenario 3: Crear una instancia ECS y una Elastic IP Address (EIP), y conectar múltiples discos de datos.
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 más ejemplos, consulte plantillas públicas que incluyen este recurso.