All Products
Search
Document Center

Serverless App Engine:Manage task templates

Last Updated:Apr 01, 2026

SAE Job lets you run containerized tasks on a schedule or on demand via HTTP/HTTPS requests. Each task runs in a dedicated instance that is automatically released when the task completes.

Use cases

SAE Job is designed for asynchronous, latency-tolerant workloads:

  • Time-driven processing: Send coupons on the hour, update daily earnings, or refresh daily tag counts and crowd data.

  • Batch data processing: Generate monthly statistical reports or run batch text message status updates where real-time performance is not required.

  • Asynchronous decoupling: Refresh activity statuses, run offline queries asynchronously, or decouple task logic from your application.

  • CI/CD pipelines: Release compute resources immediately after a continuous integration (CI) or continuous delivery (CD) task completes.

For a full comparison of SAE Job against other deployment options, see Scenarios.

Prerequisites

Before you begin, ensure that you have:

If you are using a Resource Access Management (RAM) user, the Alibaba Cloud account holder must also:

  1. Activate EventBridge.

  2. Activate SAE Job and create the AliyunServiceRoleForEventBridgeSendToSAE service-linked role as prompted in the console.

  3. Grant the AliyunEventBridgeReadOnlyAccess permission to the RAM user. See Grant permissions to a RAM user.

How it works

  1. Create a task template that defines how a task runs (deployment method, instance type, schedule, and so on).

  2. Trigger tasks either automatically via a cron schedule or on demand via an HTTP/HTTPS request. Each trigger creates a new task from the template.

  3. SAE provisions a new instance to run each task and releases the instance when the task finishes.

Create a task template

  1. On the SAE Task Templates page, select a region and a namespace in the top navigation bar, and then click Create Task Template.

  2. On the Basic Information page, configure the following parameters and click Next.

    • Deploy by Image: Click Set Image and choose an image source: For details, see Deploy an application using an image.

      • Demo Image: A prebuilt sample image.

      • My Alibaba Cloud Images: Images in an Alibaba Cloud Container Registry (ACR) instance under the same account.

      • Private Images from Other Alibaba Cloud Accounts: Images in an ACR instance under a different account.

      • Custom Image: Images not hosted in ACR.

      • Reference Image from Other Task Template: Reuse the image from an existing task template.

    • Deploy by Code Package: Click Set Code Package Deployment. Select a Technology Stack Language and Code Package Type, upload your code package, and specify the runtime environment. See Deploy an application using a code package.

    • Shell Script: Click Configure Shell Script and write your task execution script. Refer to the example script on the page.

    ParameterDescription
    Task Template NameEnter a name for the task template.
    Namespace TypeSelect System-created or Select Existing Namespace.
    Task Deployment MethodSee Deployment methods below.
    Instance TypeSee Instance types below.
    Single Instance SpecificationSpecify the CPU and memory for each instance.
    Concurrent InstancesSpecify the number of instances to run at the same time.
    Instance typePerformancePreemption riskBest for
    DefaultStableNoneHigh real-time performance and stability requirements
    BestEffortMay fluctuate significantlyCan be preempted and evictedNo strict real-time or stability requirements
    BestEffort PreferredPrioritizes BestEffort; falls back to Default if preemptedAuto-fallback prevents task interruptionCost savings with resilience
  3. On the Task Settings page, configure the following parameters and click Next. Task type Additional settings (expand More Settings)

    • Periodic Task: Runs automatically on a cron schedule.

      In the Cron Expression field, enter a cron expression or click Use Generation Tool to build one interactively. The cron expression uses this format:

      # ┌─────────── minute (0–59)
      # │ ┌─────────── hour (0–23)
      # │ │ ┌─────────── day of the month (1–31)
      # │ │ │ ┌─────────── month (1–12)
      # │ │ │ │ ┌─────────── day of the week (0–6, Sunday to Saturday)
      # │ │ │ │ │
      # * * * * *

      Common cron operators:

      OperatorDescriptionExample
      *Any value0 * * * * — runs every hour
      ,List separator0 9,17 * * * — runs at 9 AM and 5 PM
      -Range0 9 * * 1-5 — runs at 9 AM, Monday through Friday
      /Step*/15 * * * * — runs every 15 minutes
    • One-time Task (Triggered by HTTP/HTTPS): Runs when it receives an HTTP or HTTPS request.

      ParameterDescription
      Request TypeSelect the protocol to accept: HTTP, HTTPS, or HTTP&HTTPS.
      Request MethodSelect one or more HTTP methods to accept: GET, POST, PUT, PATCH, DELETE, or HEAD.
      Security ConfigurationControls which requests trigger a task. Options: No Configuration Required (all requests are accepted), Secure Domain Name (requests from a specific domain only), or IP CIDR block (requests from a specific IP address or CIDR range only).
    ParameterDefaultRangeDescription
    Concurrency PolicyAllowControls what happens when a new task is triggered before the previous one finishes. Allow (default): run concurrently; scheduled tasks continuously create new tasks. Forbid: a new task is not created if the previous one has not finished. Replace: stop the previous task and start the new one.
    Timeout3600 s0–604800 sMaximum duration for a task. The system tries to stop the task if it exceeds this limit.
    Retries30–10Number of retry attempts after a task fails.
    Enable Task ShardingOffDistribute a task across multiple clients for parallel execution. Used for big data processing. Toggle the switch and click Edit Task Shard Name to configure shard names.
  4. (Optional) On the Advanced Settings page, configure additional runtime options.

    • Startup Command

      Override the default CMD or ENTRYPOINT defined in the image. See Set a startup command.

    • Runtime Environment and Lifecycle Management

    • Data Persistence

      Store application data in NAS, OSS, or a database to prevent data loss when the instance is released.

      Important

      Note: NAS, OSS, and database services incur additional fees.

    • Logs

      Send logs to SLS for centralized management and analysis.

      Important

      Note: SLS incurs additional fees.

  5. Click Create and wait for the task template to be created.

