You can configure deployment sets to control the distribution of ECS instances, mitigating single points of failure on physical servers or meeting the ultra-low latency demands of applications like high-frequency trading. Choose a high availability strategy to spread instances for better fault tolerance, or a low latency strategy to co-locate them for faster network communication.
Limitations
-
You cannot create dedicated hosts in a deployment set.
-
Region and zone restrictions: An instance and its deployment set must be in the same region. For a deployment set with the low latency strategy, all instances must be in the same zone.
-
Instance family restrictions: Most instance families of generation 6 or later support deployment sets that use the high availability, high availability group, and low latency strategies.
Quick start
Step 1: Create a deployment set
Console
In the upper-left corner of the page, select a region and resource group.
-
On the Deployment Set page, click Create Deployment Set.
-
In the Create Deployment Set dialog box, enter a Name and Description, and select a Strategy. If you select the high availability strategy, you can also set the deployment type (physical server, rack, or switch) and affinity (1-10). How do I choose a deployment strategy?
API
Call the CreateDeploymentSet operation to create a deployment set in a specified region and set its deployment strategy.
-
For the high availability group strategy, specify the
GroupCountparameter to set the number of groups. -
For the high availability strategy, specify the
Typeparameter to set the deployment type (host,rack, orsw). The default value ishost. -
For the high availability strategy, specify the
Affinityparameter to set the affinity level (1-10). The default value is 1.
Step 2: Create or add instances
Console
The instance type, region, and number of ECS instances must comply with the limitations. For more information, see Limitations.
-
Create a new instance in a deployment set:
On the deployment set list page, find the target deployment set. In the Actions column, click Create Instance. On the Custom Launch page, complete the instance configuration.
-
Add an existing instance to a deployment set: See Change instance deployment set.
API
-
Create a new instance in a deployment set: Call the RunInstances operation and specify the
DeploymentSetIdparameter. -
Add an existing instance to a deployment set: Call the ModifyInstanceDeployment operation and specify the
InstanceIdandDeploymentSetIdparameters.NoteIf the specified deployment set uses the
AvailabilityGroupstrategy (high availability group strategy), you can use theDeploymentSetGroupNoparameter to specify the group number for the instance within the deployment set.
Deployment strategies
A deployment strategy determines how ECS instances are placed on physical servers. You can choose a strategy based on your requirements for high availability, network latency, and deployment scale.
|
Scenario |
Recommended strategy |
Key limitations |
|
Small-scale clusters that require strict fault isolation |
High availability strategy |
Up to 20 instances per zone |
|
Large-scale deployments with group-based isolation |
High availability group strategy |
Up to 7 groups, with up to 20 instances per group in each zone |
|
Low network latency |
Low latency strategy |
All instances must be in the same zone. The maximum number of instances is 20. |
High availability strategy
Spreads instances across different physical servers, racks, or switches to prevent multiple instances from becoming unavailable due to a single point of failure.
The finer the granularity of distribution, such as at the switch level, the stronger the fault tolerance, but the higher the potential for creation failures. If the current zone lacks enough separate physical servers, racks, or switches to meet the spread requirement, instance creation fails. If this occurs, wait and retry, or choose a different zone.
-
Use cases: Small-scale deployments that require high service continuity and isolation, such as Hadoop distributed computing clusters and SQL database clusters.
-
Zones: Instances can be deployed across different zones.
-
Instance limit: The maximum number of instances in a single zone depends on the deployment type and affinity settings.
Deployment type
The deployment type specifies the dimension for spreading ECS instances within the deployment set. Valid values are described in the following table.
|
Value |
Spread dimension |
Description |
|
|
Physical server |
Instances are spread across different physical servers to prevent a single server failure from affecting multiple instances. |
|
|
Rack |
Instances are spread across different racks to mitigate the risk of mass instance unavailability due to rack power failures. |
|
|
Switch |
Instances are spread across different switches to mitigate the risk of network interruptions due to switch failures. |
Affinity
Affinity defines the maximum number of instances allowed per physical server. The value can be an integer from 1 to 10. The default value is 1.
-
An affinity of 1 enforces strict spreading, which means that each physical server can host a maximum of one instance.
-
An affinity greater than 1 provides best-effort spreading, which is suitable for scenarios with a large number of instances that still require a degree of fault isolation.
The following examples illustrate how affinity affects instance distribution for the host deployment type:
Scenario 1: Create instances based on a deployment set
You create a deployment set of the host type with an affinity of 2, and then create three ECS instances within this set. The system distributes the instances across different physical servers based on the affinity constraint, with each physical server hosting a maximum of 2 instances.
Scenario 2: Increase the affinity of a deployment set
Increasing the affinity of an existing deployment set from 1 to 2 allows a single physical server to host more instances, which provides space for future scaling. Existing instances are not migrated.
Instance limits
The deployment type and affinity determine the instance limit of a deployment set.
|
Deployment type |
Affinity |
Limit per zone |
|
|
1-10 |
20 instances |
|
|
1-10 |
20 instances |
|
|
1-10 |
20 instances |
High availability group strategy
Assigns instances to multiple groups (up to 7). Instances in different groups are strictly spread across different physical servers, while instances within the same group can be co-located.
ECS instances in different groups are strictly placed on separate physical servers within the specified region to avoid single points of failure. Instances within the same group are not guaranteed to be spread out and may be placed on the same physical server to reduce network latency between them.
You can call the DescribeInstances operation to query the group number (DeploymentSetGroupNo) of an instance in a deployment set. Distributed applications, such as HDFS and Cassandra, can use this group number to make intelligent replica placement decisions, ensuring that different replicas are placed in different groups. This maintains data availability even if a group-level failure occurs.
-
Use cases: Large-scale deployments that require high isolation, especially for services with built-in high-availability mechanisms such as Redis primary-replica replication or Nginx load balancing.
-
Zones: Instances can be deployed across different zones.
-
Instance limit: Up to 20 instances per group in a single zone, with a maximum of 7 groups per zone.
Low latency strategy
Co-locates instances within the same network topology to minimize network communication latency between them.
This strategy trades high availability for low latency. Multiple instances may be placed on the same physical server. Ensure your application has its own built-in high availability mechanism, such as multi-copy replication or primary-secondary failover.
-
Use cases: Applications that are highly sensitive to network latency, such as high-performance computing (HPC), real-time data analytics, and AI inference.
-
Zone: All instances must be deployed in the same zone.
-
Instance limit: The maximum number of instances is 20.
-
Insufficient capacity: If sufficient resources are not available within the same network topology, instance creation fails. We recommend that you wait and retry, or contact support to confirm resource availability.
Other operations
Change instance deployment set
You can change the deployment set of an ECS instance to move it to another set or add an unassigned instance to a set.
Console
Go to ECS console - Instances.
In the upper-left corner of the page, select a region and resource group.
-
Click the ID of the target instance to go to the instance details page. Click All Operations to expand all operations, and then search for and click .
-
In the Change Deployment Set dialog box, select the target deployment set and configure the Force Change setting.
-
Yes: Allows changing the instance's physical server. This operation might restart the instance and affect service continuity. Use this option with caution.
-
No: Does not change the instance's physical server. This option attempts to add the instance to the specified deployment set. This avoids the risk of a restart, but the change fails if the instance does not meet the requirements of the new deployment set.
-
API
Call the ModifyInstanceDeployment operation and specify the following parameters to change the deployment set of an instance:
-
RegionId: The region where the instance resides. For example,
cn-hangzhoufor China (Hangzhou). -
InstanceId: The ID of the instance. For example,
i-bp67acfmxazb4ph***. -
DeploymentSetId: The ID of the target deployment set. For example,
ds-bp67acfmxazb4ph****. -
Force: Specifies whether to force a change of the physical server when you change the deployment set. Valid values:
-
true: Allows changing the instance's physical server. This action might restart the instance and affect service continuity. Use this option with caution.
-
false (default): Does not change the instance's physical server. This option attempts to add the instance to the specified deployment set. This avoids the risk of a restart, but the change fails if the instance does not meet the requirements of the new deployment set.
-
Remove instance from a deployment set
To keep instances when deleting a deployment set, you must first remove them. The instances retain their original state after removal.
The target instance must be in the Running or Stopped state. For more information, see Start an instance and Stop an instance.
-
Call the ModifyInstanceDeployment operation and specify the following parameters to remove an instance from a deployment set:
-
RegionId: The region where the instance resides. For example,
cn-hangzhoufor China (Hangzhou). -
InstanceId: The ID of the instance. For example,
i-bp67acfmxazb4ph***. -
DeploymentSetId: The ID of the deployment set. For example,
ds-bp67acfmxazb4ph****. -
RemoveFromDeploymentSet: Specifies whether to remove the selected instance from the deployment set. Set the value to
true.
-
-
Verify that the instance is removed: If the API call is successful and returns a status code of 200, the removal is successful.
Modify or delete a deployment set
Go to the ECS console - Deployment Sets page, find the target deployment set, and then click Modify Information or Delete in the Actions column. Follow the on-screen instructions to complete the operation.
-
Modify a deployment set: You can change the name and description of the deployment set.
-
Delete a deployment set: If a deployment set is no longer needed, you can delete it to prevent it from occupying resources.
ImportantBefore you delete a deployment set, ensure that it contains no instances. If instances exist, you must remove them from the deployment set before you can delete it. For more information, see Change instance deployment set or Remove instance from a deployment set.
Limitations
During periods of high demand in a region, creating ECS instances or restarting pay-as-you-go ECS instances in Economical Mode may fail. In most cases, you can resolve this by retrying after a short wait. For more information, see Economical Mode.
-
Deployment set quota: Each Alibaba Cloud account has a limit on the number of deployment sets that it can own. You can view your quota in Quota Center.
-
Deployment type (Type) cannot be changed: After a deployment set is created, its deployment type cannot be modified. To change the deployment type, you must create a new deployment set and migrate the instances.
-
Rules for changing affinity:
-
Increase affinity: You can modify this setting directly without any restrictions. When the deployment type is
host, increasing the affinity may also increase the maximum number of instances. -
To decrease affinity: You must first remove all instances from the deployment set before you modify the affinity.
-
-
Deployment sets cannot be merged.
Billing
The deployment set feature is free of charge. You are billed only for the resources you use, such as ECS instances, disks, snapshots, images, and public bandwidth. For more information, see Billing overview.