Tous les produits
Search
Centre de documentation

Resource Orchestration Service:ALIYUN::SLB::LoadBalancer

Dernière mise à jour :Aug 10, 2026

Crée une instance Server Load Balancer (SLB).

Syntaxe

{
  "Type": "ALIYUN::SLB::LoadBalancer",
  "Properties": {
    "DeletionProtection": Boolean,
    "AddressType": String,
    "Tags": List,
    "InternetChargeType": String,
    "Bandwidth": Integer,
    "SlaveZoneId": String,
    "ResourceGroupId": String,
    "VpcId": String,
    "LoadBalancerName": String,
    "VSwitchId": String,
    "LoadBalancerSpec": String,
    "MasterZoneId": String,
    "ModificationProtectionReason": String,
    "ModificationProtectionStatus": String,
    "AddressIPVersion": String,
    "InstanceChargeType": String
  }
}

Propriétés

Nom de la propriété

Type

Obligatoire

Mise à jour autorisée

Description

Contrainte

ResourceGroupId

String

Non

Oui

ID du groupe de ressources.

Aucune

DeletionProtection

Boolean

Non

Oui

Active la protection contre la suppression.

Valeurs valides :

  • true : active la protection contre la suppression.

  • false (par défaut) : désactive la protection contre la suppression.

VpcId

String

Non

Non

ID du VPC.

Aucune

SlaveZoneId

String

Non

Non

ID de la zone secondaire de l'instance SLB.

Aucune

Bandwidth

Integer

Non

Oui

Bande passante maximale des instances Internet facturées selon la bande passante.

Valeurs valides : 1 à 10000.

Unité : Mbit/s.

Valeur par défaut : 1.

Les instances VPC sont par défaut facturées selon le transfert de données.

  • Facturation par bande passante : allouez la bande passante à chaque écouteur via le paramètre Bandwidth de l'écouteur avant que le paramètre ne prenne effet.

  • Facturation par transfert de données : définissez directement la bande passante maximale dans chaque écouteur. Cette propriété est ignorée.

AddressType

String

Non

Non

Type d'adresse de l'instance SLB.

Valeurs valides :

  • internet (par défaut) : attribue une adresse IP publique. Le nom de domaine se résout en adresse IP publique. Accessible depuis Internet.

  • intranet : attribue uniquement une adresse IP privée. Le nom de domaine se résout en adresse IP privée. Accessible uniquement au sein du même VPC.

VSwitchId

String

Non

Non

ID du vSwitch.

Aucune

LoadBalancerName

String

Non

Oui

Nom de l'instance SLB.

Longueur : 1 à 80 caractères. Les caractères valides incluent les lettres, les chiffres, les traits d'union (-), les barres obliques (/), les points (.) et les traits de soulignement (_).

Par défaut, un nom attribué par le système.

InternetChargeType

String

Non

Oui

Méthode de facturation pour les instances Internet.

Valeurs valides :

  • paybybandwidth : facturation par bande passante.

  • paybytraffic (par défaut) : facturation par transfert de données.

MasterZoneId

String

Non

Non

ID de la zone principale de l'instance.

Aucune

Tags

List

Non

Oui

Tags de l'instance SLB.

Vous pouvez ajouter jusqu'à cinq tags.

Propriété Tags.

LoadBalancerSpec

String

Non

Oui

Spécification de l'instance SLB.

Valeurs valides :

  • slb.s1.small (par défaut)

  • slb.s2.small

  • slb.s2.medium

  • slb.s3.small

  • slb.s3.medium

  • slb.s3.large

  • slb.s3.xlarge

  • slb.s3.xxlarge

Les spécifications disponibles varient selon la région. instance à performances garanties.

ModificationProtectionStatus

String

Non

Oui

Statut de la protection contre la modification.

Valeurs valides :

  • NonProtection (par défaut) : désactive la protection contre la modification.

  • ConsoleProtection : autorise les modifications via la console.

ModificationProtectionReason

String

Non

Oui

Raison de l'activation de la protection contre la modification.

Longueur : 1 à 80 caractères. Doit commencer par une lettre ou un caractère chinois. Les caractères valides incluent les lettres, les caractères chinois, les chiffres, les points (.) et les traits d'union (-).

AddressIPVersion

String

Non

Non

Version IP.

Valeurs valides :

  • ipv4

  • ipv6

    Remarque

    Si vous spécifiez ipv6, vérifiez les régions prises en charge et les limites.

InstanceChargeType

String

Non

Oui

Méthode de facturation de l'instance.

Valeurs valides :

  • PayBySpec (par défaut) : facturation par spécification.

  • PayByCLCU : facturation par LCU (Load Balancer Capacity Unit).

Syntaxe des tags

"Tags": [
  {
    "Key": String,
    "Value": String 
  }
]

Propriété Tags

Nom de la propriété

Type

Obligatoire

Mise à jour autorisée

Description

Contrainte

Key

String

Oui

Non

Clé du tag.

Longueur : 1 à 64 caractères. Ne peut pas commencer par aliyun ni acs:. Ne peut pas contenir http:// ni https://.

Value

String

Non

Non

Valeur du tag.

Longueur : 0 à 128 caractères. Ne peut pas commencer par aliyun ni acs:. Ne peut pas contenir http:// ni https://.

