All Products
Search
Document Center

Enterprise Distributed Application Service:Deploy an application to an ECS cluster in single-release mode

Last Updated:Mar 10, 2026

When you need to deploy a JAR, WAR, or image file to all instances in an Elastic Compute Service (ECS) cluster at once, use single-release mode. This topic shows how to call the DeployApplication API operation through the Enterprise Distributed Application Service (EDAS) SDK for Java and verify the deployment result.

Prerequisites

Before you begin, make sure that you have:

  • A region ID for the target application (the examples in this topic use cn-hangzhou)

  • A microservice namespace. To create one, see Create a namespace. To query an existing namespace, call the ListUserDefineRegion operation

  • An application in the ECS cluster. To create one, see Create an application in an ECS cluster by calling an API operation. To query an existing application, call the ListApplication operation. Example application ID: 6bbc57a2-a017-4bec-b521-49a15bd3****

  • A deployment package (JAR or WAR file) uploaded to a URL. The examples in this topic use an Object Storage Service (OSS) bucket. Example URL: https:doc***.oss-cn-hangzhou.aliyuncs.com/sc-****-D-0.0.1-SNAPSHOT.jar

  • (HSF applications only) The EDAS Container version for your High-speed Service Framework (HSF) application. Call the ListBuildPack operation to get the ConfigId value. Example: 57

Deploy the application

The following Java code deploys an application in single-release mode to an ECS cluster. All examples call the DeployApplication API operation with Batch set to 1 for single-release deployment.

For a full list of parameters, see DeployApplication.

Note

For Spring Cloud or Dubbo applications, run the code as-is. For HSF applications, add the BuildPackId parameter:

// EDAS Container build package number for HSF applications.
// Call ListBuildPack to get ConfigId.
request.setBuildPackId(57);
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.DeployApplicationRequest;
import com.aliyuncs.edas.model.v20170801.DeployApplicationResponse;

public class DeployApplication {

    public static void main(String[] args)  {
        // The AccessKey pair of an Alibaba Cloud account has permissions on all API operations.
        // Using these credentials to perform operations in EDAS is a high-risk operation.
        // We recommend that you use a RAM user to call API operations or perform routine O&M.
        // To create a RAM user, log on to the RAM console.
        // Get AccessKey credentials from environment variables.
        String aliyun_user_ak = System.getenv("ACCESS_KEY_ID");
        String aliyun_user_sk = System.getenv("ACCESS_KEY_SECRET");

        // Region 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);

        DeployApplicationRequest request = new DeployApplicationRequest();

        // Application ID
        request.setAppId("6bbc57a2-a017-4bec-b521-49a15bd3****");

        // Deployment description
        request.setDesc("create by edas pop api");

        // Deployment type: use a URL to the package
        request.setDeployType("url");

        // URL of the JAR or WAR file (stored in OSS)
        request.setWarUrl("https:doc***.oss-cn-hangzhou.aliyuncs.com/sc-****-D-0.0.1-SNAPSHOT.jar");

        // Package version (max 64 characters, timestamp recommended)
        request.setPackageVersion("1619094147");

        // Deploy group ID. Set to "all" to deploy to all groups.
        // Call the ListDeployGroup operation to get the ID of a specific group.
        request.setGroupId("all");

        // Number of release phases. Set to 1 for single-release.
        request.setBatch(1);

        // Release type: 0 = automatic, 1 = manual
        request.setReleaseType((long) 0);

        // Application component ID (Spring Cloud/Dubbo only):
        //   4 = Apache Tomcat 7.0.91
        //   7 = Apache Tomcat 8.5.42
        //   5 = OpenJDK 1.8.x
        //   6 = OpenJDK 1.7.x
        request.setComponentIds("5");

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

Replace the following placeholders with your values:

PlaceholderDescriptionHow to get
ACCESS_KEY_IDAccessKey ID (environment variable)Your Alibaba Cloud console
ACCESS_KEY_SECRETAccessKey secret (environment variable)Your Alibaba Cloud console
6bbc57a2-a017-4bec-b521-49a15bd3****Application IDCall ListApplication
https:doc***.oss-cn-hangzhou.aliyuncs.com/sc-****-D-0.0.1-SNAPSHOT.jarURL of the deployment package in OSSYour OSS bucket URL

Expected response

Message=success
ChangeOrderId=f32db5e3-a105-412c-9168-6f7c5295****

A successful response returns Message=success and a ChangeOrderId that tracks the deployment progress.

Verify the deployment

After the deployment starts, call the GetChangeOrderInfo API operation to check the status. For the full parameter reference, see GetChangeOrderInfo.

Example response:

{
  "Message": "success",
  "RequestId": "9C487FE4-F188-45EC-87A5-8BD3D655568F",
  "Code": 200,
  "changeOrderInfo": {
    "Status": 2,
    "Desc": "create by edas pop api",
    "PipelineInfoList": {
      ...
    }
  }
}

Check the changeOrderInfo.Status field to determine the deployment result:

Status valueDescription
0Ready
1In progress
2Successful
3Failed
6Terminated
8Waiting for manual confirmation (manual phased-release)
9Waiting for automatic confirmation (automatic phased-release)
10Failed due to a system exception

A Status value of 2 confirms that the single-release deployment completed successfully.

Related API operations