Realtime Compute for Apache Flink provides the Visual Studio Code extension to help you develop, deploy, and manage SQL, JAR, and Python jobs in an on-premises environment. You can also use the extension to synchronize updated deployment configurations from the development console of Realtime Compute for Apache Flink. This topic describes how to use the Visual Studio Code extension.
Prerequisites
A workspace is created. For more information, see Activate Realtime Compute for Apache Flink.
An AccessKey ID and an AccessKey secret are obtained and the permissions related to the namespace you want to use are granted. For more information, see How do I view information about the AccessKey ID and AccessKey secret of the account? and Authorize an account to perform operations in a namespace.
Visual Studio Code 1.74.0 or later is installed. For more information, visit the Visual Studio Code website.
Limits
The extension does not support log configuration.
The extension cannot synchronize deployments created in the development console of Realtime Compute for Apache Flink.
Install and configure the extension
Download and install the extension.
Method 1: Go to the Visual Studio Code Marketplace page and click Install.
Method 2:
Open Visual Studio Code on your computer. In the left-side navigation pane, click EXTENSIONS.
Enter Flink Realtime Compute Studio in the search box.
Find the matched extension and click Install.
In the top navigation bar, choose
and select the folder you want to use.Configure the AccessKey pair.
Configure only for the current folder
In the left-side navigation pane, click . In the Configure AK&SK section, click Configure in a .vvprc file. The extension automatically creates a file suffixed with
.vvprc
.Open the created file and add the following configurations:
{ "accessKey": "xxx", "secretKey": "xxx", "namespace": "xxx", "workspace": "xxx", "regionId" : "xxx" }
Parameter
Description
References
accessKey
The AccessKey ID of your Alibaba Cloud account.
How do I view information about the AccessKey ID and AccessKey secret of the account?
secretKey
The AccessKey secret of your Alibaba Cloud account.
namespace
The name of the Realtime Compute for Apache Flink namespace you want to use.
workspace
The ID of the Realtime Compute for Apache Flink workspace you want to use.
How do I view information about a workspace, such as the workspace ID?
regionId
The ID of the region in which the workspace is created.
Configure for the current workspace or user
In the left-side navigation pane, click .
In the Configure AK&SK section, click Configure in global user settings to open the Settings editor in Visual Studio Code.
Select the User or Workspace tab based on your business requirements.
NoteWe recommend that you select the User tab. This way, the parameter configurations apply to all projects and workspaces in Visual Studio Code.
Parameter
Description
References
Access Key
The AccessKey ID of your Alibaba Cloud account.
How do I view information about the AccessKey ID and AccessKey secret of the account?
Secret Key
The AccessKey secret of your Alibaba Cloud account.
How do I view information about the AccessKey ID and AccessKey secret of the account?
Namespace
The name of the Realtime Compute for Apache Flink namespace you want to use.
Workspace
The ID of the Realtime Compute for Apache Flink workspace you want to use.
How do I view information about a workspace, such as the workspace ID?
Region ID
The ID of the region in which the workspace is created.
NoteConfiguration precedence: Current-folder configuration > Workspace configuration > User configuration.
After the configurations take effect, the name of the Realtime Compute for Apache Flink namespace is displayed in the status bar in the lower part of the code editor.
(Optional) Install the following extensions to improve coding efficiency:
Flink SQL Language Features: supports the syntax of Apache Flink SQL.
YAML VS Code: provides inline code completions for configurations related to Realtime Compute for Apache Flink.
Use the extension
Step 1: Create a deployment
Method 1: In the left-side navigation pane, click . In the QUICK START section, click Create a new deployment. In the top navigation bar, enter a name and press the Enter key to create a file suffixed with
.vvp
. The file includes pre-populated deployment configurations.Method 2: Create a file suffixed with
.vvp
in the current folder. The file includes pre-populated deployment configurations.
Step 2: Configure the deployment
You can configure the deployment in the form view.
If you are familiar with the parameters, you can also click Raw File in the upper left corner to configure the deployment in the raw file view. You can click the name of a field in the form to quickly locate the corresponding parameter in the raw file.
Basic: This section includes basic deployment parameters.
Resources: For information about the parameters in this section, see Configure resources for a deployment.
Parameters: For information about the parameters in this section, see Parameters section.
Step 3: Submit the deployment
Click Create in the lower part of the editor to submit the deployment. If you update an existing deployment, click Update to submit the updated deployment.
If you submit a SQL deployment, the extension checks the SQL script, resource plan, and other configurations and generates the check result.
Step 4: Start the deployment
After you submit a deployment, the latest status of the deployment is displayed in the upper right corner. Click Start and select a startup mode. For more information about startup modes, see Procedure.
Step 5: Manage the deployment
To view the detailed running status or perform O&M operations, click Open Online in the upper-left corner to go to the Deployments page in the development console of Realtime Compute for Apache Flink.
To quickly synchronize a deployment, click Synchronize to open the preview page, confirm the configurations on the preview page, and then click
Accept
in the upper right corner. This allows the extension to overwrite the configurations by using those from the development console of Realtime Compute for Apache Flink. Take note that the preview page does not display the SQL script updates you perform in the console.To cancel a deployment, click Cancel in the upper right corner.
References
For information about the connectors supported by Realtime Compute for Apache Flink, see Supported connectors.
For information about how to develop and debug a JAR deployment, see Develop a JAR draft.
For information about how to develop and debug a Python deployment, see Develop a Python API draft.
For information about how to improve the performance of SQL deployments, see Optimize Flink SQL.