Deploy Java application developed in IntelliJ IDEA environment to Alibaba Cloud ECS instance

This tutorial will show you how to deploy a ** Java ** application developed in your local IntelliJ IDEA environment onto a ** Alibaba Cloud ECS instance **.

image.png

Develop an application locally

Whether you compile a Java application that runs in the cloud or a Java application that runs locally, the coding method is the same. Therefore, in this article, we will explain how to deploy using a Java Servlet for printing "Hello World" on a Web page as an example.

image.png

public class IndexServlet extends HttpServlet {
    private static final long serialVersionUID = -112210702214857712L;

    @Override
    public void doGet( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException {
        PrintWriter writer = resp.getWriter();
        // Demo: Use Alibaba Cloud Toolkit to modify the code of a local application and deploy the application to the cloud.
        writer.write("Deploy from alibaba cloud toolkit. 2018-10-24");
        return;
    }
    @Override
    protected void doPost( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException {
        return;
    }}

[This link](https://alicloud-common.oss-ap-southeast-1.aliyuncs.com/Cloud_Toolkit_Blog/IndexSer...%5B%E9%93%B6%E6%97%B6%5D.1540514368. You can download the source code from zip? spm = a2c65.11461447.0.0.7e79457cxOPl5q & file = IndexSer ...% 5B% E9% 93% B6% E6% 97% B6% 5D.1540514368.zip).

The above code is a standard Java project for displaying the string "Hello World" on a web page.

Plugin installation

Alibaba Cloud provides Intellij IDEA-based plugins for efficiently deploying applications written in the local IDE to ECS instances.

Plugin URL: https://www.aliyun.com/product/cloudtoolkit_en

The installation process for this Intellij IDEA based plugin is similar to a typical plugin and will not be discussed in detail here.

Plugin preferences

After installing the plugin, click the Alibaba Cloud icon on the toolbar as shown below.

image.png

When the following page is displayed, set the AK and SK of the Alibaba Cloud account, and the setting of the environment setting is completed (If you are using a RAM user account, enter the AK and SK of the RAM user ).

image.png

Deploy application

image.png

Right-click on the project name in IntelliJ IDEA and select Alibaba Cloud> Deploy to ECS from the shortcut menu. The following deployment screen will be displayed.

image.png

Deploy in the ECS dialog box, set the deployment parameters, and click Deploy to complete the initial deployment.

Description of placement parameters

Deploy file: You have two options.

--Maven Build: If you are using Maven to build your current project, you can use Alibaba Cloud Toolkit to build and deploy your application directly. --File Upload: If you are not using Maven to build your current project, or if you already have a locally packaged deployment file, you can select your local deployment file and upload it directly. --Select an ECS to deploy: Select a region from the drop-down list and select an ECS instance to deploy to that region. --Specify deployment destination: Enter the deployment path on the ECS instance. --Command: Enter the application startup command. This parameter specifies the command to be executed after the application package is deployed. For Java programs, this is usually the Tomcat start command.

Recommended Posts

Deploy Java application developed in IntelliJ IDEA environment to Alibaba Cloud ECS instance
Deploy a Java application developed locally with the Cloud Toolkit to an Alibaba Cloud ECS instance
How to deploy Java application to Alibaba Cloud EDAS in Eclipse
Deploy a Node.js application to an ECS instance using the Cloud Toolkit
How to develop an app with Jersey Java RESTful API on Alibaba Cloud ECS instance
Java + OpenCV 3.X in IntelliJ IDEA
Automatically deploy a Web application developed in Java using Jenkins [Preparation]
Automatically deploy Web applications developed in Java using Jenkins [Tomcat application]
Optimize Java import declarations in IntelliJ IDEA
Automatically deploy a web application developed in Java using Jenkins [Spring Boot application]
Java --Introduce CheckStyle plugin to IntelliJ IDEA and reflect it in formatter
Java application development environment created in VM environment
Settings to display Japanese Javadoc in IntelliJ IDEA
How to use Alibaba Cloud LOG Java Producer
[Beginner] Install java development tool in cloud9 development environment.
JavaFX application development with IntelliJ IDEA and Gradle ~ From environment construction to sample code ~
How to create a Java environment in just 3 seconds
How to use java non-standard library on IntelliJ IDEA
If you want to recreate the instance in cloud9
I tried to develop the cache function of Application Container Cloud Service in the local environment
Web application development environment construction in Java (for inexperienced people)
Guide: Deploy your application using the Alibaba Cloud Toolkit plugin
Continuous integration on Alibaba Cloud ECS Ubuntu instance with Jenkins
Failed to launch checking at Kotlin Koans in IntelliJ IDEA
[Java] Deploy the Spring Boot application to Azure App Service
What happened in "Java 8 to Java 11" and how to build an environment