Valeurs de retour

Fn::GetAtt

  • LoadBalancerId : ID de l'instance SLB.

  • NetworkType : type de réseau de l'instance SLB.

  • AddressType : type d'adresse de l'instance SLB.

  • IpAddress : adresse IP de l'instance SLB.

  • OrderId : ID de la commande.

  • Bandwidth : bande passante maximale.

  • AddressIPVersion : version IP de l'instance SLB.

  • SlaveZoneId : ID de la zone secondaire de l'instance SLB.

  • MasterZoneId : ID de la zone principale de l'instance SLB.

  • LoadBalancerName : nom de l'instance SLB.

  • ResourceGroupId : ID du groupe de ressources.

  • LoadBalancerSpec : spécification de l'instance SLB.

  • VpcId : ID du VPC de l'instance SLB.

  • VSwitchId : ID du vSwitch de l'instance SLB.

  • PayType : méthode de facturation de l'instance.

Exemples

Scénario 1 : Créer une instance SLB.

Création rapide

ROSTemplateFormatVersion: '2015-09-01'
Description: Test SLB LoadBalancer
Parameters:
  MasterZoneId:
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Resources:
  LoadBalance:
    Type: ALIYUN::SLB::LoadBalancer
    Properties:
      AddressType: internet
      LoadBalancerSpec: slb.s1.small
      MasterZoneId:
        Ref: MasterZoneId
      LoadBalancerName: mytest
Outputs: {}
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Test SLB LoadBalancer",
  "Parameters": {
    "MasterZoneId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId"
    }
  },
  "Resources": {
    "LoadBalance": {
      "Type": "ALIYUN::SLB::LoadBalancer",
      "Properties": {
        "AddressType": "internet",
        "LoadBalancerSpec": "slb.s1.small",
        "MasterZoneId": {
          "Ref": "MasterZoneId"
        },
        "LoadBalancerName": "mytest"
      }
    }
  },
  "Outputs": {
  }
}

Scénario 2 : Créer un groupe d'instances ECS et l'associer à une instance SLB.

Création rapide

ROSTemplateFormatVersion: '2015-09-01'
Description:
  en: Create an ECS instance group with flexible configuration and automatically bind to three SLB instances to achieve load balancing.
Parameters:
  ZoneId:
    Type: String
    Default: null
    Required: true
    Label:
      en: Availability Zone
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
    AssociationPropertyMetadata:
      AutoSelectFirst: true
  VpcId:
    Type: String
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
  VSwitchId:
    Type: String
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      ZoneId: ${ZoneId}
      VpcId: ${VpcId}
  SecurityGroupId:
    Type: String
    Label:
      en: Business Security Group ID
    AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
  InstanceType:
    Type: String
    Label: ECS Instance Type
    AssociationProperty: ALIYUN::ECS::Instance::InstanceType
    AssociationPropertyMetadata:
      ZoneId: ZoneId
  Password:
    Type: String
    Label: ECS Instance Password
    AssociationProperty: ALIYUN::ECS::Instance::Password
  SlbInstanceId:
    AssociationProperty: ALIYUN::SLB::LoadBalancer::LoadBalancerId
    Type: String
Resources:
  InstanceGroup:
    Type: ALIYUN::ECS::InstanceGroup
    Properties:
      VpcId:
        Ref: VpcId
      VSwitchId:
        Ref: VSwitchId
      SecurityGroupId:
        Ref: SecurityGroupId
      ImageId: centos_7
      AllocatePublicIP: 'false'
      MaxAmount: 2
      Password:
        Ref: Password
      InstanceType:
        Ref: InstanceType
      SystemDiskCategory: cloud_essd
      UserData:
        Fn::Join:
        - ''
        - - '#!/bin/sh

            '
          - 'ip_addr=`ifconfig eth0 | awk ''/inet /{print $2}''`

            '
          - 'host_name=`hostname`

            '
          - 'echo "$ip_addr $host_name" >> /etc/hosts

            '
  AttachmentECSToSLB:
    Type: ALIYUN::SLB::BackendServerAttachment
    Properties:
      LoadBalancerId:
        Ref: SlbInstanceId
      BackendServerList:
        Fn::GetAtt:
        - InstanceGroup
        - InstanceIds
      BackendServerWeightList:
      - '100'
