All Products
Search
Document Center

Serverless App Engine:CreateJob

Last Updated:Jan 14, 2026

This operation creates a job template.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

sae:CreateJob

create

*All Resource

*

None None

Request syntax

POST /pop/v1/sam/job/createJob HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

AppName

string

Yes

The name of the job template. The name can contain digits, letters, and hyphens (-). It must start with a letter and cannot exceed 36 characters in length.

test

NamespaceId

string

No

The ID of the SAE namespace. Only namespaces that consist of lowercase letters and hyphens (-) are supported. The name must start with a letter.

cn-beijing:test

AppDescription

string

No

The description of the job template. The description cannot exceed 1024 characters in length.

This is a test description.

VpcId

string

No

The VPC that corresponds to the SAE namespace. In SAE, a namespace can be bound to only one VPC and the binding cannot be changed. When you create a job template in a namespace for the first time, the namespace is bound to the VPC. Multiple namespaces can be bound to the same VPC. If you do not specify this parameter, the VPC ID that is bound to the namespace is used by default.

vpc-bp1aevy8sofi8mh1q****

VSwitchId

string

No

The vSwitch to which the elastic network interface (ENI) of the task instance is connected. The vSwitch must be located in the preceding VPC. The vSwitch is also bound to the SAE namespace. If you do not specify this parameter, the vSwitch ID that is bound to the namespace is used by default.

vsw-bp12mw1f8k3jgygk9****

PackageType

string

Yes

The type of the deployment package. Valid values:

  • For Java deployments, valid values are FatJar, War, and Image.

  • For PHP deployments, valid values are:
    • PhpZip

    • IMAGE_PHP_5_4

    • IMAGE_PHP_5_4_ALPINE

    • IMAGE_PHP_5_5

    • IMAGE_PHP_5_5_ALPINE

    • IMAGE_PHP_5_6

    • IMAGE_PHP_5_6_ALPINE

    • IMAGE_PHP_7_0

    • IMAGE_PHP_7_0_ALPINE

    • IMAGE_PHP_7_1

    • IMAGE_PHP_7_1_ALPINE

    • IMAGE_PHP_7_2

    • IMAGE_PHP_7_2_ALPINE

    • IMAGE_PHP_7_3

    • IMAGE_PHP_7_3_ALPINE

  • For Python deployments, valid values are PythonZip and Image.

FatJar

PackageVersion

string

No

The version number of the deployment package. This parameter is required when Package Type is set to FatJar, War, or PythonZip.

1.0.1

PackageUrl

string

No

The URL of the deployment package. This parameter is required when Package Type is set to FatJar, War, or PythonZip.

http://myoss.oss-cn-hangzhou.aliyuncs.com/my-buc/2019-06-30/****.jar

ImageUrl

string

No

The address of the image. This parameter is required when Package Type is set to Image.

registry.cn-hangzhou.aliyuncs.com/sae_test/ali_sae_test:0.0.1

Jdk

string

No

The version of the JDK on which the deployment package depends. The following versions are supported:

  • Open JDK 8

  • Open JDK 7

  • Dragonwell 11

  • Dragonwell 8

  • openjdk-8u191-jdk-alpine3.9

  • openjdk-7u201-jdk-alpine3.9

This parameter is not supported when Package Type is set to Image.

Open JDK 8

WebContainer

string

No

The version of the Tomcat container on which the deployment package depends. The following versions are supported:

  • apache-tomcat-7.0.91

  • apache-tomcat-8.5.42

This parameter is not supported when Package Type is set to Image.

apache-tomcat-7.0.91

Cpu

integer

No

The amount of CPU required for each instance, in millicores. This parameter cannot be set to 0. The following fixed specifications are supported:

  • 500

  • 1000

  • 2000

  • 4000

  • 8000

  • 16000

  • 32000

1000

Memory

integer

No

The amount of memory required for each instance, in MB. This parameter cannot be set to 0. The CPU and memory specifications have a one-to-one correspondence. The following fixed specifications are supported:

  • 1024: corresponds to 500 millicores and 1,000 millicores of CPU.

  • 2048: corresponds to 500, 1,000, and 2,000 millicores of CPU.

  • 4096: corresponds to 1,000, 2,000, and 4,000 millicores of CPU.

  • 8192: corresponds to 2,000, 4,000, and 8,000 millicores of CPU.

  • 12288: corresponds to 12,000 millicores of CPU.

  • 16384: corresponds to 4,000, 8,000, and 16,000 millicores of CPU.

  • 24576: corresponds to 12,000 millicores of CPU.

  • 32768: corresponds to 16,000 millicores of CPU.

  • 65536: corresponds to 8,000, 16,000, and 32,000 millicores of CPU.

  • 131072: corresponds to 32,000 millicores of CPU.

