Upload code or an image to Serverless App Engine (SAE) to deploy applications. SAE manages compute resources and supports traffic-based auto scaling and multi-zone deployment.
Solution overview
You will deploy microservice applications that register with each other, call methods across services, and serve traffic from the internet. The sample architecture:
This tutorial uses a Java microservice as an example, but SAE supports any language or architecture: static websites, front-end and back-end applications, monolithic applications, and microservice applications.
In this tutorial, you will:
-
Deploy applications: Deploy provider and consumer applications with sample images. SAE's built-in Nacos handles service registration and discovery, enabling the consumer to call the provider.
-
Access the application from the internet: Configure a public endpoint for the consumer application.
Prerequisites
Procedure
SAE supports multiple deployment methods. Choose console or saectl (kubectl-compatible) to complete this tutorial.
Console
1. Deploy applications
-
Deploy the provider application: Log in to the SAE console. Choose . Select a region (this tutorial uses China (Hangzhou)). Click Create Application, configure the following parameters, and click Create Application Now to skip Advanced Settings.
If is not in the navigation pane, choose .
If prompted to select an edition, select Standard Edition. The Lightweight Edition and Professional Edition are in invite-only beta. Edition differences do not affect this tutorial.
-
Enter a custom Application Name, such as
provider. -
Set Namespace Type to
System-created. This uses the default namespace and automatically provisions network resources (VPC, vSwitch, and security group). -
Set Deployment Method to
Deploy Using Image. Click Set Image. On the Demo Image tab, select Microservice Application - Provider with Image Versionmicroservice-java-provider-v1.0, then click OK. -
In Capacity Settings, set the Instance Specification and Number of Instances for your application.
-
-
Deploy the consumer application: Repeat the preceding steps with the following changes.
-
Enter a custom Application Name, such as
consumer. -
When you Set Image, find Microservice Application - Consumer and set Image Version to
microservice-java-consumer-v1.0.
-
-
Check the deployment result: Wait about one minute for deployment to complete.
-
View the applications on the Application List page. Click an application to open its details.
-
Choose Basic Information in the navigation pane. On the Instance List tab, view the application instances.
-
2. Enable public access
Bind an internet-facing CLB instance to the consumer application for public access.
-
Bind an internet-facing CLB instance to the consumer application: On the consumer application details page, go to the Application Information tab. In Application Access Settings, select CLB-based Access. Click Add internet-facing CLB, configure the following parameters, and click OK.
-
For CLB Instance, select Create CLB Instance.
-
On the HTTP Protocol tab, set HTTP Port to
80and container port to18082.
-
-
Verify the result: After SAE creates and binds the CLB instance, the console displays the application's public endpoint.
-
Open
http://<public_endpoint>/consumer-echo/helloin your browser, replacing<public_endpoint>with the actual value. -
On the page, view the call topology between the consumer and provider applications.
-
3. Clean up resources
Clean up resources after completing this tutorial to avoid unnecessary charges.
-
Delete the applications: On each application's details page, choose and follow the instructions.
The CLB instance that SAE created is automatically released when you delete the application.
-
(Optional) Delete network resources: SAE automatically created a VPC, vSwitch, and security group during deployment.
-
View the VPC: Choose and click default. On Basic Information, click the VPC link to open its details page.
-
View the vSwitch and security group: On the VPC's Resource Management tab, click the links to their details pages.
-
Delete the resources on their respective details pages.
-
saectl tool
1. Install and configure saectl
2. Deploy the applications
-
Create resource configuration files: Create the following files in the same directory. Note: Replace
image: ...cn-hangzhou...with your deployment region.-
deployment-provider.yamlconfigures the provider application:apiVersion: apps/v1 kind: Deployment metadata: annotations: sae.aliyun.com/new-sae-version: std # Select the application edition. 'std' indicates Standard Edition. The Lightweight and Professional editions are in invite-only beta. This selection does not affect the tutorial. name: provider # Customizable application name. namespace: default # Select the system-created default namespace, which automatically creates and associates network resources like VPCs, vSwitches, and security groups. spec: replicas: 2 # Number of application instances. selector: matchLabels: sae.aliyun.com/app-name: provider # Must be the same as the application name defined in metadata. template: metadata: labels: sae.aliyun.com/app-name: provider # Must be the same as the application name defined in metadata. spec: containers: - name: main # We recommend that you name the container 'main' to avoid conflicts. image: registry.cn-hangzhou.aliyuncs.com/sae-serverless-demo/sae-demo:microservice-java-provider-v1.0 # The sample image for the provider application. Replace cn-hangzhou with your deployment region. resources: # Specification for a single application instance. 'limits' and 'requests' must have the same configuration. limits: cpu: "2" memory: 4Gi requests: cpu: "2" memory: 4Gi -
deployment-consumer.yamlconfigures the consumer application:apiVersion: apps/v1 kind: Deployment metadata: annotations: sae.aliyun.com/new-sae-version: std # Select the application edition. 'std' indicates Standard Edition. The Lightweight and Professional editions are in invite-only beta. This selection does not affect the tutorial. name: consumer # Customizable application name. namespace: default # Select the system-created default namespace, which automatically creates and associates network resources like VPCs, vSwitches, and security groups. spec: replicas: 2 # Number of application instances. selector: matchLabels: sae.aliyun.com/app-name: consumer # Must be the same as the application name defined in metadata. template: metadata: labels: sae.aliyun.com/app-name: consumer # Must be the same as the application name defined in metadata. spec: containers: - name: main # We recommend that you name the container 'main' to avoid conflicts. image: registry.cn-hangzhou.aliyuncs.com/sae-serverless-demo/sae-demo:microservice-java-consumer-v1.0 # The sample image for the consumer application. Replace cn-hangzhou with your deployment region. resources: # Specification for a single application instance. 'limits' and 'requests' must have the same configuration. limits: cpu: "2" memory: 4Gi requests: cpu: "2" memory: 4Gi
-
-
Deploy the applications: Run
saectl apply -f deployment-provider.yaml -f deployment-consumer.yamlfrom the directory containing the configuration files. -
Verify the result:
-
View the applications: Run
saectl get deployments -n default. The-n defaultflag specifies the default namespace. In the output:-
STATERUNNINGmeans the application is running.PUBLISHINGmeans deployment is in progress. -
The
READYfield showsn/m, which representsnumber of ready instances / desired number of instances.
-
-
View the application instances: Run
saectl get pods -n default. In the output:-
STATUSRUNNINGmeans the container is running normally.ContainerCreatingmeans the container is being created. -
The
READYfield showsn/m, which representsnumber of ready containers / total number of containers.
-
-
3. Enable public access
Bind an internet-facing CLB instance to the consumer application for public access.
-
Create a resource configuration file: Create a
svc.yamlfile to configure a Service that exposes the consumer application to the internet through an internet-facing CLB:apiVersion: v1 kind: Service metadata: annotations: sae.aliyun.com/loadbalancer-address-type: internet # Address type. 'internet' for public and 'intranet' for private. name: internet-consumer # Fixed format: ${address-type}-${app-name} spec: ports: - name: port-80 # Fixed format: port-${external-port} port: 80 protocol: HTTP targetPort: 18082 # Container port of the consumer application. selector: sae.aliyun.com/app-name: consumer # Application name. type: LoadBalancer -
Deploy the service: Run
saectl apply -f svc.yamlfrom the directory containing the configuration file. -
Verify the result:
-
View the service: Run
saectl get services -n default. In the output:-
EXTERNAL-IPshows the public IP address.<pending>means the service is still being created. -
PORT(S)shows the configured access port.
-
-
Access the application from the internet: Run
curl http://<public_endpoint>:<access_port>/consumer-echo/hello, replacing<public_endpoint>and<access_port>with actual values. The output confirms the consumer calling the provider.
-
4. Clean up resources
Clean up resources after completing this tutorial to avoid unnecessary charges.
Delete the applications: Run saectl delete -f deployment-provider.yaml -f deployment-consumer.yaml.
The CLB instance that SAE created is automatically released when you delete the application.
Next steps
-
To deploy your own applications, SAE provides the following methods:
-
Deploy an application from an image (Recommended): Package your application into an image, push it to an image repository, and deploy it to SAE.
-
Deploy an application from a code package: SAE provides runtimes for specific versions of Java, PHP, Python, and .NET Core. Create a code package that meets SAE requirements and deploy it directly.
-
-
SAE also provides other methods for inter-application communication beyond SAE's built-in Nacos used in this tutorial:
-
Use an MSE Nacos registry (Recommended): A managed registry with high performance, scalability, and availability — no self-hosting required.
-
Use a self-managed service registry: Use your existing registry (Nacos, ZooKeeper, etc.) with SAE. Ensure network connectivity and configure the registry address in your application code.
-
Configure application service access based on Kubernetes Service: Assign a fixed domain name within the SAE cluster for inter-application access.
-
-
Beyond binding a CLB instance, you can bind an NLB instance or configure a gateway route for inbound access. For outbound access to external resources, configure a NAT gateway or bind an EIP to instances.
-
Use custom namespaces to isolate environments (development, testing, production). Each namespace binds to a VPC. Select vSwitches in different availability zones to deploy across multiple zones.
-
Scale applications by adjusting instance count and instance specification, or configure auto scaling policies based on traffic and resource usage. Reduce costs by enabling idle mode.