Créez une instance ECS.
Cette ressource n'est plus mise à jour. Utilisez la ressource ALIYUN::ECS::InstanceGroup à la place.
Syntaxe
{
"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
}
}
Propriétés
|
Nom de la propriété |
Type |
Obligatoire |
Mise à jour autorisée |
Description |
Contrainte |
|
ResourceGroupId |
String |
Non |
Oui |
L'ID du groupe de ressources. |
Aucune |
|
SpotInterruptionBehavior |
String |
Non |
Non |
Le mode d'interruption pour une instance preemptive. |
Seule la valeur Terminate est prise en charge. Cette valeur libère l'instance immédiatement. Terminate est la valeur par défaut. |
|
ZoneIds |
List |
Non |
Non |
Une liste de zones. |
Cette propriété prend effet uniquement lorsque vous sélectionnez des paramètres dans la console. |
|
SpotDuration |
Integer |
Non |
Non |
La période de conservation d'une instance preemptive. |
Valeurs valides : 0 à 6. Unité : heures.
|
|
SecurityGroupIds |
List |
Non |
Non |
Une liste d'IDs de groupes de sécurité. |
Vous pouvez spécifier soit SecurityGroupId, soit SecurityGroupIds, mais pas les deux. |
|
ImageId |
String |
Non |
Oui |
L'ID de l'image. Les valeurs valides incluent les images publiques, les images personnalisées et les images Alibaba Cloud Marketplace. |
Pour spécifier une image publique, vous pouvez saisir un ID d'image partiel au lieu de l'ID complet. Les images publiques prennent en charge la recherche floue. Par exemple :
|
|
InstanceType |
String |
Oui |
Oui |
Le type d'instance ECS. |
Types pris en charge : Familles d'instances. |
|
SecurityGroupId |
String |
Non |
Non |
L'ID du groupe de sécurité. |
Vous pouvez spécifier soit SecurityGroupId, soit SecurityGroupIds, mais pas les deux. |
|
SecurityEnhancementStrategy |
String |
Non |
Non |
Indique s'il faut activer le durcissement de la sécurité. |
Les valeurs valides sont :
|
|
Description |
String |
Non |
Oui |
La description. |
Longueur : 2 à 256 caractères. |
|
InstanceName |
String |
Non |
Oui |
Le nom de l'instance. |
Le nom doit comporter entre 2 et 128 caractères. Il doit commencer par une lettre anglaise ou un caractère chinois et ne peut pas commencer par Si vous laissez cette propriété vide, l'ID de l'instance est utilisé par défaut. |
|
Password |
String |
Non |
Oui |
Le mot de passe de connexion pour l'instance ECS. |
Longueur : 8 à 30 caractères. Le mot de passe doit contenir au moins trois des types de caractères suivants : lettres majuscules, lettres minuscules, chiffres et caractères spéciaux. Caractères spéciaux valides : |
|
PasswordInherit |
Boolean |
Non |
Non |
Indique s'il faut utiliser le mot de passe prédéfini dans l'image. |
Les valeurs valides sont :
Remarque
Définissez Password sur vide lorsque vous utilisez cette propriété. Assurez-vous également que l'image d'exécution que vous utilisez dispose d'un mot de passe configuré. |
|
HostName |
String |
Non |
Oui |
Le nom d'hôte de l'instance ECS. |
Le nom d'hôte doit comporter au moins deux caractères. Il ne peut pas commencer ou se terminer par un point (.) ou un trait d'union (-), ni contenir des points (.) ou des traits d'union (-) consécutifs.
|
|
AllocatePublicIP |
Boolean |
Non |
Non |
Indique s'il faut attribuer une adresse IP publique. |
Valeur :
Remarque
Une IP publique est attribuée si InternetMaxBandwidthOut est supérieur à 0. |
|
PrivateIpAddress |
String |
Non |
Non |
L'adresse IP privée dans un cloud privé virtuel (VPC). |
L'adresse IP ne peut pas dupliquer l'adresse IP d'une autre instance dans le VPC. |
|
InternetChargeType |
String |
Non |
Oui |
La méthode de facturation pour l'accès au réseau public. |
Valeurs valides :
|
|
InternetMaxBandwidthOut |
Integer |
Non |
Oui |
La bande passante publique sortante maximale. |
Valeurs valides : 0 à 100. Valeur par défaut : 0. Unité : Mbit/s. |
|
IoOptimized |
String |
Non |
Non |
Indique s'il faut créer une instance optimisée pour les E/S. |
Valeurs valides :
|
|
DiskMappings |
List |
Non |
Oui |
Les disques de données à attacher. |
Vous pouvez spécifier jusqu'à 16 disques de données. |
|
SystemDiskCategory |
String |
Non |
Oui |
La catégorie du disque système. |
Les valeurs valides sont :
Pour les instances non optimisées pour les E/S d'un type d'instance retiré, la valeur par défaut est cloud. Pour les instances d'autres types, la valeur par défaut est cloud_efficiency. |
|
SystemDiskDescription |
String |
Non |
Non |
La description du disque système. |
Aucune |
|
SystemDiskDiskName |
String |
Non |
Non |
Le nom du disque système. |
Longueur : 2 à 128 caractères. Le nom doit commencer par une lettre ou un caractère chinois. Il ne peut pas commencer par |
|
SystemDiskSize |
Number |
Non |
Oui |
La taille du disque système. |
Valeurs valides : 20 à 500. Unité : Go. Si vous utilisez une image personnalisée pour créer un disque système, vous devez vous assurer que le disque système est plus grand que la taille de l'image personnalisée. |
|
Tags |
List |
Non |
Oui |
Les tags personnalisés. |
Vous pouvez spécifier jusqu'à 20 tags. Format : |
|
UserData |
String |
Non |
Oui |
Les données utilisateur transmises lors de la création de l'instance ECS. |
Le contenu doit être inférieur à 16 KiB. N'encodez pas le contenu en Base64. Échappez les caractères spéciaux avec des barres obliques inverses (\). |
|
ZoneId |
String |
Non |
Non |
L'ID de la zone. |
Aucune |
|
HpcClusterId |
String |
Non |
Non |
L'ID du cluster HPC auquel l'instance appartient. |
Aucune |
|
VpcId |
String |
Non |
Non |
L'ID du cloud privé virtuel (VPC). |
Aucune |
|
VSwitchId |
String |
Non |
Non |
L'ID du vSwitch. |
Aucune |
|
InstanceChargeType |
String |
Non |
Non |
La méthode de facturation pour l'instance ECS. |
Les valeurs valides sont :
|
|
Period |
Number |
Non |
Non |
La période de facturation. |
Si InstanceChargeType est PrePaid, Period est obligatoire. Si InstanceChargeType est PostPaid, Period est facultatif. |
|
KeyPairName |
String |
No |
Yes |
Nom de la paire de clés associée à l'instance ECS. |
Si le type d'instance est Windows, ignorez cette propriété. Si le type d'instance est Linux, la connexion par mot de passe est désactivée lors de l'initialisation. Pour renforcer la sécurité, utilisez la connexion par paire de clés. |
|
RamRoleName |
String |
No |
No |
Nom du rôle RAM de l'instance. |
|
|
SpotPriceLimit |
String |
No |
No |
Prix horaire maximal pour l'instance. |
Jusqu'à trois décimales sont prises en charge. Cette propriété n'est effective que lorsque SpotStrategy est défini sur SpotWithPriceLimit. |
|
SpotStrategy |
String |
No |
No |
Stratégie d'enchère pour une instance à paiement à l'utilisation. |
Vous devez spécifier cette propriété lorsque InstanceChargeType est défini sur PostPaid. Valeurs :
|
|
DedicatedHostId |
String |
No |
No |
Hôte dédié sur lequel créer l'instance ECS. |
Vous pouvez interroger la liste des ID d'hôtes dédiés en appelant l'API DescribeDedicatedHosts. Vous ne pouvez pas créer d'instances Spot sur des hôtes dédiés. Si vous spécifiez DedicatedHostId, le système ignore automatiquement les paramètres SpotStrategy et SpotPriceLimit de la requête. |
|
PeriodUnit |
String |
No |
No |
Durée de l'achat. |
Les valeurs valides sont :
|
|
AutoRenewPeriod |
Number |
No |
No |
Durée de chaque renouvellement automatique. |
AutoRenewPeriod est une propriété obligatoire lorsque AutoRenew est défini sur True. Valeurs :
|
|
AutoRenew |
String |
No |
No |
Indique s'il faut activer le renouvellement automatique. |
Valeurs valides :
Cette propriété est obligatoire lorsque vous définissez la propriété InstanceChargeType sur PrePaid. |
|
DeletionProtection |
Boolean |
No |
Yes |
Paramètre de protection contre la suppression de l'instance. Indique s'il est autorisé de supprimer l'instance via la console ou l'opération DeleteInstance. |
Valeurs :
Remarque
Cette propriété s'applique uniquement aux instances à paiement à l'utilisation. Elle restreint uniquement les opérations de suppression manuelles. Elle n'affecte pas les opérations de suppression initiées par le système. |
|
DeploymentSetId |
String |
No |
No |
ID de l'ensemble de déploiement. |
None |
|
SystemDiskPerformanceLevel |
String |
No |
Yes |
Vous pouvez définir le niveau de performance lors de la création d'un disque SSD Enterprise en tant que disque système. |
Valeurs valides :
Guide de sélection des disques ESSD : Disques SSD Enterprise. |
|
CreditSpecification
|
String |
No |
Yes |
Mode d'exécution d'une instance à capacité modulable. |
Valeurs valides :
|
|
PrivatePoolOptions |
Map |
No |
No |
Options de capacité de pool privé pour le démarrage de l'instance. |
|
|
StorageSetId |
String |
No |
No |
ID de l'ensemble de stockage. |
None |
|
HttpTokens |
String |
No |
Yes |
Indique s'il faut appliquer le mode renforcé (IMDSv2) lors de l'accès aux métadonnées de l'instance. |
Les valeurs valides sont :
Remarque
Modèles d'accès : Métadonnées de l'instance. |
|
SubscriptionDeletionForce |
Boolean |
No |
No |
Cette propriété s'applique uniquement aux instances par abonnement. Si cette propriété est true, l'instance est convertie en instance à paiement à l'utilisation avant sa suppression. Si cette propriété est false, aucune suppression forcée n'a lieu. Cette action entraîne des frais supplémentaires. Soyez prudent. |
None |
|
HttpEndpoint |
String |
No |
Yes |
Indique s'il faut activer le point de terminaison des métadonnées de l'instance. |
Les valeurs valides incluent les suivantes :
Remarque
|
|
Tenancy |
String |
No |
No |
Indique s'il faut créer l'instance sur un hôte dédié. |
Les valeurs valides sont :
|
|
StorageSetPartitionNumber |
Integer |
No |
No |
Nombre maximal de partitions dans l'ensemble de stockage. |
Valeurs valides : entiers supérieurs ou égaux à 2. |
|
DeploymentSetGroupNo |
Integer |
No |
No |
Si l'ensemble de déploiement utilise la politique AvailabilityGroup, utilisez ce paramètre pour spécifier le numéro de groupe de l'instance dans l'ensemble de déploiement. |
Valeurs valides : 1 à 7. |
|
Affinity |
String |
No |
No |
Indique si l'instance d'hôte dédié est associée à l'hôte dédié. |
Valeurs valides :
|
|
UseAdditionalService |
Boolean |
No |
No |
Indique s'il faut utiliser les configurations système de machine virtuelle fournies par Alibaba Cloud (Windows : NTP et KMS ; Linux : NTP et YUM). |
Les valeurs valides sont :
|
|
ImageFamily |
String |
No |
No |
Nom de la famille d'images. |
Vous pouvez spécifier ce paramètre pour interroger la dernière image disponible appartenant à la famille d'images actuelle et utiliser cette image pour créer une instance.
Remarque
Familles d'images disponibles : image publique. |
Syntaxe DiskMappings
"DiskMappings": [
{
"Category": String,
"DiskName": String,
"Description": String,
"Device": String,
"SnapshotId": String,
"PerformanceLevel": String,
"Size": String
}
]
Propriétés DiskMappings
|
Nom de la propriété |
Type |
Obligatoire |
Mise à jour autorisée |
Description |
Contrainte |
|
Size |
String |
Oui |
Non |
Taille du disque de données. |
Plage valide : 20 à 500. Unité : Go. |
|
Category |
String |
Non |
Non |
Catégorie du disque de données. |
Les valeurs valides sont les suivantes :
Pour les instances optimisées pour les E/S, la valeur par défaut est cloud_efficiency. Pour les instances non optimisées pour les E/S, la valeur par défaut est cloud. Si une image personnalisée contient un disque de données, vous pouvez définir la propriété Category sur la catégorie de disque de données souhaitée dans un modèle ROS lors de la création d'une instance ECS. Exemple :
|
|
DiskName |
String |
Non |
Non |
Nom du disque de données. |
Longueur : 2 à 128 caractères. Le nom doit commencer par une lettre ou un caractère chinois. Il ne peut pas commencer par |
|
Description |
String |
Non |
Non |
La description. |
Longueur : 2 à 256 caractères. La description ne peut pas commencer par |
|
Device |
String |
Non |
Non |
Point de montage. |
Aucune |
|
PerformanceLevel |
String |
Non |
Non |
Niveau de performance d'un SSD Enterprise utilisé comme disque de données. |
Les valeurs valides sont les suivantes :
Guide de sélection des ESSD : SSD Enterprise. |
|
SnapshotId |
String |
Non |
Non |
ID du snapshot utilisé pour le disque de données. |
Aucune |
Syntaxe Tags
"Tags": [
{
"Value": String,
"Key": String
}
]
Propriétés Tags
|
Nom de la propriété |
Type |
Obligatoire |
Mise à jour autorisée |
Description |
Contrainte |
|
Key |
String |
Oui |
Non |
Clé du tag. |
Longueur : 1 à 128 caractères. La clé ne peut pas commencer par |
|
Value |
String |
Non |
Non |
Valeur du tag. |
Longueur : 0 à 128 caractères. La valeur ne peut pas commencer par |
Syntaxe PrivatePoolOptions
"PrivatePoolOptions": [
{
"Id": String,
"MatchCriteria": String
}
]
Propriétés PrivatePoolOptions
|
Nom de la propriété |
Type |
Obligatoire |
Mise à jour autorisée |
Description |
Contrainte |
|
Id |
String |
Non |
Non |
ID du pool privé. Il s'agit de l'ID du service de garantie élastique ou du service de réservation de capacité. |
Aucune |
|
MatchCriteria |
String |
Non |
Non |
Une fois le service de garantie élastique ou le service de réservation de capacité activé, il génère une capacité de pool privé pour le démarrage des instances. |
Valeurs valides :
Dans l'un des scénarios suivants, l'option de capacité du pool privé pour un lancement d'instance ne peut être définie que sur
|
Valeurs de retour
Fn::GetAtt
InstanceId : ID de l'instance. Il s'agit d'un identifiant unique généré par le système.
PrivateIp : adresse IP privée d'une instance de type VPC.
InnerIp : adresse IP interne d'une instance de type classique.
PublicIp : adresse IP publique d'une instance de type classique.
ZoneId : ID de la zone.
HostName : nom d'hôte de l'instance ECS.
PrimaryNetworkInterfaceId : ID de la carte réseau principale.
SecurityGroupIds : liste des ID de groupes de sécurité pour l'instance créée.
Exemples
Scénario 1 : Créer deux instances ECS et activer la connexion sans mot de passe
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": {}
} Scénario 2 : Création d'une instance ECS avec plusieurs adresses IP privées.
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"
}
}
}
]
}
}
}Scénario 3 : Créer une instance ECS et une adresse IP élastique (EIP), et attacher plusieurs disques de données.
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"
}
}
}
]
}
}
}Pour plus d'exemples, consultez les modèles publics qui incluent cette ressource.