The Realtime Compute for Apache Flink VS Code extension streamlines the local Flink job development process. Use it to develop, deploy, and manage SQL, JAR, and Python jobs, and to synchronize job configurations from the cloud. This topic explains how to use the extension.
Prerequisites
-
You have an AccessKey ID and an AccessKey Secret. The AccessKey must have the required permissions for the target namespace. For more information, see How do I obtain an AccessKey ID and AccessKey Secret? and Grant permissions in the Development Console.
-
You have installed VS Code v1.74.0 or later. If not, download it from the official VS Code website.
Limitations
-
Log configuration is not supported.
-
The extension does not support pulling existing jobs from the cloud.
Install and configure the extension
-
Download and install the extension.
-
Method 1: Go to the VS Code Marketplace and click Install.
-
Method 2:
-
Open VS Code and click EXTENSIONS in the left-side navigation pane.
-
In the search bar, search for the Flink Realtime Compute Studio extension.
-
Click Install.
-
-
-
In the top menu bar, click and select a local folder.
-
Configure your AccessKey information.
Current workspace
-
In the left-side navigation pane, click the
icon. In the Configure AK&SK section, click Configure in a .vvprc file. The extension automatically creates a file with the .vvprcextension. -
Add the following configuration to the file:
{ "accessKey": "xxx", "secretKey": "xxx", "namespace": "xxx", "workspace": "xxx", "regionId" : "xxx" }Parameter
Description
Notes
accessKey
The AccessKey ID of your Alibaba Cloud account.
For more information, see How do I obtain an AccessKey ID and AccessKey Secret?
secretKey
The AccessKey Secret of your Alibaba Cloud account.
namespace
The name of the Flink namespace.
For more information, see View and delete a namespace.
workspace
The ID of the Flink workspace.
For more information, see How do I view the workspace ID and other information?.
regionId
The region ID.
Find the region ID in Endpoints.
Global
-
In the left-side navigation pane, click the
icon. -
In the Configure AK&SK section, click Configure in global user settings. VS Code opens the global settings page.
Search for
flinkStudioand set the following fields: Flink Studio: Access Key, Flink Studio: Secret Key, Flink Studio: Namespace, Flink Studio: Region ID (default: cn-hangzhou), and Flink Studio: Workspace. -
As needed, select User or Workspace for configuration.
NoteWe recommend setting the scope to User, which applies the configuration to all projects. The Workspace scope applies the configuration only to the current workspace.
Parameter
Description
Notes
Access Key
The AccessKey ID of your Alibaba Cloud account.
For more information, see How do I obtain an AccessKey ID and AccessKey Secret?
Secret Key
The AccessKey Secret of your Alibaba Cloud account.
For more information, see How do I obtain an AccessKey ID and AccessKey Secret?
Namespace
The name of the Flink namespace.
For more information, see View and delete a namespace.
Workspace
The ID of the Flink workspace.
For more information, see How do I view the workspace ID and other information?.
Region ID
The region ID.
Find the region ID in Endpoints.
NoteConfiguration priority: Current folder > Parent folder > Global.
After you apply the configuration, the namespace name appears in the status bar at the bottom of the editor.
-
-
(Optional) You can install the following extensions for a better development experience.
-
Flink SQL: Install the Flink SQL Language Features extension. It provides a language service for Flink SQL and supports the complete Flink SQL syntax.
-
Flink configuration: We recommend installing the YAML VS Code extension, which provides auto-completion for Flink configurations.
-
Procedure
Step 1: Create a job
-
Method 1: In the left-side navigation pane, click the
icon. In the QUICK START section, click Create a new deployment. Enter a name at the top and press Enter to create a file with the .vvpextension. The extension generates a job with default fields. -
Method 2: Create a new file with the
.vvpextension directly in the file explorer. The extension populates the file with a default job configuration.
Step 2: Configure the job
You can configure the parameters directly in the UI form.
If you are familiar with job configuration, click Raw File in the upper-left corner to configure the job in the source file. Clicking a parameter name in the UI form navigates to its definition in the source file.
{
"name": "test",
"artifact": {
"kind": "SQLSCRIPT",
"sqlArtifact": {
"additionalDependencies": [],
"sqlScript": ""
}
},
"deploymentTarget": {
"mode": "PER_JOB",
"name": "default-queue"
},
...
}
-
Basic: Configure basic parameters.
-
Resources: For more information about job resource parameters, see Configure job resources.
-
Parameters: For more information about job running parameters, see Configure runtime parameters.
Step 3: Deploy the job
After you finish developing or configuring the job, click Create at the bottom to deploy a new job, or click Update to update and deploy an existing local job.
For SQL jobs, the extension validates the SQL script, resource plan, and other configurations, and then outputs the validation results.
Step 4: Start the job
For a deployed job, the latest status is displayed in the upper-right corner. You can click Start and select a startup mode. For more information about startup modes, see Start a job.
Step 5: Job O&M
After the job is deployed and running, a green RUNNING status appears in the action bar at the top of the editor. The Basic area displays key deployment information in a table, including Deployment ID, Deployment Name, Execution Mode, Engine Version (for example, vvr-8.0.7-flink-1.17), Deployment Target, and Deployment Type.
-
Open Online: Click Open Online to open the job O&M page in the Development Console, where you can view the running status and perform O&M operations.
-
Synchronize: Pulls the job configuration from the cloud. Clicking Synchronize opens a preview of the online configuration. Note: The preview does not include draft changes made to SQL jobs in the console. Click
Acceptto overwrite your local file with the online configuration. -
Cancel: Stops the running job.
Related documentation
-
For supported connectors, see Supported connectors.
-
For information about how to develop and debug Flink JAR jobs, see Develop a JAR job.
-
For information about how to develop and debug Flink Python jobs, see Develop a Python job.
-
To improve the performance of your Flink SQL jobs, see High-performance Flink SQL optimization techniques.