1024

Replicas

integer

Yes

The number of concurrent instances for the task.

3

Command

string

No

The startup command of the image. The command must be an executable object that exists in the container. Example:

command:
      - echo
      - abc
      - >
      - file0

Based on this example, set Command to "echo" and CommandArgs to ["abc", ">", "file0"].

echo

CommandArgs

string

No

The parameters of the image startup command. These are the parameters for the Command parameter. Format:

["a","b"]

In the preceding example, CommandArgs is ["abc", ">", "file0"]. The value ["abc", ">", "file0"] must be converted to a string that is a JSON array. If this parameter is not used, you do not need to specify it.

["a","b"]

Envs

string

No

The environment variables of the container. You can customize environment variables or reference ConfigMaps. To reference a ConfigMap, you must first create a ConfigMap instance. For more information, see CreateConfigMap. Valid values:

  • Custom configuration
    • name: The name of the environment variable.

    • value: The value of the environment variable.

  • Reference a ConfigMap
    • name: The name of the environment variable. You can reference a single key or all keys. To reference all keys, enter sae-sys-configmap-all-<ConfigMap name>. For example, sae-sys-configmap-all-test1.

    • valueFrom: The reference of the environment variable. Set the value to configMapRef.

    • configMapId: The ID of the ConfigMap.

    • key: The key. If you reference all key-value pairs, you do not need to set this field.

[{"name":"envtmp","value":"0"}]

CustomHostAlias

string

No

The custom mapping between a hostname and an IP address in the container. Valid values:

  • hostName: The domain name or hostname.

  • ip: The IP address.

[{"hostName":"samplehost","ip":"127.0.0.1"}]

JarStartOptions

string

No

The startup options for the JAR package. The default startup command is: $JAVA_HOME/bin/java $JarStartOptions -jar $CATALINA_OPTS "$package_path" $JarStartArgs

custom-option

JarStartArgs

string

No

The startup parameters for the JAR package. The default startup command is: $JAVA_HOME/bin/java $JarStartOptions -jar $CATALINA_OPTS "$package_path" $JarStartArgs

-Xms4G -Xmx4G

EdasContainerVersion

string

No

The version of the High-Speed Service Framework (HSF) runtime environment in which the task runs, such as an Ali-Tomcat container.

3.5.3

Timezone

string

No

The time zone. The default value is Asia/Shanghai.

Asia/Shanghai

SlsConfigs

string

No

The configuration for collecting logs to Simple Log Service (SLS).

  • To use an SLS resource that is automatically created by SAE: [{"logDir":"","logType":"stdout"},{"logDir":"/tmp/a.log"}].

  • To use a custom SLS resource: [{"projectName":"test-sls","logType":"stdout","logDir":"","logstoreName":"sae","logtailName":""},{"projectName":"test","logDir":"/tmp/a.log","logstoreName":"sae","logtailName":""}].

The parameters are described as follows:

  • projectName: The name of the SLS project.

  • logDir: The path of the log file.

  • logType: The type of the log. stdout indicates the standard output log of the container. You can specify only one standard output log. If you do not set this parameter, file logs are collected.

  • logstoreName: The name of the Logstore in SLS.

  • logtailName: The name of the Logtail in SLS. If you do not specify this parameter, a new Logtail is created.

If the SLS collection configuration does not change during multiple deployments, you do not need to set this parameter. In this case, the request does not need to include the SlsConfigs field. If you no longer need to use the SLS collection feature, set the value of this parameter to an empty string ("") in the request.

Note

A project that is automatically created with a job template is deleted when the job template is deleted. Therefore, when you select an existing project, you cannot select a project that is automatically created by SAE.

[{"logDir":"","logType":"stdout"},{"logDir":"/tmp/a.log"}]

NasId

string

No

The ID of the NAS file system. If the configuration does not change during a deployment, you do not need to set this parameter. In this case, the request does not need to include the NasId field. To clear the NAS configuration, set the value of this parameter to an empty string ("") in the request.

10d3b4****

MountHost

string

No

The mount target of the NAS file system in the VPC where the job template is located. If the configuration does not change during a deployment, you do not need to set this parameter. In this case, the request does not need to include the MountHost field. To clear the NAS configuration, set the value of this parameter to an empty string ("") in the request.

