Connect to the cloud from your local machine using Cloud Toolkit (IntelliJ IDEA)

Updated at:

Cloud Toolkit is an efficient developer tool. In IntelliJ IDEA, its local-to-cloud connectivity feature lets you connect local applications to cloud applications. This enables them to call each other and improves development efficiency.

Prerequisites

Before you use Cloud Toolkit to connect to the cloud from your local machine, make sure that the following prerequisites are met:

  • IntelliJ IDEA 2018.3 or later is required.

  • This plugin supports Secure Shell (SSH)/SOCKS proxies and Kubernetes proxies. You must choose one of the two proxy types.

    • Use an SSH/SOCKS proxy: Set up an Elastic Compute Service (ECS) instance that you can log on to using SSH. This instance is used to establish a local-to-cloud connectivity channel. For more information, see Use an ECS instance in the console (quick start).

      Important
      • Make sure that the ECS instance and the application to be connected are in the same Virtual Private Cloud (VPC).

      • The SSH channel requires password authentication for logon. Logon using a key pair is not supported.

    • Use a Kubernetes proxy: Set up a Kubernetes cluster in the cloud, and install and configure the kubectl environment on your local machine to access the cluster. You can also use an existing Kubernetes cluster. For more information, see Create a managed Kubernetes cluster.

Limits

Java application limits

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

Microservice framework

Limits

Spring Cloud

If you use Nacos for configuration management, make sure your Spring Cloud version is Edgware or later.

Dubbo

  • Dubbo 2.7.2 or a later version.

  • Required versions for service registration and discovery components:

    • dubbo-nacos-registry 2.7.2 or a later version.

    • edas-dubbo-extension 2.0.2 or a later version.

HSF

None

Settings for applications in other languages

For applications written in other languages, you can use container mode. There are no special limits.

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 an Alibaba Cloud Toolkit account

After Alibaba Cloud Toolkit is installed, use your AccessKey ID and AccessKey secret to configure your Alibaba Cloud Toolkit account.

  1. Start IntelliJ IDEA.
  2. In the top navigation bar, choose Tools > Alibaba Cloud > Preferences....
  3. In the left-side navigation pane of the Settings page, choose Alibaba Cloud Toolkit > Appearance & Behavior > Accounts.
  4. On the Accounts page, set Access Key ID and Access Key Secret and click OK.

Step 3: Configure local-to-cloud connectivity

  1. Start IntelliJ IDEA.

  2. In the menu bar, choose Tools > Alibaba Cloud > Preferences....

  3. In the Settings dialog box, choose Alibaba Cloud Toolkit > Microservice > Microservice.

  4. In the Microservice dialog box, configure the parameters for local-to-cloud connectivity.

    EDAS端云互联

    Parameter

    Description

    Configuration granularity

    The granularity at which the local-to-cloud connectivity feature is used for the local project. Options include project and module.

    • (Recommended) Project: A single local-to-cloud connectivity configuration is used for the entire project. This is suitable for single-module projects or multi-module projects where modules do not have different configuration needs.

    • Module: The current project contains multiple modules. Use this option if only a specific module needs local-to-cloud connectivity, or if different modules require different configurations. To configure connectivity for different modules, select a specific module and complete its configuration.

    Local-to-cloud connectivity

    Select Local-to-cloud connectivity to enable the feature.

    When this feature is enabled, your local application is registered with the cloud registry center by default and subscribes to services from it. Services in your local application and cloud services can then call each other.

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

    Product

    Select Enterprise Distributed Application Service (EDAS).

    Cloud connectivity environment

    Set the region and namespace where the cloud application you want to call is located. For applications in namespaces other than the default one, you must manually enable the Allow Remote Debugging switch.

    1. Log on to the EDAS console.

    2. In the navigation pane on the left, choose Resource Management > Microservices Namespace. In the top menu bar, select a region.

    3. In the namespace list, 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.

    Local service owner application

    Select the microservice application that EDAS starts on your local machine.

    Local Spring Cloud service port

    If your application is a Spring Cloud application, enter its service port in the Spring Cloud service port text box. You do not need to fill in this field for other types of applications.

    Proxy

    Select a proxy machine. For more information about proxy configuration, see Configure a proxy.

    Initialize proxy...

    • This operation is not required for Kubernetes proxies.

    • This operation is required for SSH/SOCKS proxies to configure SSH rules and enable local-to-cloud connectivity.

    Note

    If the last-level SSH proxy in the proxy list is not a root account, you are prompted to provide root permissions for configuration. After the configuration is complete, you can use the feature. If you do not want the plugin to configure the proxy for you, you can configure it manually. For more information about how to manually initialize a proxy, see Configure a proxy.

    Join end-to-end traffic adjustment

    Select Join end-to-end traffic adjustment and select a grayscale group for the local service to control the request flow.

    Note

    End-to-end traffic adjustment is a core feature of EDAS that provides fine-grained control over service traffic. With this feature, you can develop multiple features in the same development environment without interference.

    Advanced configuration

    Select Automatically close startup prompt to set the duration for which the application startup prompt is displayed. The unit is milliseconds.

    Quick diagnostics

    If you encounter issues during local-to-cloud connectivity, click Quick diagnostics to troubleshoot problems such as etrans channel startup failures and service connection failures.

  5. Click Apply, and then click OK.

    Important

    If you use EDAS on Apsara Stack Enterprise Edition, you must configure an Endpoint in Cloud Toolkit. To obtain the Endpoint, contact EDAS technical support.

    1. In the Preferences (Filtered) dialog box, choose Appearance & Behavior > Endpoint from the navigation pane on the left.

    2. In the Endpoint dialog box, enter the Endpoint. After the configuration is complete, click Apply and Close.

Step 4: Use local process mode for local-to-cloud connectivity

Start the local application. If local-to-cloud connectivity is active, the following prompt appears.

image

After the application starts, an etrans process is started.

启动etrans的进程

Step 5: Stop local-to-cloud connectivity

When you stop or restart the application, you must first stop the original etrans process. Click the 方框 icon in the toolbar to stop both the application and the etrans process, as shown in the following figure.

Note

If you restart the application before you stop the original etrans process, local-to-cloud connectivity for the new application instance will not take effect. A successful connection is indicated by the Local-to-cloud connectivity enabled dialog box that appears when you start the application.

More information