Outputs:
  InstanceIds:
    Description: The instance id list of created ecs instance.
    Value:
      Fn::GetAtt:
      - InstanceGroup
      - InstanceIds
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "en": "Create an ECS instance group with flexible configuration and automatically bind to three SLB instances to achieve load balancing."
  },
  "Parameters": {
    "ZoneId": {
      "Type": "String",
      "Default": null,
      "Required": true,
      "Label": {
        "en": "Availability Zone"
      },
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
      "AssociationPropertyMetadata": {
        "AutoSelectFirst": true
      }
    },
    "VpcId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
    },
    "VSwitchId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "ZoneId": "${ZoneId}",
        "VpcId": "${VpcId}"
      }
    },
    "SecurityGroupId": {
      "Type": "String",
      "Label": {
        "en": "Business Security Group ID"
      },
      "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}"
      }
    },
    "InstanceType": {
      "Type": "String",
      "Label": "ECS Instance Type",
      "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
      "AssociationPropertyMetadata": {
        "ZoneId": "ZoneId"
      }
    },
    "Password": {
      "Type": "String",
      "Label": "ECS Instance Password",
      "AssociationProperty": "ALIYUN::ECS::Instance::Password"
    },
    "SlbInstanceId": {
      "AssociationProperty": "ALIYUN::SLB::LoadBalancer::LoadBalancerId",
      "Type": "String"
    }
  },
  "Resources": {
    "InstanceGroup": {
      "Type": "ALIYUN::ECS::InstanceGroup",
      "Properties": {
        "VpcId": {
          "Ref": "VpcId"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "SecurityGroupId": {
          "Ref": "SecurityGroupId"
        },
        "ImageId": "centos_7",
        "AllocatePublicIP": "false",
        "MaxAmount": 2,
        "Password": {
          "Ref": "Password"
        },
        "InstanceType": {
          "Ref": "InstanceType"
        },
        "SystemDiskCategory": "cloud_essd",
        "UserData": {
          "Fn::Join": [
            "",
            [
              "#!/bin/sh\n",
              "ip_addr=`ifconfig eth0 | awk '/inet /{print $2}'`\n",
              "host_name=`hostname`\n",
              "echo \"$ip_addr $host_name\" >> /etc/hosts\n"
            ]
          ]
        }
      }
    },
    "AttachmentECSToSLB": {
      "Type": "ALIYUN::SLB::BackendServerAttachment",
      "Properties": {
        "LoadBalancerId": {
          "Ref": "SlbInstanceId"
        },
        "BackendServerList": {
          "Fn::GetAtt": [
            "InstanceGroup",
            "InstanceIds"
          ]
        },
        "BackendServerWeightList": [
          "100"
        ]
      }
    }
  },
  "Outputs": {
    "InstanceIds": {
      "Description": "The instance id list of created ecs instance.",
      "Value": {
        "Fn::GetAtt": [
          "InstanceGroup",
          "InstanceIds"
        ]
      }
    }
  }
}

Scénario 3 : Créer un plan de protection pour un site e-commerce.

Création rapide

ROSTemplateFormatVersion: '2015-09-01'
Description:
  en: Develop an e-commerce website protection plan, encompassing Virtual Private Cloud (VPC), Elastic Compute Service (ECS), Server Load Balancer (SLB), and Relational Database Service (RDS) resources. Implement measures to prevent scalpers from exploiting promotions, ensuring service stability and the authenticity of discounts. Deploy across multiple availability zones for redundancy and high availability.