To view the template, go to the SAE Task Templates page, select a region and a namespace, and click the template name to open its details page.

Run and stop tasks

Run a periodic task

Periodic tasks run automatically based on the cron expression in the task template. No manual action is required.

Trigger a one-time task via HTTP/HTTPS

  1. On the SAE Task Templates page, select a region and a namespace, and click the target task template.

  2. In the Job Settings section, copy the Public Request URL (for requests from the public network) or the Private Request URL.

  3. Send a request to the URL. To pass parameters, use a POST request with a JSON body. Pass environment variables:

    curl -d '{"Envs":[{"name":"aaa","value":"bbb"},{"name":"ccc","value":"ddd"}]}' \
      -H 'Content-Type: application/json' \
      <url>   # Replace <url> with the actual Public or Private Request URL.

    Override the number of concurrent instances:

    curl -d '{"Replicas":"3"}' \
      -H 'Content-Type: application/json' \
      <url>   # Replace <url> with the actual Public or Private Request URL.

    For all supported parameters, see ExecJob.

Manually trigger a task

  1. Go to the task template details page.

  2. Click Manually Execute Task in the upper-right corner.

Stop a task

  1. Go to the task template details page.

  2. Click Stop Task in the upper-right corner and follow the on-screen instructions.

Manage task records

  1. Go to the task template details page.

  2. In the left navigation pane, click Task Records.

On the Task Records page:

  • To view instance-level details, click a task ID to open the Task Record Details page.

  • To delete a task record, click Delete in the Actions column and follow the on-screen instructions.

View task events

  1. Go to the task template details page.

  2. In the left navigation pane, click Event Information.

Use the search box to filter events by Source Name, Event Reason, Source Type, or Event Level.

Edit or delete a task template

  1. Go to the task template details page.

  2. In the upper-right corner, click Edit Task Template or Delete Task Template and follow the on-screen instructions.

Warning

Deleting a task template permanently removes all associated task instances and template configuration. Any SLS resources provisioned for log collection are also released, and log collection is disabled.

Roll back to a previous version

If a template update causes issues, roll back to an earlier version:

  1. Go to the task template details page.

  2. Click Roll Back to Previous Version in the upper-right corner.

  3. On the Roll Back to Previous Version page, select the target version and click OK.