When you deploy applications in Enterprise Distributed Application Service (EDAS), you often need to provision multiple Elastic Compute Service (ECS) instances with identical configurations. A launch template stores these configurations as a reusable blueprint. Use a launch template to create instances consistently across three scenarios: application creation, manual scale-out, and auto scaling.
How launch templates work
A launch template stores instance configurations such as key pairs, Resource Access Management (RAM) roles, instance types, and network settings. Passwords are not stored in launch templates.
Each template supports multiple versions with different parameter sets. You cannot modify a template after creation -- instead, create new versions to update configurations. Select a specific version each time you create an instance.
For more information, see Create a launch template and Create a launch template version.
Limits
Launch templates in EDAS support ECS clusters only. You cannot use launch templates to create instances for Kubernetes clusters.
The launch template and your EDAS application must be in the same virtual private cloud (VPC). Otherwise, you cannot select the launch template in EDAS.
You must select a vSwitch when you configure the VPC for the launch template. Otherwise, you cannot select the launch template in EDAS.
Add an instance when you create an application
Before you begin, create a launch template in the ECS console.
This procedure walks you through configuring basic application information, selecting a launch template as the instance source, and creating the application.
Log on to the EDAS console.
In the left-side navigation pane, choose Application Management > Applications.
Select a region in the top navigation bar and a microservices namespace in the upper part of the page. Click Create Application.
In the Basic Information step, configure the following parameters and click Next:
Parameter Description Cluster Type Select ECS Clusters. Application Runtime Environment Select Java, Tomcat, or EDAS-Container (HSF). Application Name Enter a name for the application. Application Description (Optional) Enter a description. In the Configurations step, configure the deployment package and instance source:
Network and environment resources: If you have not created resources such as VPCs, microservices namespaces, or clusters, EDAS creates a default microservices namespace and cluster. If you already have these resources, select them from the drop-down lists.
Instance Source: Select Purchase Instance, then select Purchase Based on Instance Launch Template as the Purchase Method.
Parameter Description Select a launch template Choose a template and template version from the drop-down lists. If no template is available, create one in the ECS console. Recycling Mode Select Release Mode or Shutdown and Reclaim Mode. See Billing for details. Quantity Enter the number of instances to purchase. Terms of Service Read and select Elastic Compute Service Terms of Service | Terms of Service for Images.
Click Next.
In the Advanced Settings step, configure the following parameters and click Create Application:
Parameter Description Version Use a timestamp (such as 2024-01-15 10:30:00) or a custom version identifier.Application Health Check (Optional) Enter the URL for health checks. In the Creation Completed step, verify the settings in the Basic Information, Configurations, and Advanced Settings sections. Click Create Application.
Add an instance during a manual scale-out
Log on to the EDAS console.
In the left-side navigation pane, choose Application Management > Applications. Select a region and a microservices namespace, then click the application name.
In the upper-right corner of the application details page, click Scale Out.
In the Add Instance dialog box, specify Target Group in the Scale-out Method step.
For Scale-Out Method, select Purchase Based on Instance Launch Template. Choose a template source: Configure the Recycling Mode and click Next.
Use Bound Template: Use a launch template already associated with the application instance group. To associate a template, see Associate a launch template with an application instance group.
Use Specified Template: Select a template and template version from the ECS console.
In the Purchase Details step, set Quantity, select Elastic Compute Service Terms of Service | Terms of Service for Images, and click Next.
In the Confirm step, verify the instance count and launch template details. Click Confirm. After confirmation, the message Automatic purchasing is triggered. Check the real-time information in the application change process appears at the top of the page.
Add an instance through auto scaling
Auto scaling with launch templates is available only for High-Speed Service Framework (HSF) applications in ECS clusters.
Log on to the EDAS console.
In the left-side navigation pane, choose Application Management > Applications. Select a region and a microservices namespace, then click the application name.
In the left-side navigation pane of the application details page, click Auto Scaling.
In the Scale-out Rule section, turn on the switch in the upper-right corner.
Configure the scale-out rule parameters and click Save. To configure multi-zone deployment, turn on Advanced Options in the Application Source section:
Parameter Description Trigger Metrics Set thresholds for RT (response time), Load, and CPU. A scale-out triggers when a threshold is exceeded. Trigger Conditions Any One of the Metrics: triggers when any single metric exceeds its threshold. All Metrics: triggers only when all metrics exceed their thresholds. Last for More Than Duration in minutes. A scale-out triggers when the average metric value exceeds the threshold every minute within this duration. Adjust based on cluster sensitivity. Application Source Select Elastic Resources. For Creation Method, select Purchase Based on Instance Launch Template. Click Select Template to choose a template and version, then set the Recycling Mode and click OK. Read and select Elastic Compute Service Terms of Service | Terms of Service for Images. Number of Instances to Add for Each Scale-Out Number of instances added per scale-out event. Set based on the service capacity of each instance. Maximum Number of Instances in Group Upper limit for instances in the cluster. No scale-out occurs after this limit is reached. Set based on your resource limit. Parameter Description Network Type Specify the network for your application. This setting cannot be changed after configuration. For VPC-based applications, specify the vSwitch for the new instance. If you specify multiple vSwitches, EDAS allocates them based on the multi-zone scaling policy. Multi-zone Scaling Policy Select Priority Policy or Balanced Distribution Policy.
Verify the result
After you add instances through any of the methods above, go to the application details page and click the Instance Information tab. Verify that the new instances appear with the expected count and status.
Billing
All instances created through launch templates in EDAS use the pay-as-you-go billing method. After an application scales in, the reclaim mode determines how unused instances are handled:
| Reclaim mode | Behavior | Charges after scale-in |
|---|---|---|
| Release Mode | EDAS automatically releases the unused instance. | You pay only for the time the instance was running. |
| Shutdown and Reclaim Mode | EDAS stops the unused instance. The public IP address is recycled and reassigned when the instance restarts. Elastic IP addresses (EIPs) are retained. | CPU and memory charges stop. You are still charged for disks (system disks and data disks), EIPs, and bandwidth. You are charged only a small amount of fees to retain the instance. |
Security best practices
Logon credentials: Use an SSH key pair instead of a password. Key pairs prevent brute-force attacks and do not expose private keys. For more information, see SSH key pairs.
Access control: Use security groups to control network access between ECS instances or between instances and other cloud services. If you configure a security group in a launch template, all instances created from that template inherit the security group rules. For more information, see Security groups.
See also
Add ECS instances to an application that is deployed in an ECS cluster: Three methods to manually scale out applications and balance instance loads.
Perform auto scaling on applications in ECS clusters: Dynamically adjust instance counts with auto scaling to balance application loads.