With the rapid development of cloud computing technology, an increasing number of developers are deploying applications to Alibaba Cloud Elastic Compute Service (ECS) instances. This tutorial describes how to deploy a Java application developed locally to an Alibaba Cloud ECS instance using Cloud Toolkit.
The coding method is similar no matter whether you compile Java applications that run on the cloud or locally. Therefore, this article takes a Java servlet for printing "Hello World" on a Web page as an example to explain the deployment method.
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;
}}
You can download the source code through this link.
The preceding code is a standard Java project used to print the string "Hello World" on a Web page.
Alibaba Cloud provides an Eclipse-based plug-in to help developers efficiently deploy applications written in the local IDE to ECS instances.
URL of the plug-in: https://www.aliyun.com/product/cloudtoolkit_en
The installation process of this Eclipse-based plug-in is similar to that of a common plug-in, and therefore will not be detailed here.
After installing the plug-in, configure the preferences by choosing:
Top menu > Window > Preferences > Alibaba Cloud Toolkit > Accounts
When the following page is displayed, configure the AK and SK of your Alibaba Cloud account to complete the configuration of preferences.( If you are using a RAM user account, enter the AK and SK of the RAM user.)
In Eclipse, right-click the project name and choose Alibaba Cloud > Deploy to ECS from the shortcut menu. The following deployment window is displayed:
In the Deployment Configurations dialog box, set the deployment parameters, and click Deploy to complete the initial deployment.
Alibaba Clouder - May 10, 2018
Nick - May 10, 2019
Nick - May 17, 2019
Nick - May 15, 2019
Nick - July 2, 2019
Nick - May 7, 2019
Robotic Process Automation (RPA) allows you to automate repetitive tasks and integrate business rules and decisions into processes.
Learn MoreA PaaS platform for a variety of application deployment options and microservices solutions to help you monitor, diagnose, operate and maintain your applications
Learn MoreGain an industrial edge with Alibaba Cloud best practices
Learn MoreAlibaba Cloud (in partnership with Whale Cloud) helps telcos build an all-in-one telecommunication and digital lifestyle platform based on DingTalk.
Learn MoreMore Posts by Nick(倪超)