Parameters:
  VpcCidrBlock:
    Type: String
    Label:
      en: VPC CIDR Block
    Description:
      en: 'The IP address range of the VPC in the CIDR Block form; You can use the following IP address ranges: <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>'
    Default: 192.168.0.0/16
    AllowedValues:
    - 10.0.0.0/8
    - 172.16.0.0/12
    - 192.168.0.0/16
  VSwitchZoneId:
    Type: String
    Label:
      en: Master Zone
    Description:
      en: 'Availability Zone ID;<br><b>Note: <font color=''blue''>Before selecting an availability zone, verify that it supports the required specifications for creating SLB, RDS and ECS resources.</font>'
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
  VswCidrBlock:
    Type: String
    Label:
      en: Master Zone CIDR Block
    Description:
      en: Must be a subnet segment that belongs to the VPC and is not occupied by another vSwitch.
    Default: 192.168.1.0/24
  VSwitchZoneId2:
    Type: String
    Label:
      en: Slave Zone
    Description:
      en: 'Availability Zone ID,<b>Note: <font color=''blue''>Before selecting an availability zone, verify that it supports the required specifications for creating SLB resources and differs from the primary zone.</font>'
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
  VswCidrBlock2:
    Type: String
    Label:
      en: Slave Zone CIDR Block
    Description:
      en: Must be a subnet segment that belongs to the VPC and is not occupied by another vSwitch.
    Default: 192.168.2.0/24
  EcsInstanceType:
    Type: String
    Label:
      en: Instance Type
    Description:
      en: 'Enter the instance types available in the vSwitch availability zone.</b></font>General-purpose instance types: <font color=''red''><b>ecs.g5.xlarge</font>Note: Some zones do not support general-purpose instance types.<br>For details, see <a href=''https://www.alibabacloud.com/help/en/doc-detail/25378.html'' target=''_blank''><b><font color=''blue''>Instance family</font></a>'
    AssociationProperty: ALIYUN::ECS::Instance::InstanceType
    AssociationPropertyMetadata:
      ZoneId: VSwitchZoneId
  ECSImageId:
    Type: String
    Label:
      en: Application Server Image
    Description:
      en: 'Server instance image ID. </b>[Shanghai: <font color=''green''>m-uf6j125b6mhvg27jo58a</font>]<br>[Hangzhou: <font color=''green''>m-bp1h0ys627i2ke0dx0t1</font>]<br>[Beijing: <font color=''green''>m-2zeir96eip2yw414w1jd</font>]<br>[Qingdao: <font color=''green''>m-m5e81ywnfuk84x1r7v0n</font>]<br>[Shenzhen: <font color=''green''>m-wz98u1criwvafhq3ctfm</font>]<br>[Zhangjiakou: <font color=''green''>m-8vbg3h5yp5ncag0q31lt</font>]<br>[Hohhot: <font color=''green''>m-hp34cnncgeiowbkzpmic</font>]<br>[Hong Kong: <font color=''green''>m-j6c0e5hkfmzk6d8bfss1</font>]<br>[US (Silicon Valley): <font color=''green''>m-rj981ywnfuk84x1r7v0p</font>]<br>Note: For more images, see <b><a href=''https://marketplace.alibabacloud.com/products?keywords=magento'' target=''_blank''><font color=''blue''>Magento image</font></a>'
  SystemDiskCategory:
    Type: String
    Label:
      en: Disk Type
    Description:
      en: '<font color=''blue''>Valid values:</font>[cloud_efficiency: <font color=''green''>Ultra disk</font>]<br>[cloud_ssd: <font color=''green''>Standard SSD</font>]<br>[cloud_essd: <font color=''green''>Enterprise SSD</font>]<br>[cloud: <font color=''green''>Basic disk</font>]<br>[ephemeral_ssd: <font color=''green''>Local SSD</font>]'
    Default: cloud_efficiency
    AllowedValues:
    - cloud_efficiency
    - cloud_ssd
    - cloud
    - cloud_essd
    - ephemeral_ssd
  SystemDiskSize:
    Type: Number
    Label:
      en: System Disk Size
    Description:
      en: 'System disk size. Valid values: 40 to 500. Unit: GB.'
    ConstraintDescription:
      en: 'Valid values: 40 to 500. Unit: GB.'
    Default: 40
    MinValue: 40
    MaxValue: 500
  EcsPassword:
    Type: String
    Label:
      en: Login Password
    Description:
      en: 'Server logon password. Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters ()`~!@#$%^&*_-+=| {}[]:;' <>,.? / .'
    ConstraintDescription:
      en: 'Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters ()`~!@#$%^&*_-+=| {}[]:;' <>,.? / .'
    AssociationProperty: 'ALIYUN::ECS::Instance::Password'
  LoadBalancerName:
    Type: String
    Label:
      en: Instance Name
    Description:
      en: 'Length: 1 to 80 characters. Valid characters include letters, digits, hyphens (-), forward slashes (/), periods (.), and underscores (_).'
    Default: slb001
  LoadBalancerSpec:
    Type: String
    Label:
      en: Specifications
    Description:
      en: 'Instance specifications.</br>For details, see <a href=''https://www.alibabacloud.com/help/doc-detail/85939.html'' target=''_blank''><b><font color=''blue''>Guaranteed-performance instance</font></a>'
    Default: slb.s1.small
  DBInstanceEngineAndVersion:
    Type: String
    Label:
      en: Type And Version
    Description:
      en: Database engine type and version number.
    Default: MySQL-5.6
    AllowedValues:
    - MySQL-5.5
    - MySQL-5.6
    - MySQL-5.7
    - MySQL-8.0
  DBInstanceClass:
    Type: String
    Label:
      en: Specifications
    Description:
      en: 'Select the instance specification based on the database engine type and region support.For details, see <a href=''https://www.alibabacloud.com/help/doc-detail/26312.html'' target=''_blank''><b><font color=''blue''>Instance specification sheet</font></a>'
    Default: rds.mysql.s2.large
  DBInstanceStorage:
    Type: Number
    Label:
      en: Storage Space
    Description:
      en: 'Database storage space. Unit: GB. Increments: 5 GB. Valid values: 5 to 1000.'
    ConstraintDescription:
      en: 'Database storage space. Unit: GB. Increments: 5 GB. Valid values: 5 to 1000.'
    Default: 5
    MinValue: 5
    MaxValue: 1000
  RdsUserPassword:
    Type: String
    Label:
      en: Password
    Description:
      en: 'The privileged account password for the database instance. Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters !@#$%^&*()_+-=. Length: 8 to 32 characters.'
    AssociationProperty: ALIYUN::RDS::Instance::AccountPassword
    ConstraintDescription:
      en: 'Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters !@#$%^&*()_+-=. Length: 8 to 32 characters.'
    MinLength: 8
    MaxLength: 32
    NoEcho: true
  DBName:
    Type: String
    Label:
      en: Database Name
    Description:
      en: 'Database name. Consists of lowercase letters, digits, and hyphens (-) or underscores (_). Must start with a letter and end with a letter or digit. Maximum length: 64 characters.'
    Default: db_magento
  RdsUserType:
    Type: String
    Label:
      en: Account Type
    Description:
      en: 'Database account type. <font color=''blue''>Valid values:</font>[Normal: <font color=''green''>Standard account</font>]<br>[Super: <font color=''green''>Privileged account</font>]'
    Default: Normal
    AllowedValues:
    - Super
    - Normal
  RdsUserName:
    Type: String
    Label:
      en: Database Account
    Description:
      en: 'Database account name. Consists of lowercase letters, digits, and underscores (_). Must start with a letter and end with a letter or digit. Length: 2 to 16 characters.'
    Default: account_magento
    MinLength: 2
    MaxLength: 16
