If you have an Alibaba Cloud ECS instance, you can use Cloud Toolkit to quickly deploy applications. This topic describes how to use Cloud Toolkit in IntelliJ IDEA to deploy an application to an ECS instance.
Prerequisites
You have an ECS instance in the region where you want to deploy the application. For more information, see Purchase an ECS instance.
Note If you purchased your ECS instance before December 1, 2017, install the Cloud Assistant client.You have installed and configured Cloud Toolkit in IntelliJ IDEA. For more information, see Install and configure Cloud Toolkit in IntelliJ IDEA.
Precautions
Due to a limitation in Cloud Assistant, you can only use the root account for deployment in this tutorial. To use a different account for deployment, use one of the following methods:
- Switch accounts in the Command script.
- Use the application server feature to complete the deployment. For more information, see Deploy an application to a Linux server.
Procedure
Open your project in IntelliJ IDEA.
In the IntelliJ IDEA menu bar, choose .
-
In the Deploy to ECS dialog box, set the deployment parameters, and then click Run.
The following list describes the parameters:
Deploy File: Select Maven Build or Upload File.
- Maven Build: Builds and deploys the current project if it uses Maven.
- Upload File: Uploads a local file. Use this option if the project does not use Maven, or if a compressed deployment package already exists on your local machine.
- Gradle Build: Builds and deploys the current project if it uses Gradle.
- Target ECS: Select the target ECS instance.
- Click +.
- In the Select ECS dialog box, select the target Account and Region.
- In the instance list, select the target ECS instance and click Select.
- Target Directory: Enter the deployment path on the ECS instance. For example:
## Deployment directory: /root/tomcat/webapps
## Deployment directory: /root/springbootdemo
## Deployment directory: /root/go-demo
## Deployment directory: /root/nodejs-demo
- Command: The command to run after the application package is deployed. This is typically a startup command. For example:
sh /root/restart.shNote For more information about commands, see Guidelines for writing commands.
Verify the results
After the deployment starts, deployment logs are displayed in the Console pane of IntelliJ IDEA. You can check the logs to verify the deployment result.