All Products
Search
Document Center

CloudOps Orchestration Service:OSS deployment

Last Updated:Jun 22, 2026

OSS deployments download application source files from Object Storage Service (OSS) to your ECS instances and run shell scripts to start or stop the application.

How it works

Important
  • If you deploy to an Auto Scaling (ESS) group, scaling activities are paused during deployment and resume automatically when the deployment finishes, regardless of the result.

  • Each deployment follows a stop-then-start sequence: the stop script runs first, then the start script.

  1. Create and publish a deployment.

    Specify the application's source file location in OSS, along with the start and stop scripts.

    Create a release task, select a release mode, and publish the deployment to the target application group.

  2. Automated deployment flow.

    1. Retrieves the deployment configuration, including the OSS file location and the start and stop scripts.

    2. Downloads the OSS file to the working directory on each instance.

    3. Runs the stop script to stop the previous version of the application.

    4. Runs the start script to launch the new version of the application.

Usage notes

  • Deployments are supported only on Linux instances.

  • The start and stop scripts must be shell scripts.

Procedure

  1. Create an application and import your Elastic Compute Service (ECS) instances.

    1. If you do not have an ECS instance, go to the ECS console - Custom Launch page to create a Linux ECS instance.

      The following example scripts are for these images. If you use a different image, you must modify the scripts accordingly.
    2. Go to the ECS console - Application management page and click Create from Existing Resources to create an application and an application group, and import the ECS instance into the application group.

  2. Create an OSS deployment.

    1. Download the official sample JAR package and upload it to OSS.

    2. Go to the ECS console - Application management page. On the My Applications tab, click the name of your target application.

    3. On the application details page, select the Deployment tab, and then click Create Deployment.

    4. On the Create Deployment page, set Deployment Type to OSS File. Configure the parameters, and then click OK.

      • OSS file information: Specify the OSS bucket and the file path of the JAR package.

        If the ECS instance and the OSS bucket are in the same region, you can select internal network download to increase the download speed.
      • Working directory: Set the execution directory for the start and stop scripts. The OSS file is automatically downloaded to this directory. Example: /root/deploy.

      • Application start script:

        Alibaba Cloud Linux

        start_application() {
          set -e
          yum install -y maven-3.5.4
          java -jar ./sample-spring-1.0-SNAPSHOT.jar &
        }
        
        start_application

        Ubuntu

        start_application() {
          set -e
          apt update
          apt install -y maven
          java -jar ./sample-spring-1.0-SNAPSHOT.jar &
        }
        
        start_application
      • Application stop script:

        ### Stop the application (if any)
        stop_application() {
          PID=$(ps -ef | grep "sample-spring-1.0-SNAPSHOT.jar" | grep -v "grep" | awk '{print $2}')
          if [ -n "$PID" ]; then
            kill -9 $PID
          fi
        }
        
        stop_application
  3. Go back to the deployment list, find the deployment that you created, and click Deploy. Select the target group and click OK to start the deployment.

  4. Verify the result.

    1. Navigate to the details page of the target instance. Click Connect and select Workbench. Follow the on-screen prompts to access the terminal.

    2. Run the curl http://localhost:8080/hello command. A response of Alibaba Spring Sample! indicates a successful deployment.

Key parameters

Parameter

Description

OSS region

The region of the source OSS bucket.

OSS bucket

The OSS bucket that contains the source file.

OSS file

The source file in the OSS bucket.

OSS file version

The version ID of the file. Required only when versioning is enabled for the bucket. Leave this field empty if versioning is disabled.

Internal network download

Select this option when the ECS instance and the OSS bucket are in the same region.

Working directory

The directory where the source file is downloaded and the start and stop scripts are run.

  • Must be an absolute path.

  • The source file is downloaded here, and scripts can access it directly.

  • If the directory does not exist, it is created automatically during deployment.

Application start script

The shell script used to start the application.

Application stop script

The shell script to stop the application.
The script must correctly stop both the current and previous application versions and exit gracefully if the application is not running.



For example, the following script stops a container named my-container. It assumes all container versions share the same name and does not report an error if the container does not exist:

container_name="my-container"
container_id=$(docker ps -aq -f name=${container_name}) 
if [ -n "$container_id" ]; then
  docker rm -f $container_id
fi