Resources:
  Vpc:
    Type: ALIYUN::ECS::VPC
    Properties:
      CidrBlock:
        Ref: VpcCidrBlock
      VpcName:
        Fn::Join:
        - '-'
        - - Stack
          - Ref: ALIYUN::StackId
  SecurityGroup:
    Type: ALIYUN::ECS::SecurityGroup
    Properties:
      VpcId:
        Ref: Vpc
      SecurityGroupIngress:
      - IpProtocol: tcp
        Policy: accept
        PortRange: 3389/3389
        Priority: 1
        SourceCidrIp: 0.0.0.0/0
      Tags:
      - Key: best_practice
        Value: '065'
  VSwitch:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      ZoneId:
        Ref: VSwitchZoneId
      VpcId:
        Ref: Vpc
      CidrBlock:
        Ref: VswCidrBlock
      VSwitchName:
        Fn::Join:
        - '-'
        - - Stack
          - Ref: ALIYUN::StackId
          - Fn::Select:
            - '2'
            - Fn::Split:
              - '-'
              - Ref: VSwitchZoneId
  ECS:
    Type: ALIYUN::ECS::Instance
    Properties:
      ZoneId:
        Ref: VSwitchZoneId
      VpcId:
        Ref: Vpc
      VSwitchId:
        Ref: VSwitch
      SecurityGroupId:
        Ref: SecurityGroup
      ImageId:
        Ref: ECSImageId
      AllocatePublicIP: true
      HostName: APP001
      InstanceName: APP001
      InstanceType:
        Ref: EcsInstanceType
      InternetChargeType: PayByTraffic
      Password:
        Ref: EcsPassword
      SystemDiskCategory:
        Ref: SystemDiskCategory
      SystemDiskSize:
        Ref: SystemDiskSize
      Tags:
      - Key: '065'
        Value: best_practice
  SLBLoadBalance:
    Type: ALIYUN::SLB::LoadBalancer
    Properties:
      VpcId:
        Ref: Vpc
      AddressType: internet
      InternetChargeType: paybytraffic
      LoadBalancerName:
        Ref: LoadBalancerName
      LoadBalancerSpec:
        Ref: LoadBalancerSpec
      MasterZoneId:
        Ref: VSwitchZoneId
      PayType: PayOnDemand
      SlaveZoneId:
        Ref: VSwitchZoneId2
      Tags:
      - Key: '065'
        Value: best_practice
  BackendServerAttachment:
    Type: ALIYUN::SLB::BackendServerAttachment
    Properties:
      BackendServerList:
      - Ref: ECS
      BackendServerWeightList:
      - 100
      LoadBalancerId:
        Ref: SLBLoadBalance
    DependsOn:
    - ECS
    - SLBLoadBalance
  Listener:
    Type: ALIYUN::SLB::Listener
    Properties:
      BackendServerPort: 80
      Bandwidth: -1
      ListenerPort: 80
      LoadBalancerId:
        Ref: SLBLoadBalance
      Protocol: http
    DependsOn: SLBLoadBalance
  RdsDBInstance:
    Type: ALIYUN::RDS::DBInstance
    Properties:
      VpcId:
        Ref: Vpc
      VSwitchId:
        Ref: VSwitch
      DBInstanceClass:
        Ref: DBInstanceClass
      DBInstanceStorage:
        Ref: DBInstanceStorage
      DBMappings:
      - CharacterSetName: utf8
        DBName:
          Ref: DBName
      Engine:
        Fn::Select:
        - '0'
        - Fn::Split:
          - '-'
          - Ref: DBInstanceEngineAndVersion
      EngineVersion:
        Fn::Select:
        - '1'
        - Fn::Split:
          - '-'
          - Ref: DBInstanceEngineAndVersion
      MasterUserPassword:
        Ref: RdsUserPassword
      MasterUserType:
        Ref: RdsUserType
      MasterUsername:
        Ref: RdsUserName
      MultiAZ: true
      SecurityIPList:
        Ref: VpcCidrBlock
      Tags:
        Key: best_practice
        Value: '065'
