All Products
Search
Document Center

Serverless App Engine:Deploy a Java application to SAE 1.0

Last Updated:Feb 29, 2024

This topic describes how to deploy a Java application to Serverless App Engine (SAE) by using a WAR package in the SAE console and enable access over the Internet.

Prerequisites

  1. SAE is activated. For more information, see Activate SAE.

  2. A security group is created. For more information, see Create a security group.

  3. A demo application is downloaded. To download a demo application, click Download a demo application.

Billing

You are not charged for activating SAE. You are charged for your actual resource usage in SAE based on the pay-as-you-go billing method. For more information, see Billing overview.

Procedure

In this example, only the key parameters that are required to deploy a Java application by using a WAR package are described. You can configure other parameters based on your business requirements. For more information, see Deploy a Java web application by using a WAR package in the SAE console. For information about how to deploy an application by using a JAR package, see Deploy a microservices application by using a JAR package in the SAE console.

Step 1: Create a Java application

  1. Log on to the SAE console.

  2. In the left-side navigation pane, click Applications. In the top navigation bar, select a region. Then, click Create Application.

  3. In the Basic Information step, configure the parameters and click Next: Application Deployment Configurations.

    Parameter

    Description

    Application Name

    Enter my-sae.

    VPC

    Select Custom Configuration.

    Namespace

    Select an existing namespace. Namespaces and virtual private clouds (VPCs) are in one-to-one mapping relationships. After you select a namespace for an application, the corresponding VPC is associated with the application.

    vSwitch

    Click Select vSwitch. In the Select vSwitch dialog box, select one or more vSwitches in the recommended zones and click OK.

    Security Group

    Select an existing security group.

    Application Instances

    Enter 2.

    VCPU

    Select 1 Core.

    Memory

    Select 2 GiB.

  4. In the Deployment Configurations step, configure the parameters and click Next: Confirm Specifications.

    The following table describes the basic parameters. Use the default settings for other advanced settings.

    Parameter

    Description

    Technology Stack Programming Language

    Select Java.

    Application Deployment Method

    Select Deployment with WAR Packages.

    Application Runtime Environment

    Select apache-tomcat-7.0.91. Select an environment in the apache-tomcat-xxx format for Spring Boot or Dubbo applications. Select an environment in the EDAS-Container-XXX format for HSF applications.

    Java Environment

    Select Open JDK 8.

    File Upload Method

    Select Upload WAR Package.

    Upload WAR package

    Click Select File and upload the demo package that you obtained.

    Version

    Click Use Timestamp as Version Number.

    Time Zone Settings

    Select UTC+8.

  5. In the Specification Confirmation step, view the details of the application and the fee for the selected specifications. Then, click Confirm.

    The Creation Completed step appears. You can click Application Details to go to the Basic Information page of the application.

  6. Verify whether the configurations have taken effect.

    • Method 1:

      In the left-side navigation pane of the Basic Information page, click Change Records. On the Change Records page, view the change details. If Executed is displayed in the Change Status column, the application is deployed and the configurations have taken effect.

    • Method 2:

      On the Basic Information page, click the Instance Deployment Information tab to view the Status of the instances. If Running is displayed in the Status column, the application is deployed and the configurations have taken effect.

Step 2: Access the application over the Internet

After the application is deployed, you must bind a Classic Load Balancer (CLB) instance to the application. This way, the application can be accessed over the Internet. SAE automatically purchases CLB instances. You must specify the listening port of the application. You can also reuse a CLB instance that you purchased in the CLB console. For information about reuse rules, see Configure application access based on CLB instances. In this example, a CLB instance that was automatically purchased by SAE is used.

Note

CLB instances belong to the Server Load Balancer (SLB) family.

  1. On the Basic Information page of the my-sae application, the Basic Information tab is displayed by default. In the Application Access Settings section, click Add Internet-facing CLB Instance.

  2. In the Add Internet-facing CLB Instance dialog box, configure the parameters and click OK. The following table describes the parameters.

    Parameter

    Description

    Select CLB Instance

    Select Create.

    Network Protocol

    Click the TCP Protocol tab and specify the default listening port.

    • CLB Port: Enter 80.

    • Container Port: Enter 80.

    After the Internet-facing CLB instance is added, you can view the IP address and port of the Internet-facing CLB instance in the Public Endpoint section on the Basic Information page.

  3. Access the demo application over the Internet.

    Enter http://<IP address of the Internet-facing CLB instance>:<Port of the instance>/ in the address bar of your browser, and then press Enter to view the homepage of the demo application.sc_access_sae_Java_application_over_the_Internet

(Optional) Step 3: Clear resources

  • If you no longer need to use SAE, you can delete resources to prevent additional fees.

    On the Applications page, find the application that you want to delete and click Delete in the Actions column.

  • If you still need to use SAE, pay attention to your resource usage and make sure that your account does not have overdue payments. For information about the billing of SAE, see Billing overview.

FAQ

  • What is a namespace?

    A namespace is a logically isolated runtime environment. Namespaces help you logically isolate runtime environments, such as the development, test, and production environments, based on the service calls and distributed configuration pushes of applications. For more information, see Manage a namespace.

  • What do I do if I am unable to access an application over the Internet after I bind a CLB instance to the application?

    For more information, see Configure a NAT gateway for an SAE application to enable Internet access.

  • How do I configure advanced settings such as Environment Variable Settings, Hosts Binding Settings, Application Health Check, Log Collection Service, and Persistent Storage?

    For more information, see Advanced settings.

References

The following table describes the operations that you can perform on an application after you deploy the application on SAE.

Operation

References

Lifecycle management operations, such as updating, starting, stopping, and deleting an application, and scaling in or scaling out the instances for an application

Manage the lifecycle of an application

Performance optimization operations, such as configuring auto scaling policies for an application, binding Server Load Balancer (SLB) instances to an application, and starting or stopping applications in batches

Application status-based operations, such as managing logs, configuring monitoring settings, viewing application events, and viewing change records