All Products
Search
Document Center

Enterprise Distributed Application Service:Terminate an application update in an ECS cluster by calling an API operation

Last Updated:Mar 11, 2026

When a deployment in an Elastic Compute Service (ECS) cluster encounters issues mid-rollout, you can stop the update immediately by calling the AbortChangeOrder operation through the Enterprise Distributed Application Service (EDAS) SDK for Java. This prevents remaining instances from being updated with a problematic version.

Note

AbortChangeOrder stops the update but does not roll back instances already updated. If the new version has issues, roll back the application separately. See Roll back an application deployed in an ECS cluster to a historical version.

Prerequisites

Before you begin, make sure that you have:

  • EDAS SDK for Java installed. See "Use EDAS SDK for Java to call EDAS API"

  • An application with an active update started through one of the following methods:

  • The region ID of the application. This example uses cn-hangzhou

  • (Optional) The change order ID. If you did not record the ID when starting the update, call ListRecentChangeOrder to retrieve the ChangeOrderId value. This example uses 47e2b863-adc8-4a0e-ac23-8361b95a****

Terminate the update

Call AbortChangeOrder with the ChangeOrderId parameter set to the change order ID of the active update.

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.edas.model.v20170801.AbortChangeOrderRequest;
import com.aliyuncs.edas.model.v20170801.AbortChangeOrderResponse;

public class AbortChangeOrder {

    public static void main(String[] args) {
        // Retrieve credentials from environment variables.
        // Use a RAM user instead of an Alibaba Cloud account for least-privilege access.
        // To prevent credential leaks, do not hardcode your AccessKey ID or AccessKey secret in the code.
        String aliyun_user_ak = System.getenv("ACCESS_KEY_ID");
        String aliyun_user_sk = System.getenv("ACCESS_KEY_SECRET");

        // Specify the region ID where the application is deployed.
        String region_id = "cn-hangzhou";

        DefaultProfile defaultProfile = DefaultProfile.getProfile(region_id, aliyun_user_ak, aliyun_user_sk);
        DefaultAcsClient client = new DefaultAcsClient(defaultProfile);

        // Create the request and set the change order ID.
        AbortChangeOrderRequest request = new AbortChangeOrderRequest();
        request.setChangeOrderId("47e2b863-adc8-4a0e-ac23-8361b95a****");

        try {
            AbortChangeOrderResponse response = client.getAcsResponse(request);
            System.out.println("Message=" + response.getMessage() + "\nRequestId=" + response.getRequestId());
        } catch (ServerException e) {
            e.printStackTrace();
        } catch (ClientException e) {
            e.printStackTrace();
        }
    }
}

Replace the following placeholders with your actual values:

PlaceholderDescription
ACCESS_KEY_IDAccessKey ID of your Resource Access Management (RAM) user, stored as an environment variable
ACCESS_KEY_SECRETAccessKey secret of your RAM user, stored as an environment variable
cn-hangzhouRegion ID where the application is deployed
47e2b863-adc8-4a0e-ac23-8361b95a****Change order ID of the active update

Sample response:

Message=success
RequestId=19C54DC3-C66C-40D0-AEED-8D5A1F00F3BA

Verify the result

After terminating the update, call GetChangeOrderInfo with the same change order ID to confirm the status.

In the response, check changeOrderInfo.Status. A value of 6 confirms that the update was stopped. See the following table for all possible values.

Sample response:

{
  "Message": "success",
  "RequestId": "CCC48EB3-E628-45B4-8DF3-ED8551119742",
  "Code": 200,
  "changeOrderInfo": {
    "Status": 6,
    "Desc": "create by edas pop api",
    "PipelineInfoList": {
      "PipelineInfo": [
        ...
      ]
    }
  }
}

Change order status values

StatusDescription
0Ready to start
1In progress
2Completed
3Failed
6Stopped (update was terminated)
8Waiting for manual trigger in a manual phased release
9Waiting for automatic trigger in an automatic phased release
10Failed due to a system exception

What to do next