Outputs:
  ECSPublicIP:
    Description: Public IP address of the Magento server
    Value:
      Fn::GetAtt:
      - ECS
      - PublicIp
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
    - Parameters:
      - VpcCidrBlock
      - VSwitchZoneId
      - VswCidrBlock
      - VSwitchZoneId2
      - VswCidrBlock2
      Label:
        default: VPC
    - Parameters:
      - EcsInstanceType
      - ECSImageId
      - SystemDiskCategory
      - SystemDiskSize
      - EcsPassword
      Label:
        default: ECS
    - Parameters:
      - LoadBalancerName
      - LoadBalancerSpec
      Label:
        default: SLB
    - Parameters:
      - DBInstanceEngineAndVersion
      - DBInstanceClass
      - DBInstanceStorage
      - RdsUserPassword
      - DBName
      - RdsUserType
      - RdsUserName
      Label:
        default: RDS
    TemplateTags:
    - acs:solution:security&compliance:e-commerce website business security
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "en": "Develop an e-commerce website protection plan, encompassing Virtual Private Cloud (VPC), Elastic Compute Service (ECS), Server Load Balancer (SLB), and Relational Database Service (RDS) resources. Implement measures to prevent scalpers from exploiting promotions, ensuring service stability and the authenticity of discounts. Deploy across multiple availability zones for redundancy and high availability."
  },
  "Parameters": {
    "VpcCidrBlock": {
      "Type": "String",
      "Label": {
        "en": "VPC CIDR Block"
      },
      "Description": {
        "en": "The IP address range of the VPC in the CIDR Block form; You can use the following IP address ranges: <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>"
      },
      "Default": "192.168.0.0/16",
      "AllowedValues": [
        "10.0.0.0/8",
        "172.16.0.0/12",
        "192.168.0.0/16"
      ]
    },
    "VSwitchZoneId": {
      "Type": "String",
      "Label": {
        "en": "Master Zone"
      },
      "Description": {
        "en": "Availability Zone ID;<br><b>Note: <font color='blue'>Before selecting an availability zone, verify that it supports the required specifications for creating SLB, RDS, ECS resources.</font>"
      },
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId"
    },
    "VswCidrBlock": {
      "Type": "String",
      "Label": {
        "en": "Master Zone CIDR Block"
      },
      "Description": {
        "en": "Must be a subnet segment that belongs to a proprietary network and is not occupied by another vSwitch."
      },
      "Default": "192.168.1.0/24"
    },
    "VSwitchZoneId2": {
      "Type": "String",
      "Label": {
        "en": "Slave Zone"
      },
      "Description": {
        "en": "Availability Zone ID,<b>Note: <font color='blue'>Before selecting an availability zone, verify that it supports the required specifications for creating SLB resources, not the same as the primary zone.</font>"
      },
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId"
    },
    "VswCidrBlock2": {
      "Type": "String",
      "Label": {
        "en": "Slave Zone CIDR Block"
      },
      "Description": {
        "en": "Must be a subnet segment that belongs to a proprietary network and is not occupied by another vSwitch."
      },
      "Default": "192.168.2.0/24"
    },
    "EcsInstanceType": {
      "Type": "String",
      "Label": {
        "en": "Instance Type"
      },
      "Description": {
        "en": "Fill in the specifications that can be used under the vSwitch availability zone;</b></font>general-purpose instance types: <font color='red'><b>ecs.g5.xlarge</font>note: a few zones do not support general-purpose instance types<br>see detail: <a href='https://www.alibabacloud.com/help/en/doc-detail/25378.html' target='_blank'><b><font color='blue'>Instance family</font></a>"
      },
      "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
      "AssociationPropertyMetadata": {
        "ZoneId": "VSwitchZoneId"
      }
    },
    "ECSImageId": {
      "Type": "String",
      "Label": {
        "en": "Application Server Image"
      },
      "Description": {
        "en": "Server instance image ID. </b>[Shanghai: <font color='green'>m-uf6j125b6mhvg27jo58a</font>]<br>[Hangzhou: <font color='green'>m-bp1h0ys627i2ke0dx0t1</font>]<br>[Beijing: <font color='green'>m-2zeir96eip2yw414w1jd</font>]<br>[Qingdao: <font color='green'>m-m5e81ywnfuk84x1r7v0n</font>]<br>[Shenzhen: <font color='green'>m-wz98u1criwvafhq3ctfm</font>]<br>[Zhangjiakou: <font color='green'>m-8vbg3h5yp5ncag0q31lt</font>]<br>[Hohhot: <font color='green'>m-hp34cnncgeiowbkzpmic</font>]<br>[Hong Kong: <font color='green'>m-j6c0e5hkfmzk6d8bfss1</font>]<br>[US(Silincon Valley): <font color='green'>m-rj981ywnfuk84x1r7v0p</font>]<br>note: for more images available, see detail: <b><a href='https://marketplace.alibabacloud.com/products?keywords=magento' target='_blank'><font color='blue'>Magento image</font></a>"
      }
    },
    "SystemDiskCategory": {
      "Type": "String",
      "Label": {
        "en": "Disk Type"
      },
      "Description": {
        "en": "<font color='blue'>Valid values:</font>[cloud_efficiency: <font color='green'>Ultra disk</font>]<br>[cloud_ssd: <font color='green'>Standard SSD</font>]<br>[cloud_essd: <font color='green'>Enterprise SSD</font>]<br>[cloud: <font color='green'>Basic disk</font>]<br>[ephemeral_ssd: <font color='green'>Local SSD</font>]"
      },
      "Default": "cloud_efficiency",
      "AllowedValues": [
        "cloud_efficiency",
        "cloud_ssd",
        "cloud",
        "cloud_essd",
        "ephemeral_ssd"
      ]
    },
    "SystemDiskSize": {
      "Type": "Number",
      "Label": {
        "en": "System Disk Size"
      },
      "Description": {
        "en": "System disk size, range of values: 40-500, units: GB."
      },
      "ConstraintDescription": {
        "en": "Valid values: 40 to 500. Unit: GB."
      },
      "Default": 40,
      "MinValue": 40,
      "MaxValue": 500
    },
    "EcsPassword": {
      "Type": "String",
      "Label": {
        "en": "Login Password"
      },
      "Description": {
        "en": "Server logon password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=| {}[]:;' <>,.? / Special symbol in)."
      },
      "ConstraintDescription": {
        "en": "Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=| {}[]:;' <>,.? / Special symbol in)."
      },
      "AssociationProperty": "ALIYUN::ECS::Instance::Password"
    },
    "LoadBalancerName": {
      "Type": "String",
      "Label": {
        "en": "Instance Name"
      },
      "Description": {
        "en": "Length: 1-80 characters. Can contain Chinese, letters, digits and special characters('-', '/', '.', '_')."
      },
      "Default": "slb001"
    },
    "LoadBalancerSpec": {
      "Type": "String",
      "Label": {
        "en": "Specifications"
      },
      "Description": {
        "en": "Instance specifications,</br>see detail: <a href='https://www.alibabacloud.com/help/doc-detail/85939.html' target='_blank'><font color='blue'>Guaranteed-performance instance</font></a>"
      },
      "Default": "slb.s1.small"
    },
    "DBInstanceEngineAndVersion": {
      "Type": "String",
      "Label": {
        "en": "Type And Version"
      },
      "Description": {
        "en": "Database type and version number."
      },
      "Default": "MySQL-5.6",
      "AllowedValues": [
        "MySQL-5.5",
        "MySQL-5.6",
        "MySQL-5.7",
        "MySQL-8.0"
      ]
    },
    "DBInstanceClass": {
      "Type": "String",
      "Label": {
        "en": "Specifications"
      },
      "Description": {
        "en": "Select the instance specification based on the type of database engine and the available area support;see detail: <a href='https://www.alibabacloud.com/help/doc-detail/26312.html' target='_blank'><b><font color='blue'>Instance specification sheet</font></a>"
      },
      "Default": "rds.mysql.s2.large"
    },
    "DBInstanceStorage": {
      "Type": "Number",
      "Label": {
        "en": "Storage Space"
      },
      "Description": {
        "en": "Database storage space, unit: GB, increasing every 5GB, valid value: 5-1000."
      },
      "ConstraintDescription": {
        "en": "Database storage space, unit: GB, increasing every 5GB, valid value: 5-1000."
      },
      "Default": 5,
      "MinValue": 5,
      "MaxValue": 1000
    },
    "RdsUserPassword": {
      "Type": "String",
      "Label": {
        "en": "Password"
      },
      "Description": {
        "en": "The primary account password for the database instance.Large/lowercase letters, Numbers and special characters take up three kinds, and the length is 8-32 bits. Special characters included! @ # $% ^ & * () _ + - ="
      },
      "AssociationProperty": "ALIYUN::RDS::Instance::AccountPassword",
      "ConstraintDescription": {
        "en": "Large/lowercase letters, Numbers and special characters take up three kinds, and the length is 8-32 bits. Special characters included! @ # $% ^ & * () _ + - ="
      },
      "MinLength": 8,
      "MaxLength": 32,
      "NoEcho": true
    },
    "DBName": {
      "Type": "String",
      "Label": {
        "en": "Database Name"
      },
      "Description": {
        "en": "Database name, consisting of lowercase letters, Numbers, and special characters (-_), starting with letters, ending with letters or Numbers, up to 64 characters."
      },
      "Default": "db_magento"
    },
    "RdsUserType": {
      "Type": "String",
      "Label": {
        "en": "Account Type"
      },
      "Description": {
        "en": "Database account type, <font color='blue'>Valid values: </font>[Normal: <font color='green'>Standard account</font>]<br>[Super: <font color='green'>Privileged account</font>]"
      },
      "Default": "Normal",
      "AllowedValues": [
        "Super",
        "Normal"
      ]
    },
    "RdsUserName": {
      "Type": "String",
      "Label": {
        "en": "Database Account"
      },
      "Description": {
        "en": "Consists of lowercase letters, Numbers, and underscores, beginning with letters, ending with letters or Numbers, up to 16 characters, and at least 2 characters."
      },
      "Default": "account_magento",
      "MinLength": 2,
      "MaxLength": 16
    }
  },
  "Resources": {
    "Vpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": {
          "Ref": "VpcCidrBlock"
        },
        "VpcName": {
          "Fn::Join": [
            "-",
            [
              "Stack",
              {
                "Ref": "ALIYUN::StackId"
              }
            ]
          ]
        }
      }
    },
    "SecurityGroup": {
      "Type": "ALIYUN::ECS::SecurityGroup",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "SecurityGroupIngress": [
          {
            "IpProtocol": "tcp",
            "Policy": "accept",
            "PortRange": "3389/3389",
            "Priority": 1,
            "SourceCidrIp": "0.0.0.0/0"
          }
        ],
        "Tags": [
          {
            "Key": "best_practice",
            "Value": "065"
          }
        ]
      }
    },
    "VSwitch": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "ZoneId": {
          "Ref": "VSwitchZoneId"
        },
        "VpcId": {
          "Ref": "Vpc"
        },
        "CidrBlock": {
          "Ref": "VswCidrBlock"
        },
        "VSwitchName": {
          "Fn::Join": [
            "-",
            [
              "Stack",
              {
                "Ref": "ALIYUN::StackId"
              },
              {
                "Fn::Select": [
                  "2",
                  {
                    "Fn::Split": [
                      "-",
                      {
                        "Ref": "VSwitchZoneId"
                      }
                    ]
                  }
                ]
              }
            ]
          ]
        }
      }
    },
    "ECS": {
      "Type": "ALIYUN::ECS::Instance",
      "Properties": {
        "ZoneId": {
          "Ref": "VSwitchZoneId"
        },
        "VpcId": {
          "Ref": "Vpc"
        },
        "VSwitchId": {
          "Ref": "VSwitch"
        },
        "SecurityGroupId": {
          "Ref": "SecurityGroup"
        },
        "ImageId": {
          "Ref": "ECSImageId"
        },
        "AllocatePublicIP": true,
        "HostName": "APP001",
        "InstanceName": "APP001",
        "InstanceType": {
          "Ref": "EcsInstanceType"
        },
        "InternetChargeType": "PayByTraffic",
        "Password": {
          "Ref": "EcsPassword"
        },
        "SystemDiskCategory": {
          "Ref": "SystemDiskCategory"
        },
        "SystemDiskSize": {
          "Ref": "SystemDiskSize"
        },
        "Tags": [
          {
            "Key": "065",
            "Value": "best_practice"
          }
        ]
      }
    },
    "SLBLoadBalance": {
      "Type": "ALIYUN::SLB::LoadBalancer",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "AddressType": "internet",
        "InternetChargeType": "paybytraffic",
        "LoadBalancerName": {
          "Ref": "LoadBalancerName"
        },
        "LoadBalancerSpec": {
          "Ref": "LoadBalancerSpec"
        },
        "MasterZoneId": {
          "Ref": "VSwitchZoneId"
        },
        "PayType": "PayOnDemand",
        "SlaveZoneId": {
          "Ref": "VSwitchZoneId2"
        },
        "Tags": [
          {
            "Key": "065",
            "Value": "best_practice"
          }
        ]
      }
    },
    "BackendServerAttachment": {
      "Type": "ALIYUN::SLB::BackendServerAttachment",
      "Properties": {
        "BackendServerList": [
          {
            "Ref": "ECS"
          }
        ],
        "BackendServerWeightList": [
          100
        ],
        "LoadBalancerId": {
          "Ref": "SLBLoadBalance"
        }
      },
      "DependsOn": [
        "ECS",
        "SLBLoadBalance"
      ]
    },
    "Listener": {
      "Type": "ALIYUN::SLB::Listener",
      "Properties": {
        "BackendServerPort": 80,
        "Bandwidth": -1,
        "ListenerPort": 80,
        "LoadBalancerId": {
          "Ref": "SLBLoadBalance"
        },
        "Protocol": "http"
      },
      "DependsOn": "SLBLoadBalance"
    },
    "RdsDBInstance": {
      "Type": "ALIYUN::RDS::DBInstance",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "VSwitchId": {
          "Ref": "VSwitch"
        },
        "DBInstanceClass": {
          "Ref": "DBInstanceClass"
        },
        "DBInstanceStorage": {
          "Ref": "DBInstanceStorage"
        },
        "DBMappings": [
          {
            "CharacterSetName": "utf8",
            "DBName": {
              "Ref": "DBName"
            }
          }
        ],
        "Engine": {
          "Fn::Select": [
            "0",
            {
              "Fn::Split": [
                "-",
                {
                  "Ref": "DBInstanceEngineAndVersion"
                }
              ]
            }
          ]
        },
        "EngineVersion": {
          "Fn::Select": [
            "1",
            {
              "Fn::Split": [
                "-",
                {
                  "Ref": "DBInstanceEngineAndVersion"
                }
              ]
            }
          ]
        },
        "MasterUserPassword": {
          "Ref": "RdsUserPassword"
        },
        "MasterUserType": {
          "Ref": "RdsUserType"
        },
        "MasterUsername": {
          "Ref": "RdsUserName"
        },
        "MultiAZ": true,
        "SecurityIPList": {
          "Ref": "VpcCidrBlock"
        },
        "Tags": {
          "Key": "best_practice",
          "Value": "065"
        }
      }
    }
  },
  "Outputs": {
    "ECSPublicIP": {
      "Description": "Public IP address of the Magento server",
      "Value": {
        "Fn::GetAtt": [
          "ECS",
          "PublicIp"
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "VpcCidrBlock",
            "VSwitchZoneId",
            "VswCidrBlock",
            "VSwitchZoneId2",
            "VswCidrBlock2"
          ],
          "Label": {
            "default": "VPC"
          }
        },
        {
          "Parameters": [
            "EcsInstanceType",
            "ECSImageId",
            "SystemDiskCategory",
            "SystemDiskSize",
            "EcsPassword"
          ],
          "Label": {
            "default": "ECS"
          }
        },
        {
          "Parameters": [
            "LoadBalancerName",
            "LoadBalancerSpec"
          ],
          "Label": {
            "default": "SLB"
          }
        },
        {
          "Parameters": [
            "DBInstanceEngineAndVersion",
            "DBInstanceClass",
            "DBInstanceStorage",
            "RdsUserPassword",
            "DBName",
            "RdsUserType",
            "RdsUserName"
          ],
          "Label": {
            "default": "RDS"
          }
        }
      ],
      "TemplateTags": [
        "acs:solution:security&compliance:e-commerce website business security"
      ]
    }
  }
}

Parcourez les modèles publics qui incluent cette ressource.