During application development, you can use the Alibaba Cloud Toolkit plugin to enable your local applications to communicate with applications deployed in Serverless App Engine (SAE). This setup, known as interconnection between on--premises and cloud applications, improves your development efficiency. This topic describes the prerequisites and steps to set up this connection by using Alibaba Cloud Toolkit.
Prerequisites
-
Make sure that you use IntelliJ IDEA 2018.3 or later.
-
Alibaba Cloud Toolkit 2020.9.1 or later lets you configure the interconnection between on-premises and cloud applications at the project and module level. To use this granular configuration feature, upgrade Alibaba Cloud Toolkit to version 2020.9.1 or later.
NoteIf your Alibaba Cloud Toolkit is version 2020.9.1 but the granular configuration option is unavailable, uninstall and then reinstall the plugin.
-
Create an Elastic Compute Service (ECS) instance accessible via SSH in the Virtual Private Cloud (VPC) where your application resides. This ECS instance establishes the interconnection channel. For more information, see Create an ECS instance by using the console (Quick Start).
Important-
The ECS instance and your application must be in the same VPC.
-
You must use a password to log on via SSH. Key pair authentication is not supported.
-
If a proxy is configured in your operating system, the connection to the interconnection channel may fail. Disable the proxy and try again.
-
Limitations
The interconnection between on-premises and cloud applications feature supports Java applications. The following limitations apply to different Java microservices frameworks.
|
Microservices framework |
Limitations |
|
Spring Cloud |
If you use Nacos for configuration management, make sure that your Spring Cloud version is Edgware or later. |
|
Dubbo |
|
|
HSF |
None |
Limitations
The interconnection between on-premises and cloud applications feature supports Java applications. The following limitations apply to different Java microservices frameworks:
|
Microservices framework |
Limitations |
|
Spring Cloud |
If you use Nacos for configuration management, make sure that your Spring Cloud version is Edgware or later. |
|
Dubbo |
|
|
HSF |
None |
Step 1: Install Alibaba Cloud Toolkit
-
Start IntelliJ IDEA.
-
Install the plugin.
-
For macOS: From the main menu, choose . In the left-side navigation pane of the Preferences dialog box, click Plugins. Search for Alibaba Cloud Toolkit and click Install.
-
For Windows: From the main menu, choose . In the left-side navigation pane of the Settings dialog box, click Plugins. Search for Alibaba Cloud Toolkit and click Install.
-
-
After you install the plugin, restart IntelliJ IDEA. The Alibaba Cloud Toolkit icon (
) appears in the toolbar.
Step 2: Configure Alibaba Cloud Toolkit account
After you install Alibaba Cloud Toolkit, you must configure an account by providing an AccessKey ID and an AccessKey Secret.
-
Start IntelliJ IDEA.
-
From the main menu, choose .
-
In the Settings dialog box, choose .
-
On the Accounts page, enter your AccessKey ID and AccessKey Secret, and then click OK.
If you use the AccessKey ID and AccessKey Secret of a RAM user, make sure that the RAM user has at least the permissions to deploy applications. For more information, see Grant permissions to a RAM user.
Note the following about Alibaba Cloud accounts:
-
If you have an Alibaba Cloud account, click Get existing AK/SK on the Accounts page. You are redirected to the Alibaba Cloud sign-in page. After you sign in, you are sent to the Security Information Management page, where you can get your AccessKey ID and AccessKey Secret.
-
If you do not have an Alibaba Cloud account, click Sign up on the Accounts page to register one. After registration, follow the steps described above to get your AccessKey ID and AccessKey Secret.
-
Step 3: Configure on-premises-to-cloud interconnection
-
From the main menu, choose .
-
In the Settings dialog box, choose .
-
On the Microservice page, select Interconnection Between On-premises and Cloud Applications, configure the parameters, and then click Apply.
The following table describes the parameters.
Parameter
Description
Product
Select Serverless App Engine (SAE).
Environment for Interconnection Between On-premises and Cloud Applications
Specify the region and namespace where the application is deployed.
Spring Cloud Service Port
If you use a Spring Cloud application, add the service port of the application in the Spring Cloud Service Port section. You can skip this parameter for other types of applications.
Jump Server Settings
-
Jump Server IP: Enter the public IP address of your ECS instance.
-
Account: Enter the username used to establish the interconnection channel.
-
Password: Enter the password used to establish the interconnection channel.
NoteYou can enter the username and password of the ECS instance used for the interconnection channel. Alternatively, enter a new username and password, and click Initialize Account... to initialize the account.
Initialize Account...
-
If you enter the root username and password of the ECS instance, the configuration uses the root account. If the operation succeeds, the message The configuration was added successfully appears.
-
If you use a new or non-root account for the connection, you must have root permissions to configure the proxy for this account. In the Add SSH Rule dialog box, enter the root Password and click Add.
Important-
The username and password for the ECS instance are used only to create a network proxy and not for any other purpose.
-
We recommend that you use a new or non-root account for the connection. You can then share this account with other team members who also need to use the interconnection, which helps prevent leaking root credentials.
-
-
Step 4: Start the local application for interconnection
Start your local application. If the connection is active, a message appears, confirming that the interconnection between on-premises and cloud applications is enabled.
After the application starts, an etrans process also starts.
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class ConsumerApplication {
@LoadBalanced
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
public static void main(String[] args) {
SpringApplication.run(ConsumerApplication.class, args);
}
}
If you encounter any issues during the interconnection process, click Quick Diagnostics to troubleshoot problems such as etrans channel startup errors and service connection failures.
More information
-
If you encounter issues when implementing the interconnection with Alibaba Cloud Toolkit, see Troubleshoot interconnection issues.
-
To learn how to quickly deploy applications to SAE by using the IntelliJ IDEA plugin, see Deploy an application by using the Alibaba Cloud Toolkit for IntelliJ IDEA.