Connect local and cloud applications with Cloud Toolkit for IntelliJ IDEA

更新时间:
复制 MD 格式

Use the endpoint-to-cloud connection feature in Cloud Toolkit for IntelliJ IDEA to allow your local and cloud applications to call each other. This feature improves development efficiency.

Prerequisites

Before you connect local and cloud applications with Cloud Toolkit, complete the following tasks:

  • Make sure that you use IntelliJ IDEA 2018.3 or later.
  • Cloud Toolkit 2020.9.1 and later lets you configure endpoint-to-cloud connections at the project and module level of your local project. To use this feature, you must upgrade Cloud Toolkit to version 2020.9.1 or later.
    Note If you use Cloud Toolkit 2020.9.1 but the configuration granularity option is not available, uninstall and then reinstall the Cloud Toolkit plugin.
  • Create an Elastic Compute Service (ECS) instance that you can log on to using the Secure Shell (SSH) protocol. This instance is used to establish the endpoint-to-cloud connection channel. For more information, see Create an ECS instance from the console (Quick Start).
    Important
    • Make sure that the ECS instance and the application that you want to connect are in the same Virtual Private Cloud (VPC).
    • The SSH channel requires a password for logon. Logon with key pairs is not supported.

Limits

Endpoint-cloud interconnection currently supports Java applications. The following limits apply to different Java microservice frameworks:

Microservice frameworkLimits
Spring CloudIf you use Nacos for configuration management, ensure that your Spring Cloud version is Spring Cloud Edgware or later.
Dubbo
  • Dubbo 2.7.2 or later
  • Required versions for dependent service registration and discovery components:
    • dubbo-nacos-registry 2.7.2 or later
    • edas-dubbo-extension 2.0.2 or later
HSFNone

Step 1: Install Cloud Toolkit

  1. Start IntelliJ IDEA.
  2. Install the plugin in IntelliJ IDEA.
    • On macOS: In the top menu bar, choose IntelliJ IDEA > Preferences.... In the navigation pane on the left of the Preferences page, click Plugins. Search for Alibaba Cloud Toolkit and click Install.在IntelliJ IDEA中安装插件—mac
    • On Windows: In the top menu bar, choose File > Settings. In the navigation pane on the left of the Settings page, click Plugins. Search for Alibaba Cloud Toolkit and click Install.在IntelliJ IDEA中安装插件—windows
  3. After the plugin is installed, restart IntelliJ IDEA. The Alibaba Cloud Toolkit icon (Alibaba Cloud Toolkit图标) appears in the toolbar.

Step 2: Configure the Cloud Toolkit account

After you install Alibaba Cloud Toolkit, configure an account for it using an AccessKey ID and an AccessKey secret.

  1. Start IntelliJ IDEA.
  2. In the top menu bar, choose Tools > Alibaba Cloud > Preferences....
  3. In the Settings dialog box, choose Alibaba Cloud Toolkit > Accounts.
  4. On the Accounts page, set AccessKey ID and AccessKey secret, and then click OK.
    If you use the AccessKey ID and AccessKey secret of a Resource Access Management (RAM) user, make sure that the RAM user has the permissions to deploy applications. For more information, see Manage RAM user permissions.Accounts

    The following information describes Alibaba Cloud accounts:

    • If you have an Alibaba Cloud account, click Get existing AK/SK on the Accounts page. The Alibaba Cloud logon page appears. Log on with your account. You are redirected to the Security Information Management page where you can retrieve the AccessKey ID and AccessKey secret.
    • If you do not have an Alibaba Cloud account, click Sign up on the Accounts page. The Alibaba Cloud account registration page appears. Create an account. After you create the account, retrieve the AccessKey ID and AccessKey secret as described in the preceding step.

Step 3: Configure the endpoint-to-cloud connection

  1. Start IntelliJ IDEA.
  2. In the top menu bar, choose Tools > Alibaba Cloud > Preferences...
  3. In the Settings dialog box, choose Alibaba Cloud Toolkit > Microservice.
  4. On the Microservice page, configure the parameters for the endpoint-to-cloud connection.
    端云互联配置
    ParameterDescription
    Configuration granularityThe granularity at which the endpoint-to-cloud connection feature is used for the local project. Valid values are Project and Module.
    • Project: A unified endpoint-to-cloud connection configuration is used for the current project. This option is suitable for single-module projects or for multi-module projects where modules do not have different configuration requirements.
    • Module: The current project contains multiple modules, and only a specific module requires the endpoint-to-cloud connection, or different modules have different configuration requirements. To configure connections for different modules, select a specific module and complete its configuration.
    Endpoint-to-cloud connectionSelect Endpoint-to-cloud connection to enable this feature.

    After you enable this feature, the local application is registered with the cloud registry and subscribes to services from the cloud registry by default. Services in the local application and cloud services can call each other.

    If you only need to call cloud services and do not want cloud services to call local services, select Only subscribe to cloud services, do not register local services.

    ProductSelect Enterprise Distributed Application Service (EDAS).
    Endpoint-to-cloud connection environmentSet the region and namespace where the cloud application that you want to call resides. For applications in namespaces other than the default namespace, you must manually enable Allow Remote Debugging by performing the following steps.
    1. Log on to the EDAS console.
    2. In the navigation pane on the left, choose Application Management > Namespaces. In the top menu bar, select a region.
    3. In the list of namespaces, find the target namespace and click Edit in the Actions column.
    4. In the Edit Namespace dialog box, turn on the Allow Remote Debugging switch.
    Spring Cloud service portIf your application is a Spring Cloud application, enter its service port in the Spring Cloud service port text box. This parameter is not required for other types of applications.
    Jump server configuration
    • Jump Server IP: The Public IP of your jump server (ECS instance).
    • Jump Server Account: Enter the username to establish the endpoint-to-cloud connection channel.
    • Jump Server Password: Enter the password to establish the endpoint-to-cloud connection channel.
    Note You can enter the username and password of the ECS instance used for the connection channel. Alternatively, you can enter a new username and password, and then click Init Account... below to configure them.
    Init Account...
    • If you enter the root username and password of the ECS instance, this root account is used for configuration. If the configuration is successful, a message appears that indicates the configuration is added.
    • If you use a new account or another non-root account, root permissions are required to configure the proxy for this account. In the Add SSH Rule dialog box, enter the Password and click Add.
      Important
      • The password of the ECS instance is used only to create a network proxy. The username and password of the ECS instance are not used for other purposes.
      • We recommend that you use a new account or another non-root account for the connection. You can share this new or non-root account with other team members who need to use the endpoint-to-cloud connection feature. This avoids leaking root information.
    Quick diagnostics

    If you encounter issues during the endpoint-to-cloud connection process, click Quick Diagnostics to troubleshoot problems such as etrans channel startup abnormal and service connection failed.

  5. Click Apply, and then click OK.
    Important If you use EDAS on Apsara Stack Enterprise Edition, you must also configure the Endpoint in Cloud Toolkit as follows. To retrieve the Endpoint, contact EDAS technical support.
    1. In the navigation pane on the left of the Preference (Filtered) dialog box, choose Appearance & Behavior > Endpoint.
    2. On the Endpoint page, set the Endpoint. After the configuration is complete, click Apply and Close.

Step 4: Start the local application to connect to the cloud

Start the local application. If the application is connected to the cloud, the following message appears:

启动本地应用进行端云互联

After the application starts, an etrans process also starts:

启动etrans的进程
Note

If you encounter issues during the endpoint-to-cloud connection process, click Quick Diagnostics to troubleshoot problems such as etrans channel startup abnormal and service connection failed.

More information