10d3b4bc9****.com

MountDesc

string

No

The description of the NAS mount. If the configuration does not change during a deployment, you do not need to set this parameter. In this case, the request does not need to include the MountDesc field. To clear the NAS configuration, set the value of this parameter to an empty string ("") in the request.

[{mountPath: "/tmp", nasPath: "/"}]

PreStop

string

No

The script that is executed before the container is stopped. A script is triggered to run before the container is deleted. Format: {"exec":{"command":["sh","-c","echo hello"]}}

{"exec":{"command":["sh","-c","echo hello"]}}

PostStart

string

No

The script that is executed after the container is started. A script is triggered to run immediately after the container is created. Format: {"exec":{"command":["sh","-c","echo hello"]}}

{"exec":{"command":["sh","-c","echo hello"]}}

WarStartOptions

string

No

The startup command for a WAR package deployment task. The configuration procedure is the same as the procedure for configuring the startup command for an image-based deployment. For more information, see Set a startup command.

CATALINA_OPTS=\"$CATALINA_OPTS $Options\" catalina.sh run

ConfigMapMountDesc

string

No

The description of the ConfigMap mount. Use the ConfigMap that you created on the Namespace Configurations page to inject configuration information into the container. The parameters are described as follows:

  • configMapId: The ID of the ConfigMap instance. You can obtain the ID by calling the ListNamespacedConfigMaps operation.

  • key: The key.

Note

You can pass the sae-sys-configmap-all parameter to mount all keys.

  • mountPath: The mount path.

[{"configMapId":16,"key":"test","mountPath":"/tmp"}]

SecurityGroupId

string

No

The ID of the security group.

sg-wz969ngg2e49q5i4****

AutoConfig

boolean

No

Indicates whether to automatically configure the network environment. Valid values:

  • true: SAE automatically configures the network environment when the job template is created. The values of NamespaceId, VpcId, vSwitchId, and SecurityGroupId are ignored.

  • false: SAE manually configures the network environment when the job template is created.

false

TerminationGracePeriodSeconds

integer

No

The graceful shutdown timeout period. The default value is 30. Unit: seconds. Valid values: 1 to 300.

10

PhpConfigLocation

string

No

The mount path of the startup configuration for the PHP task. The PHP server must use this configuration file to start.

/usr/local/etc/php/php.ini

PhpConfig

string

No

The content of the PHP configuration file.

k1=v1

TomcatConfig

string

No

The configuration of the Tomcat file. Set this parameter to "" or "{}" to delete the configuration. The parameters are described as follows:

  • port: The port number. The valid range is 1024 to 65535. Ports smaller than 1024 require root permissions. Because the container is configured with administrator permissions, specify a port number greater than 1024. If you do not configure this parameter, the default port 8080 is used.

  • contextPath: The access path. The default value is the root directory (/).

  • maxThreads: The maximum number of connections in the connection pool. The default value is 400.

  • uriEncoding: The encoding format for Tomcat. Valid values include UTF-8, ISO-8859-1, GBK, and GB2312. If you do not set this parameter, the default value ISO-8859-1 is used.

  • useBodyEncoding: Indicates whether to use BodyEncoding for URL. The default value is true.

{"port":8080,"contextPath":"/","maxThreads":400,"uriEncoding":"ISO-8859-1","useBodyEncodingForUri":true}

OssMountDescs

string

No

The description of the Object Storage Service (OSS) mount. The parameters are described as follows:

  • bucketName: The name of the bucket.

  • bucketPath: The directory or OSS object that you created in OSS. An exception is triggered if the mount directory does not exist in OSS.

  • mountPath: The path of your container in SAE. If the path already exists, it is overwritten. If the path does not exist, it is created.

  • readOnly: Indicates whether the container has read-only permissions on the resources in the mount directory. Valid values:
    • true: read-only permission.

    • false: read and write permission.

[{"bucketName": "oss-bucket", "bucketPath": "data/user.data", "mountPath": "/usr/data/user.data", "readOnly": true}]

OssAkId

string

No

The AccessKey ID for reading from and writing to OSS.

xxxxxx

OssAkSecret

string

No

The AccessKey secret for reading from and writing to OSS.

xxxxxx

AcrInstanceId

string

No

The ID of the Container Registry Enterprise Edition instance. This parameter is required when ImageUrl is the address of an image in a Container Registry Enterprise Edition instance.

