Halaman ini belum tersedia dalam bahasa lokal Anda. Kami berusaha keras untuk menambahkan lebih banyak versi bahasa. Terima kasih atas dukungan Anda.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Data Lake Insight/ Developer Guide/ Flink Jobs/ Flink Job Agencies/ Flink OpenSource SQL Jobs Using DEW to Manage Access Credentials

Flink OpenSource SQL Jobs Using DEW to Manage Access Credentials

Updated on 2024-04-07 GMT+08:00

Scenario

When DLI writes the output data of Flink jobs to MySQL or GaussDB(DWS), you need to set attributes such as the username and password in the connector. However, information such as usernames and passwords is highly sensitive and needs to be encrypted to ensure user data privacy.

Data Encryption Workshop (DEW) and Cloud Secret Management Service (CSMS) joint form a secure, reliable, and easy-to-use privacy data encryption and decryption solution.

Users or applications can use CSMS to create, retrieve, update, and delete credentials in a unified manner throughout the secret lifecycle. CSMS can help you eliminate risks incurred by hardcoding, plaintext configuration, and permission abuse.

This section walks you through on how to use DEW to manage access credentials for Flink OpenSource SQL jobs.

Prerequisites

  • A shared secret has been created on the DEW console and the secret value has been stored. For details, see Creating a Shared Secret.
  • An agency has been created and authorized for DLI to access DEW. The agency must have been granted the following permissions:
    • Permission of the ShowSecretVersion interface for querying secret versions and secret values in DEW: csms:secretVersion:get.
    • Permission of the ListSecretVersions interface for listing secret versions in DEW: csms:secretVersion:list.
    • Permission to decrypt DEW secrets: kms:dek:decrypt

    For details about agency permission examples, see Customizing DLI Agency Permissions and Agency Permission Policies in Common Scenarios.

  • DEW can be used to manage access credentials only in Flink 1.15. When creating a Flink job, select version 1.15 and configure the information of the agency that allows DLI to access DEW for the job.
  • On the DLI management console, create an enhanced datasource connection and configure the network connection between DLI and the data source.

    For details, see Enhanced Datasource Connections.

Syntax

create table tableName(
  attr_name attr_type 
  (',' attr_name attr_type)* 
  (',' WATERMARK FOR rowtime_column_name AS watermark-strategy_expression)
)
with (
   ...
  'dew.endpoint'='',
  'dew.csms.secretName'='',
  'dew.csms.decrypt.fields'='',
  'dew.projectId'='',
  'dew.csms.version'=''
  
);

Parameter Description

Table 1 Parameters

Parameter

Mandatory

Default Value

Data Type

Description

dew.endpoint

Yes

None

String

Endpoint of the DEW service to be used.

See Regions and Endpoints.

Configuration example: 'dew.endpoint'='kms.cn-xxxx.myhuaweicloud.com'

dew.projectId

No

Yes

String

ID of the project DEW belongs to. The default value is the ID of the project where the Flink job is.

See Obtaining a Project ID.

dew.csms.secretName

Yes

None

String

Name of the shared secret in DEW's secret management.

Configuration example: 'dew.csms.secretName'='secretInfo'

dew.csms.decrypt.fields

Yes

None

String

Specify which fields in the connector with attribute need to be decrypted using DEW's CSMS. Separate the field attributes with commas, for example, 'dew.csms.decrypt.fields'='field1,field2,field3'

dew.csms.version

No

Latest version

String

Version number (certificate version identifier) of the shared secret in DEW's secret management.

If not specified, the latest version of the shared secret is obtained by default.

Configuration example: 'dew.csms.version'='v1'

Example

This example demonstrates how to configure Flink OpenSource SQL to manage access credentials using DEW by generating random data through a DataGen table and outputting it to a MySQL result table.

  1. Create an enhanced datasource connection between DLI and MySQL.
  2. Create an agency for DLI to access DEW and complete authorization. For details, see Customizing DLI Agency Permissions.
  3. Create a shared secret in DEW. For details, see Creating a Shared Secret.
    1. Log in to the DEW management console.
    2. In the navigation pane on the left, choose Cloud Secret Management Service > Secrets.
    3. On the displayed page, click Create Secret. Set basic secret information.
    4. In this example, the MySQL credential value is configured as follows:
      • "MySQLUsername":"demo"
      • "MySQLPassword":"*******", where ******* indicates the password for accessing the MySQL database.
  4. Enter a SQL statement in the editing pane. The following is an example:
    create table dataGenSource(
      user_id string,
      amount int
    ) with (
      'connector' = 'datagen',
      'rows-per-second' = '1', --Generate a piece of data per second.
      'fields.user_id.kind' = 'random', --Specify a random generator for the user_id field.
      'fields.user_id.length' = '3' --Limit the length of user_id to 3.
    );
    
    CREATE TABLE jdbcSink ( 
      user_id string,
      amount int
     ) 
    WITH (  
     'connector' = 'jdbc',  
      'url? = 'jdbc:mysql://MySQLAddress:MySQLPort/flink',--flink is the MySQL database where the orders table locates.
     'table-name' = 'orders',  
     'username' = 'MySQLUsername',  -- Shared secret in DEW whose name is secretInfo and version is v1. The key MySQLUsername defines the secret value. The value is the user's sensitive information.
     'password' = 'MySQLPassword',  -- Shared secret in DEW whose name is secretInfo and version is v1. The key MySQLPassword defines the secret value. The value is the user's sensitive information.
     'sink.buffer-flush.max-rows' = '1',
     'dew.endpoint'='kms.cn-xxxx.myhuaweicloud.com', --Endpoint information for the DEW service being used
     'dew.csms.secretName'='secretInfo', --Name of the DEW shared secret
     'dew.csms.decrypt.fields'='username,password', --The password field value must be decrypted and replaced using DEW secret management.
     'dew.csms.version'='v1'
    );
    
    insert into jdbcSink select * from dataGenSOurce;

Kami menggunakan cookie untuk meningkatkan kualitas situs kami dan pengalaman Anda. Dengan melanjutkan penelusuran di situs kami berarti Anda menerima kebijakan cookie kami. Cari tahu selengkapnya

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback