All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::SAE::Application

Last Updated:Nov 20, 2024

ALIYUN::SAE::Application is used to create an application in Serverless App Engine (SAE).

Syntax

{
  "Type": "ALIYUN::SAE::Application",
  "Properties": {
    "Timezone": String,
    "AppDescription": String,
    "MountDesc": String,
    "NasId": String,
    "WarStartOptions": String,
    "Liveness": String,
    "Memory": Integer,
    "WebContainer": String,
    "SlsConfigs": String,
    "Cpu": Integer,
    "Deploy": Boolean,
    "PackageVersion": String,
    "AppName": String,
    "Jdk": String,
    "JarStartArgs": String,
    "PreStop": String,
    "Readiness": String,
    "PackageType": String,
    "CommandArgs": String,
    "Envs": String,
    "VSwitchId": String,
    "ImageUrl": String,
    "PostStart": String,
    "JarStartOptions": String,
    "MountHost": String,
    "Replicas": Integer,
    "CustomHostAlias": String,
    "VpcId": String,
    "Tags": List,
    "SecurityGroupId": String,
    "Command": String,
    "EdasContainerVersion": String,
    "PackageUrl": String,
    "NamespaceId": String,
    "AssociateEip": Boolean,
    "AcrInstanceId": String,
    "OssAkId": String,
    "ProgrammingLanguage": String,
    "OssAkSecret": String,
    "Python": String,
    "BaseAppId": String,
    "EnableEbpf": String,
    "PhpArmsConfigLocation": String,
    "PhpConfig": String,
    "MicroRegistrationConfig": String,
    "TerminationGracePeriodSeconds": Integer,
    "ConfigMapMountDesc": String,
    "PvtzDiscoverySvc": String,
    "AcrAssumeRoleArn": String,
    "TomcatConfig": String,
    "AppSource": String,
    "PythonModules": String,
    "NasConfigs": String,
    "MicroRegistration": String,
    "ServiceTags": String,
    "ImagePullSecrets": String,
    "AutoConfig": Boolean,
    "KafkaConfigs": String,
    "Php": String,
    "OssMountDescs": List,
    "PhpConfigLocation": String,
    "SaeVersion": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

Timezone

String

No

Yes

The time zone.

Default value: Asia/Shanghai.

AppDescription

String

No

No

The description of the application.

The description can be up to 1,024 characters in length.

MountDesc

String

No

Yes

The description of the File Storage NAS (NAS) file system that you want to mount to the application.

None.

NasId

String

No

Yes

The ID of the NAS file system that you want to mount to the application.

The NAS file system must have an available mount target, or have a mount target on the vSwitch in the virtual private cloud (VPC) where the application resides. If you leave this property empty but specify MountDesc, a NAS file system is purchased and mounted to the vSwitch in the VPC.

WarStartOptions

String

No

Yes

The startup options of the WAR package of the application.

The default startup command of the application is java $JAVA_OPTS $CATALINA_OPTS -Options org.apache.catalina.startup.Bootstrap "$@" start.

Liveness

String

No

Yes

The configurations of the liveness health check of the container. A container that fails the health check is restarted.

The health check can be performed only by sending commands in a container. Example: {"exec":{"command":["sleep","5s"]},"initialDelaySeconds":10,"timeoutSeconds":11}.

Memory

Integer

Yes

No

The memory size that is required for each application instance. Only instances of fixed specifications are supported.

A single value of Memory corresponds to one or more fixed values of Cpu. Valid values of Memory:

  • Valid value of Memory when Cpu is set to 500: 1024.

  • Valid value of Memory when Cpu is set to 500 or 1000: 2048.

  • Valid value of Memory when Cpu is set to 1000 or 2000: 4096.

  • Valid value of Memory when Cpu is set to 2000 or 4000: 8192.

  • Valid value of Memory when Cpu is set to 4000 or 8000: 16384.

  • Valid value of Memory when Cpu is set to 16000: 32768.

  • Valid value of Memory when Cpu is set to 8000, 16000, or 32000: 65536.

  • Valid value of Memory when Cpu is set to 32000: 131072.

Unit: MB.

WebContainer

String

No

Yes

The version of the Tomcat container on which the deployment package of the application depends.

This property is not supported when you use an image to deploy the application.

SlsConfigs

String

No

Yes

The configurations of the file log collection feature.

None.

Cpu

Integer

Yes

No

The CPU millicores that are required for each application instance. Only instances of fixed specifications are supported.

Valid values:

  • 500

  • 1000

  • 2000

  • 4000

  • 8000

  • 16000

  • 32000

Unit: millicores.

Deploy

Boolean

No

No

Specifies whether the deployment immediately takes effect.

Valid values:

  • true

  • false (default)

Tags

List

No

Yes

The tags.

You can add up to 20 tags.

For more information, see Tags syntax and Tags properties.

PackageVersion

String

No

Yes

The version of the deployment package.

You must specify this property when PackageType is set to War or FatJar.

AppName

String

Yes

No

The application name.

The name can be up to 36 characters, and must start with a letter. It can contain letters, digits, and hyphens (-).

Jdk

String

No

Yes

The version of the Java Development Kit (JDK) on which the deployment package of the application depends.

This property is not supported when you use an image to deploy the application.

JarStartArgs

String

No

Yes

The startup parameters of the JAR package of the application.

The default startup command of the application is $JAVA_HOME/bin/java $JarStartOptions -jar $CATALINA_OPTS "$package_path" $JarStartArgs.

PreStop

String

No

Yes

The script that is run immediately before the container is stopped.

Example: {"exec":{"command":"cat","/etc/group"}}.

Readiness

String

No

Yes

The configurations of the readiness health check of the container.

Example: {"exec":{"command":["sleep","6s"]},"initialDelaySeconds":15,"timeoutSeconds":12}.

A container that fails the health check multiple times is restarted. Containers that fail health checks do not receive traffic from Server Load Balancer (SLB) instances.

PackageType

String

Yes

No

The type of the deployment package of the application.

Valid values:

  • FatJar

  • War

  • Image

CommandArgs

String

No

Yes

The parameters of the image startup command.

None.

Envs

String

No

Yes

The environment variables of the container.

Specify the value in the [{"name":"envtmp","value":"0"}] format.

  • name: the name of the environment variable

  • value: the value of or the reference to the environment variable

VSwitchId

String

No

No

The ID of the vSwitch to which the elastic network interface (ENI) of the application instance is connected.

The vSwitch must reside in the specified VPC. The vSwitch is associated with a namespace in Enterprise Distributed Application Service (EDAS). If you leave this property empty, the ID of the vSwitch that is associated with the specified namespace is used.

ImageUrl

String

No

Yes

The address of the image.

You can specify this property only when PackageType is set to Image.

PostStart

String

No

Yes

The script that is run immediately after the container is started.

Specify the value in the {"exec":{"command":"cat","/etc/group"}} format.

JarStartOptions

String

No

Yes

The startup options of the JAR package of the application.

The default startup command of the application is $JAVA_HOME/bin/java $JarStartOptions -jar $CATALINA_OPTS "$package_path" $JarStartArgs.

MountHost

String

No

Yes

The mount target of the NAS file system in the VPC.

None.

Replicas

Integer

Yes

No

The number of application instances that you want to create.

None.

CustomHostAlias

String

No

Yes

The custom mapping between the hostname and IP address in the container.

Specify the value in the [{"hostName":"samplehost","ip":"127.0.XX.XX"}] format.

  • hostName: the domain name or hostname

  • ip: the IP address

VpcId

String

No

No

The ID of the VPC that you want to associate with the SAE namespace.

In SAE, a namespace can correspond to only one VPC. After a VPC and a namespace are associated, you cannot change the VPC to another VPC. The first time you create an SAE application in a namespace, you must specify a VPC. Then, the specified VPC is associated with the namespace. Multiple namespaces can correspond to the same VPC. If you leave this property empty, the ID of the VPC that is associated with the specified namespace is used.

SecurityGroupId

String

No

No

The ID of the security group.

None.

Command

String

No

Yes

The startup command of the image.

The command must be an executable object that exists in the container. Example: sleep.

If you specify this property, the original startup command of the image becomes invalid.

EdasContainerVersion

String

No

Yes

The version of EDAS Pandora.

None.

PackageUrl

String

No

Yes

The URL of the deployment package.

This property takes effect only when PackageType is set to War or FatJar.

NamespaceId

String

Yes

No

The ID of the EDAS namespace.

The ID can contain only lowercase letters and hyphens (-). It must start with a lowercase letter.

AssociateEip

Boolean

No

No

Specifies whether to associate an elastic IP address (EIP) with the application.

Valid values:

  • true

  • false

AcrInstanceId

String

No

No

The ID of the Container Registry Enterprise Edition instance.

None.

OssAkId

String

No

No

The AccessKey ID that is used to read data from and write data to Object Storage Service (OSS).

None.

ProgrammingLanguage

String

No

No

The programming language that you want to use to create the application.

Valid values:

  • java: Java

  • php: PHP

  • other: other programming languages, such as Python, C++, Go, .NET, and Node.js

OssAkSecret

String

No

No

The AccessKey secret that is used to read data from and write data to OSS.

None.

Python

String

No

No

The Python environment.

Python 3.9.15 is supported.

BaseAppId

String

No

No

The ID of the base application.

None.

EnableEbpf

String

No

No

Specifies whether to enable application monitoring for non-Java applications based on the extended Berkeley Packet Filter (eBPF) technology.

Valid values:

  • true

  • false (default)

PhpArmsConfigLocation

String

No

No

The path to which the PHP configuration file for application monitoring is mounted. You must make sure that the PHP server loads the configuration file.

SAE automatically renders the valid configuration file. You do not need to manage the content of the configuration file.

PhpConfig

String

No

No

The content of the PHP configuration file.

None.

MicroRegistrationConfig

String

No

No

The configurations of the registry.

None.

TerminationGracePeriodSeconds

Integer

No

No

The timeout period of the graceful shutdown.

Default value: 30. Unit: seconds. Valid values: 1 to 300.

ConfigMapMountDesc

String

No

No

The description of the ConfigMap that you want to mount to the application.

A ConfigMap created on the ConfigMaps page of a namespace is used to inject configurations into containers. This property involves the following fields:

  • configMapId: the ConfigMap ID. You can call the ListNamespacedConfigMaps operation to query the ID.

  • key: the key value.

  • mountPath: the mount path.

Note

You can specify sae-sys-configmap-all to mount all keys.

PvtzDiscoverySvc

String

No

No

The configurations of Kubernetes Service-based service registration and discovery.

This property involves the following fields:

  • serviceName: the Service name. Specify the name in the Custom content-Namespace ID format. The value of Namespace ID must be the ID of the namespace where the application resides. For example, if you use the default namespace in the China (Beijing) region, you must set -Namespace ID to -cn-beijing-default.

  • namespaceId: the namespace ID.

  • portProtocols: the port number and protocols. Valid values of the port number: 1 to 65535. Valid values of the protocols: TCP and UDP.

  • portAndProtocol: the port number and protocol. Valid values of the port number: 1 to 65535. Valid values of the protocol: TCP and UDP. We recommend that you specify portProtocols. If you specify both portProtocols and portAndProtocol, only portProtocols takes effect.

  • enable: enables Kubernetes Service-based service registration and discovery.

AcrAssumeRoleArn

String

No

No

The Alibaba Cloud Resource Name (ARN) of the Resource Access Management (RAM) role that is used to pull images across accounts.

For more information, see Grant permissions to a RAM role.

TomcatConfig

String

No

No

The configurations of the Tomcat file.

You can leave this property empty or set this property to {} to delete the configurations. This property involves the following fields:

  • port: the port number. Valid values: 1024 to 65535. The root permissions are required to perform operations on ports whose value is less than 1024. Specify a value greater than 1024 within the valid range because the container is granted the admin permissions. If you leave this field empty, the default value 8080 is used.

  • contextPath: the access path. Default value: /. This value specifies the root directory.

  • maxThreads: the maximum number of connections in the connection pool. Default value: 400.

  • uriEncoding: the encoding format of Tomcat. Valid values: UTF-8, ISO-8859-1, GBK, and GB2312. If you leave this field empty, the default value ISO-8859-1 is used.

  • useBodyEncodingForUri: specifies whether to use BodyEncoding for URL. Default value: true.

AppSource

String

No

No

The microservices application.

Set the value to micro_service.

PythonModules

String

No

No

The custom module dependencies that you want to install.

By default, the dependencies defined by the requirements.txt file in the root directory are installed. If no software package is configured or customized, you can specify dependencies based on your business requirements.

NasConfigs

String

No

No

The configurations of the NAS file system that you want to mount to the application.

This property involves the following fields:

  • mountPath: the mount path of the container.

  • readOnly: A value of false specifies that read and write permissions are granted.

  • nasId: the ID of the NAS file system.

  • mountDomain: the domain name of the mount target of the container. For more information, see DescribeMountTargets.

  • nasPath: the directory in the NAS file system.

MicroRegistration

String

No

No

The type of the Nacos registry.

Valid values:

  • 0: SAE built-in Nacos registry

  • 1: self-managed Nacos registry

  • 2: MSE Nacos registry

ServiceTags

String

No

No

The canary tags of the application.

None.

ImagePullSecrets

String

No

No

The ID of the corresponding Secret.

None.

AutoConfig

Boolean

No

No

Specifies whether to automatically configure the network environment when you create the application.

Valid values:

  • true: SAE automatically configures the network environment when you create the application. In this case, the values of NamespaceId, VpcId, VSwitchId, and SecurityGroupId are ignored.

  • false: You manually configure the network environment when you create the application.

Note

If you set this property to true, the value of NamespaceId is ignored.

KafkaConfigs

String

No

No

The logging configurations of ApsaraMQ for Kafka.

This property involves the following fields:

  • kafkaEndpoint: the endpoint of the ApsaraMQ for Kafka API.

  • kafkaInstanceId: the ID of the ApsaraMQ for Kafka instance.

  • kafkaConfigs: one or more logging configurations of ApsaraMQ for Kafka. For more information about the valid values, see the "KafkaConfigs" property in this topic.

Php

String

No

No

The PHP version on which the PHP deployment package depends.

None.

OssMountDescs

List

No

No

The configurations of the OSS bucket that you want to mount.

This property involves the following fields:

  • bucketName: the name of the OSS bucket.

  • bucketPath: the directory or object in OSS. If the specified directory or object does not exist, an error is returned.

  • mountPath: the path of the container in SAE. If the container has an existing path, the specified path overwrites the existing path. If the container does not have an existing path, the specified path is created.

  • readOnly: specifies whether the container path has read-only permissions on resources in the OSS directory. Valid values:

    • true: The container path has read-only permissions on resources in the OSS directory.

    • false: The container path has read and write permissions on resources in the OSS directory.

PhpConfigLocation

String

No

No

The path to which the PHP configuration file for application startup is mounted.

You must make sure that the PHP server loads the configuration file.

SaeVersion

String

No

No

The SAE version.

Valid values:

  • v1

  • v2

Tags syntax

"Tags": [
  {
    "Key": String,
    "Value": String
  }
]  

Tags properties

Property

Type

Required

Editable

Description

Constraint

Key

String

Yes

No

The tag key.

The tag key must be 1 to 128 characters in length, and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Value

String

No

No

The tag value.

The tag value can be up to 128 characters in length, and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Return values

Fn::GetAtt

  • AppId: the application ID.

  • ChangeOrderId: the ID of the release order that is used to query the task execution status.

Examples

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  NamespaceId:
    Type: String
    Description: |-
      EDAS namespace corresponding to ID. Canada supports only the name of the scribe lowercase namespace must begin with a letter.
      Namespace can interface to obtain from DescribeNamespaceList.
  VpcId:
    Type: String
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
  VSwitchId:
    Type: String
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
  SecurityGroupId:
    Type: String
    AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
Resources:
  Application:
    Type: ALIYUN::SAE::Application
    Properties:
      AppName: TestApp
      NamespaceId:
        Ref: NamespaceId
      VpcId:
        Ref: VpcId
      VSwitchId:
        Ref: VSwitchId
      SecurityGroupId:
        Ref: SecurityGroupId
      Cpu: 500
      Memory: 1024
      Replicas: 2
      PackageType: War
      Deploy: true
      Timezone: Asia/Shanghai
Outputs: {}
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "NamespaceId": {
      "Type": "String",
      "Description": "EDAS namespace corresponding to ID. Canada supports only the name of the scribe lowercase namespace must begin with a letter.\nNamespace can interface to obtain from DescribeNamespaceList."
    },
    "VpcId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
    },
    "VSwitchId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}"
      }
    },
    "SecurityGroupId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}"
      }
    }
  },
  "Resources": {
    "Application": {
      "Type": "ALIYUN::SAE::Application",
      "Properties": {
        "AppName": "TestApp",
        "NamespaceId": {
          "Ref": "NamespaceId"
        },
        "VpcId": {
          "Ref": "VpcId"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "SecurityGroupId": {
          "Ref": "SecurityGroupId"
        },
        "Cpu": 500,
        "Memory": 1024,
        "Replicas": 2,
        "PackageType": "War",
        "Deploy": true,
        "Timezone": "Asia/Shanghai"
      }
    }
  },
  "Outputs": {
  }
}

For more examples, visit sae.yml. In the examples, the following resource types are used: ALIYUN::SAE::Namespace, ALIYUN::SAE::Application, and ALIYUN::SAE::SlbBinding.