cri-xxxxxx

AcrAssumeRoleArn

string

No

The Alibaba Cloud Resource Name (ARN) of the RAM role that is required to pull images across accounts. For more information, see Grant permissions to pull images across Alibaba Cloud accounts using a RAM role.

acs:ram::123456789012****:role/adminrole

ImagePullSecrets

string

No

The ID of the secret.

10

EnableImageAccl

boolean

No

Indicates whether to enable image acceleration. Valid values:

  • true: enable.

  • false: disable.

false

Workload

string

Yes

The workload. Set the value to job.

job

TriggerConfig

string

No

The configuration of the task trigger. The settings vary depending on the task type.

  • Scheduled task: Set the type field to 'time', the config field to a Cron expression, and the timezone field to a specific time zone. Example: {"type":"time","config":"0 1 */1 * ?","timezone":"GMT+8:00"}

  • Manually triggered task: Set the type field to 'http' and specify the HTTP trigger rules in the config field. For more information, see SourceHttpEventParameters. Example: {"type":"http","config":{"type":"HTTPS","method":["GET"],"ip":[],"referer":[],"securityConfig":"none"}}

{"type":"time","config":"0 1 */1 * ?","timezone":"GMT+8:00"}

ConcurrencyPolicy

string

No

The concurrency policy of the task. Valid values:

  • Forbid: Prohibits concurrent running. A new task is not created if the previous task is not complete.

  • Allow: Allows concurrent running.

  • Replace: When the time for creating a new task is reached but the previous task is not complete, the new task replaces the previous task.

Allow

Timeout

integer

No

The timeout period of the task. Unit: seconds.

3600

BackoffLimit

integer

No

The number of retries for the task.

3

Slice

boolean

No

Enables task sharding.

true

SliceEnvs

string

No

The parameters for task sharding.

[0,1,2]

RefAppId

string

No

The ID of the referenced task.

7171a6ca-d1cd-4928-8642-7d5cfe69****

ProgrammingLanguage

string

No

The programming language of the program. Supported languages are java, php, python, and shell.

java

Python

string

No

The Python environment. PYTHON 3.9.15 is supported.

PYTHON 3.9.15

PythonModules

string

No

The dependencies of a custom installation module. By default, the dependencies defined in the requirements.txt file in the root directory are installed. If no package is configured or a custom package is used, you can specify the dependencies to be installed.

Flask==2.0

NasConfigs

string

No

BestEffortType

string

No

Response elements

Element

Type

Description

Example

object

The information about the created job template.

RequestId

string

The request ID.

01CF26C7-00A3-4AA6-BA76-7E95F2A3***

Message

string

The additional information. Valid values:

  • If the request is normal, success is returned.

  • If the request is abnormal, a specific error code is returned.

success

TraceId

string

The trace ID that is used to query the details of the call.

ac1a0b2215622246421415014e****

Data

object

The returned results.

ChangeOrderId

string

The ID of the returned change order. You can use this ID to query the task execution status.

01db03d3-3ee9-48b3-b3d0-dfce2d88****

AppId

string

The ID of the job template.

7171a6ca-d1cd-4928-8642-7d5cfe69****

ErrorCode

string

The error code. Valid values:

  • If the request is successful, the ErrorCode field is not returned.

  • If the request fails, the ErrorCode field is returned. For more information, see the Error codes section in this topic.

Code

string

The status of the interface or a POP error code. Valid values:

  • 2xx: The request was successful.

  • 3xx: The request was redirected.

  • 4xx: A request error occurred.

  • 5xx: A server error occurred.

200

Success

boolean

Indicates whether the job template was created. Valid values:

  • true: The job template was created.

  • false: The job template failed to be created.

true

Examples

Success response

JSON format

{
  "RequestId": "01CF26C7-00A3-4AA6-BA76-7E95F2A3***",
  "Message": "success",
  "TraceId": "ac1a0b2215622246421415014e****",
  "Data": {
    "ChangeOrderId": "01db03d3-3ee9-48b3-b3d0-dfce2d88****",
    "AppId": "7171a6ca-d1cd-4928-8642-7d5cfe69****"
  },
  "ErrorCode": "空",
  "Code": "200",
  "Success": true
}

Error codes

HTTP status code

Error code

Error message

Description

