Enterprise Distributed Application Service (EDAS) is seamlessly integrated with instance launch templates. In scenarios such as application creation, scale-out, and auto scaling, you can use a configuration launch template to create resources for Elastic Compute Service (ECS) clusters in EDAS. This helps you create resources efficiently.

Introduction

An instance launch template persists ECS instance configurations and helps you create ECS instances. For more information about how to create an instance launch template, see Create a launch template. An instance launch template contains configurations that you can use to create instances. It can include all configurations except for passwords, such as key pairs, Resource Access Management (RAM) roles, instance types, and network configurations. An instance launch template cannot be modified. However, you can create multiple versions of each template and set different parameters for each version. Instance configurations are updated with versions. For more information about how to create another version of the template, see Create a template version. Then, you can create an instance by using any version of the template.

In EDAS, when you create an instance by using an instance launch template or based on existing instance specifications, the instance you create is billed in the pay-as-you-go mode. For more information, see Pay-as-you-go. After you release an instance, the billing rules vary with the recycling mode you select when you create the instance:
  • Release Mode: After an application is scaled in, EDAS automatically releases the instance that is no longer used. You only need to pay for the usage of the instance during its service period.
  • Shutdown and Reclaim Mode: After an application is scaled in, the instance that is no longer used is stopped and is not billed for CPU and memory resources. However, disks such as system disks and data disks, elastic IP addresses (EIPs), and bandwidth are still billed. The public IP address will be recycled and reassigned upon startup, whereas the EIP is retained. You only need to pay a low fee for the storage to retain the instance.

When EDAS directs you to configure the logon credentials for an instance launch template in the ECS console, we recommend that you use an SSH key pair. For more information, see Overview. A key pair is much more secure than a common password, which can prevent brute-force cracking. In addition, it is impossible for others to derive a private key from a public key. In EDAS, for access control between ECS instances or between an ECS instance and a cloud service, we recommend that you use a security group. For more information, see Overview. If you configure a security group when you create an ECS template, the ECS instances that you create by using the template in EDAS belong to the configured security group. Therefore, you can configure security group rules to control access permissions of the created ECS instance.

Prerequisites

An instance launch template is created. For more information, see Create a launch template.
Notice
  • The created instance launch template and your application must be in the same virtual private cloud (VPC). Otherwise, you cannot select the created instance launch template.
  • You must specify a vSwitch for the instance launch template when you select a VPC. Otherwise, the instance launch template cannot be used in EDAS.

Limits

In EDAS, instance launch templates can be used to create instances only for ECS clusters, not for Kubernetes clusters.

Add an instance by using an instance launch template when you create an application

  1. In the left-side navigation pane, choose Applications.
  2. On the Applications page, select the region where you want to create an application in the top navigation bar. In the upper part of the page, select the namespace that you want to use. Then, click Create Application in the upper-left corner of the page.
  3. In the Basic Information step, select Cluster Type and Application Runtime Environment, enter Application Name and Application Description (optional), and then click Next.
    • Cluster Type: Only an ECS cluster allows you to purchase an instance by using an instance launch template. Therefore, select ECS Clusters.
    • Application Runtime Environment: You can select Java, Tomcat, or EDAS-Container (HSF). In this example, EDAS-Container (HSF) is selected.
  4. In the Configurations step, set Instance Source to Purchase Instance, and then click Next.
    • Environment
      • If you do not have a VPC, namespace, or cluster, EDAS creates a default environment for you.
      • If you have created resources such as VPCs, namespaces, and clusters, you can see a drop-down list of corresponding resources. You can select a resource from the drop-down list.
    • Instance Source: Select Purchase Instance, and then select Purchase Based on Instance Launch Template for Purchase Method.
      • From the Select a launch template drop-down list, select the template and template version for creating the instance. If no instance launch template is available, you can create a template in the ECS console. For more information, see Create a launch template.
      • Set Recycling Mode.
      • Quantity: Select the quantity of instances to be purchased, such as 1.
      • Terms of Service: Select Elastic Compute Service Terms of Service | Terms of Service for Images.
  5. In the Advanced Settings step, enter Version and Application Health Check (optional), and then click Create Application.
    • Version: Enter a version in the format of yyyy-mm-dd hh:mm:ss. You can also enter other version IDs.
    • Application Health Check (optional): You can set the URL for health check, which is used to check whether the application is healthy.
  6. In the Creation Completed step, check information in the Basic Information, Configurations, and Advanced Settings sections, and then click Create Application.

Add an instance by using an instance launch template when you manually scale out an application

  1. Click an application. On the Basic Information page, click Scale Out in the upper-right corner. In the Add an Instance dialog box, set Target Group on the Scale-Out Method tab.
  2. Select Purchase Based on Instance Startup Template for Scale-Out Method.
  3. Select the template and template version, set Recycling Mode, and then click Next.
    • Use Bound Template: You must bind an instance launch template to a deployment group. For more information, see Bind an instance startup template. Then, select the bound template for scale-out.
    • Use Specified Template: If you have created multiple templates in the ECS console, you need to select a specific template and a version.
  4. On the Purchase Details tab, set Purchase Quantity, select ECS Service Terms | Image Service Terms, and then click Next.
  5. On the Confirm tab, check the quantity of ECS instances that you want to purchase and the information about the instance startup template. Verify all the information and click Confirm.
    On the top of the page, the "Automatic purchasing is triggered. Check the real-time information in the application change process." page appears.

Add an instance by using an instance launch template for auto scaling

You can add only instances for auto scaling of High-Speed Service Framework (HSF) applications in ECS clusters.

  1. On the application details page, click Auto Scaling in the left-side navigation pane.
  2. Turn on Scale-out Rule.
  3. Set the scale-out rule parameters and click Save.
    1. Trigger Metrics: Set the thresholds of RT, Load, and CPU. When a threshold is exceeded, scale-out is triggered.
    2. Trigger Conditions:
      • Any One of the Metrics: Auto scale-out is triggered when the threshold of any metric is exceeded.
      • All Metrics: Auto scale-out is triggered only when the thresholds of all metrics are exceeded.
    3. Last for More Than: indicates the duration when the metric continuously reaches the threshold, in minutes. Within the duration, if the average value of a metric every minute continuously reaches the set threshold, auto scale-out is triggered. You can configure the duration based on the sensitivity of the cluster service capabilities.
    4. Application Source: Select Elastic Resources.
      • Creation Method: Select Purchase Based on Instance Launch Template.
      • Launch Template: Click Select Template. In the Select a launch template dialog box, select the template and template version, set Recycling Mode, and then click OK.
      • Terms of Service: Select Elastic Compute Service Terms of Service | Terms of Service for Images.
      • Advanced Options: Turn on it and set Network Type and Multi-zone Scaling Policy.
        • Network Type: Specify the network where the application to be scaled out is located, which cannot be changed. If the network is a VPC, you must specify the vSwitch that is connected to the new instance. If you specify multiple vSwitches, EDAS will automatically allocate vSwitches based on the multi-zone scaling policy.
        • Multi-zone Scaling Policy: You can select Priority Policy or Balanced Distribution Policy.
    5. Number of Instances to Add for Each Scale-Out: indicates the number of instances that are automatically added upon each scale-out. You can set this parameter based on the service capabilities of a single instance of the application.
    6. Maximum Number of Instances in Group: indicates the maximum number of instances in a cluster. When the maximum number is reached, scale-out stops. You can set this parameter based on the resource quota.

Verify the result

After you add an instance by using any type of template, you can view the number and status of the application instances on the Instance Information tab.

References