400 Application.MissingJdk Your application must at least contain a JDK component.
400 InvalidPackageType.NotFound The package type must be War, FatJar, or Image.
400 InvalidParameter.FileName The application deployment package name is invalid. This name can contain only alphanumeric characters, hyphens (-), and underscores (_). In addition, you can upload JAR files only if the selected deployment version supports JAR file. Otherwise, upload WAR files only.
400 InvalidParameter.NotEmpty You must specify the parameter %s.
400 InvalidParameter.Obviously The specified parameter is invalid {%s}.
400 JarApplication.MissingJdk A FatJar application must contain JDK.
400 NoAvailableCluster.NotFound No clusters are available for the current region.
400 NoComputeResourceQuota.Exceed Your compute resource is insufficient. Please contact us to raise the quota.
400 PandoraApplication.MissingJdk The Pandora application is missing a JDK component.
400 PandoraApplication.OnlyJdk A Pandora application only requires JDK component.
400 InvalidParameter.WithMessage The parameter is invalid {%s}: %s
400 InvalidComponent.NotFound The current component (such as JDK, Tomcat, or EDASWebContainer) does not exist.
400 InvalidHostnameIp.Invalid The hostname and/or IP is invalid: Hostname [%s], IP [%s].
400 InvalidInstanceSpecification.Unsupported The instance specification is not supported: CPU [%s], memory [%s].
400 InvalidServerlessRegion.Unsupported The current region is not supported: %s
400 WarApplication.MissingJdkWebcontainer A War application must contain JDK and Tomcat.
400 InvalidNamespace.WithUppercase This namespace does not support creating SAE apps because it contains uppercase letters.
400 LogService.ConfigQuotaExceed The maximum number of Log Service configs is exceeded. The maximum number of Log Service configs is exceeded, please join the DingTalk group 32874633 for technical support.
400 LogService.InternalError An exception occurred while calling Log Service. Please submit a ticket to solve the problem. An exception occurred while calling log service. please join the DingTalk group 32874633 for technical support.
400 LogService.LogDirInvalid The log collection path is invalid. The log collection path is invalid.
400 LogService.NotAvailable Log Service is unavailable. Please activate Log Service first. The log service is not available. Please open the log service first.
400 LogService.ProjectNumQuotaExceed The maximum number of Log Service projects is exceeded. The maximum number of Log Service projects is exceeded, please join the DingTalk group 32874633 for technical support.
400 vswitch.not.exist The specified VSwitch does not exist.
400 user.indebt The user has an outstanding payment.
400 NoComputeResourceQuota.App.Exceed You can create %s instances for each application. Please submit a ticket to raise the quota. You can create %s instances for each application. please join the DingTalk group 32874633 for technical support.
400 NoComputeResourceQuota.User.Exceed Your account is limited to create %s instances. Please submit a ticket to raise the quota. Your account is limited to create %s instances. please join the DingTalk group 32874633 for technical support.
400 System.Upgrading The system is being upgraded. Please try again later.
400 VolumnPath.Conflict Conflict between log collection directory and persistent storage directory. Conflict between log collection directory and persistent storage directory.
400 MountConflict.ConfigMap Conflict detected for ConfigMap path %s.
400 NotFound.ConfigMap The ConfigMap object (ID: %s) does not exist.
400 NotFound.ConfigMapKey The key %s of ConfigMap object (ID: %s) does not exist.
400 Sls.Config.Mixed.Multi.Project The specified Config contains multiple projects.
400 Sls.Config.User.Defined.Missing.Logstore.Info The specified Config is invalid. Both Project and Logstore must be specified.
400 Sls.Config.User.Defined.Missing.Project.Info The specified Config is invalid. Both Project and Logstore must be specified.
400 Sls.Logstore.Name.Invalid The specified name of Logstore is invalid. The Logstore name must not contain the prefix "sae-".
400 Sls.Logstore.User.Defined.Not.Exist The user defined Logstore does not exist.
400 Sls.Project.Name.Invalid The specified project name is invalid. The project name must not contain the prefix "sae-".
400 Sls.Project.User.Defined.Not.Exist The user defined project does not exist.
400 InvalidImageUrl.AcrInstanceId.Domain.NotMatch The specified domain of ImageUrl does not match AcrInstanceId domains.
400 PhpApplication.MissingPhpRuntime A PHP application must contain PHP Runtime.
404 Associate.Eip.Not.Enough No sufficient EIPs are available.
404 InvalidNamespaceId.NotFound The specified NamespaceId does not exist.
404 InvalidVpcId.NotFound The specified VpcId does not exist.
404 InvalidAcrInstanceId.NotFound The specified AcrInstanceId does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.