LakeFormation Authorization for FlinkJob
Before submitting a job to the FlinkJob endpoint, use an agency to grant the user the required fine-grained IAM permissions and SQL resource permissions (covering metadata, databases, tables, columns, and functions) for LakeFormation so that the job can access the required data when running in the Flink cluster. This section describes how to configure LakeFormation authorization for FlinkJob.
Authorization Operations
To use LakeFormation resources, you must complete both LakeFormation API authorization and LakeFormation SQL resource authorization. For details about the required permissions for each SQL statement, see Paimon and Iceberg.
- Use an agency to authorize AI DataLake to call LakeFormation APIs.
Before using FlinkJob to run a job, you must create the required agency on the IAM console and select it when configuring the job. For examples of agency permissions, see Creating a Custom Agency.
When an agency is used and the operator is AI DataLake itself, AI DataLake must obtain a temporary credential to access resources on your behalf.
Dependencies
- Temporary credentials are created and stored in DEW. For details about how to create a temporary credential, see Creating a Shared Secret.
- To access DEW, AI DataLake must also be authorized through an agency. For details about the permissions, see Table 1.
Table 1 Agency authorization for accessing DEW Description
Permission
Permission to call the ShowSecretVersion API to retrieve the secret version and its value in DEW
csms:secretVersion:get
Permission to call the ListSecretVersions API to retrieve the list of secret versions in DEW
csms:secretVersion:list
Permission to decrypt secrets in DEW
kms:dek:decrypt
Methods for obtaining temporary credentials:
- (Recommended) Obtain a temporary credential.
Temporary security credentials include a temporary AK/SK and a security token. They are generated dynamically, are valid for a short period, and expire automatically, so you do not need to manage them manually. An agency works with temporary credentials to access services. Because the credentials expire after the validity period, they reduce the risk of key leakage and remove the need for complex key maintenance. This makes temporary credentials a good choice for automated batch processing and high-security services. For more information, see Temporary Security Credentials.
For related operation guidance, see Obtaining Temporary Credentials of a Flink Job Agency to Access Other Cloud Services.
- Obtain a temporary credential for accessing DEW, and then obtain a permanent AK/SK.
This approach provides reliable authentication for services that support only fine-grained authorization (version 1.1) and for services that require stable credentials that do not need frequent updates.
This approach obtains a temporary credential for accessing DEW through an agency, then gets a permanent AK/SK from DEW, and finally uses the AK/SK to securely access other cloud services.
For related operation guidance, see Using DEW to Manage Access Credentials in Flink SQL and Using DEW to Acquire Access Credentials for OBS Read and Write in Flink JAR.
- LakeFormation SQL resource authorization: Grant permissions to specific LakeFormation resources.
LakeFormation resource authorization grants users permissions for specific resources (such as metadata, databases, tables, columns, and functions) to control access to LakeFormation data and metadata.
Grant permissions to resources on the LakeFormation console. FlinkJob supports two principal types: roles and agencies.
For details about LakeFormation SQL resource permissions, see Configuring LakeFormation Metadata Permissions.
SQL Authentication
- In addition to the permissions listed in the table, you must also configure the lakeformation:policy:describe permission in IAM.
- By default, Flink verifies the default database. Therefore, before executing any SQL statements, you must grant the DESCRIBE permission on the default database under the target catalog on the LakeFormation console. For details, see Configuring LakeFormation Metadata Permissions.
- You are advised not to grant the lakeformation:policy:create permission. Granting this permission treats the user as an administrator, causing SQL authentication to be bypassed entirely.
| Type | SQL Statement | LakeFormation SQL Resource Authentication Permission | IAM Permission |
|---|---|---|---|
| SQL DDL | CREATE DATABASE | database:DESCRIBE catalog:CREATE_DATABASE catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:database:create" "lakeformation:catalog:describe" |
| CREATE TABLE my_table | database:DESCRIBE database:CREATE_TABLE table:DESCRIBE catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:create" "lakeformation:catalog:describe" | |
| Create Table As Select | table:DESCRIBE table:INSERT table:SELECT table:ALTER database:CREATE_TABLE database:DESCRIBE catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:create" "lakeformation:table:alter" "lakeformation:catalog:describe" | |
| Create Table Like | table:DESCRIBE table:INSERT database:CREATE_TABLE database:DESCRIBE catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:create" "lakeformation:catalog:describe" | |
| ALTER TABLE my_table SET (key1=val1); | database:DESCRIBE table:DESCRIBE table:ALTER catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:alter" "lakeformation:catalog:describe" | |
| ALTER TABLE my_table RESET (key1=val1); | database:DESCRIBE table:DESCRIBE table:ALTER catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:alter" "lakeformation:catalog:describe" | |
| ALTER TABLE my_table RENAME TO my_table_new; | database:DESCRIBE table:DESCRIBE table:ALTER catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:alter" "lakeformation:catalog:describe" | |
| ALTER TABLE my_table ADD (c1 INT, c2 STRING); | database:DESCRIBE table:DESCRIBE table:ALTER catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:alter" "lakeformation:catalog:describe" | |
| ALTER TABLE my_table RENAME c0 TO c1; | database:DESCRIBE table:DESCRIBE table:ALTER catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:alter" "lakeformation:catalog:describe" | |
| ALTER TABLE my_table DROP (c1, c2); | database:DESCRIBE table:DESCRIBE table:ALTER catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:alter" "lakeformation:catalog:describe" | |
| ALTER TABLE my_table MODIFY buy_count BIGINT COMMENT ''; | database:DESCRIBE table:DESCRIBE table:ALTER catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:alter" "lakeformation:catalog:describe" | |
| ALTER TABLE my_table ADD c INT AFTER b; | database:DESCRIBE table:DESCRIBE table:ALTER catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:alter" "lakeformation:catalog:describe" | |
| ALTER TABLE my_table MODIFY col_a DOUBLE AFTER col_b; | database:DESCRIBE table:DESCRIBE table:ALTER catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:alter" "lakeformation:catalog:describe" | |
| ALTER TABLE my_table MODIFY col_a DOUBLE; | database:DESCRIBE table:DESCRIBE table:ALTER catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:alter" "lakeformation:catalog:describe" | |
| ALTER DATABASE [catalog_name.]db_name SET (key1=val1, key2=val2, ...); | database:DESCRIBE database:ALTER catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:database:alter" "lakeformation:catalog:describe" | |
| SQL DML | INSERT INTO my_table SELECT ... | table:DESCRIBE table:ALTER table:SELECT database:DESCRIBE catalog:DESCRIBE | "lakeformation:table:describe", "lakeformation:table:alter", "lakeformation:database:describe" "lakeformation:catalog:describe" |
| Auxiliary statements | DESCRIBE TABLE | database:DESCRIBE table:DESCRIBE catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe" "lakeformation:catalog:describe" |
| SHOW DATABASES | catalog:LIST_DATABASE database:DESCRIBE catalog:DESCRIBE | "lakeformation:database:describe" "lakeformation:catalog:describe" | |
| SHOW CURRENT DATABASE | catalog:LIST_DATABASE database:DESCRIBE catalog:DESCRIBE | "lakeformation:database:describe" "lakeformation:catalog:describe" | |
| SHOW CREATE TABLE | database:DESCRIBE table:DESCRIBE catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe" "lakeformation:catalog:describe" | |
| SHOW COLUMNS | database:DESCRIBE table:DESCRIBE catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe" "lakeformation:catalog:describe" | |
| SHOW PARTITIONS | database:DESCRIBE table:DESCRIBE catalog:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe" "lakeformation:catalog:describe" |
| Type | SQL Statement | LakeFormation SQL Resource Authentication Permission | IAM Permission |
|---|---|---|---|
| SQL DDL | CREATE DATABASE | database:DESCRIBE catalog:CREATE_DATABASE | "lakeformation:database:describe", "lakeformation:database:create" |
| CREATE TABLE my_table | database:DESCRIBE database:CREATE_TABLE table:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:create" | |
| Create Table Like | table:DESCRIBE table:INSERT database:CREATE_TABLE database:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:create" | |
| DROP DATABASE | database:DESCRIBE database:DROP | "lakeformation:database:describe", "lakeformation:database:drop" | |
| DROP TABLE | database:DESCRIBE table:DESCRIBE table:DROP | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:drop" | |
| ALTER TABLE | database:DESCRIBE table:DESCRIBE table:ALTER | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:alter" | |
| ALTER TABLE .. RENAME TO | database:DESCRIBE database:CREATE_TABLE table:DESCRIBE table:ALTER | "lakeformation:database:describe", "lakeformation:table:describe", "lakeformation:table:alter" "lakeformation:table:create" | |
| SQL DML | INSERT INTO my_table SELECT ... | table:DESCRIBE table:ALTER table:SELECT database:DESCRIBE | "lakeformation:table:describe", "lakeformation:table:alter", "lakeformation:database:describe" |
| INSERT OVERWRITE my_table SELECT ... | table:DESCRIBE table:ALTER table:UPDATE database:DESCRIBE | "lakeformation:table:describe", "lakeformation:table:alter", "lakeformation:database:describe" | |
| Auxiliary statements | DESCRIBE TABLE | database:DESCRIBE table:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe" |
| SHOW DATABASES | catalog:LIST_DATABASE database:DESCRIBE | "lakeformation:database:describe" | |
| SHOW CURRENT DATABASE | catalog:LIST_DATABASE database:DESCRIBE | "lakeformation:database:describe" | |
| SHOW CREATE TABLE | database:DESCRIBE table:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe" | |
| SHOW TABLES | database:LIST_TABLE database:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe" | |
| SHOW COLUMNS | database:DESCRIBE table:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe" | |
| SHOW PARTITIONS | database:DESCRIBE table:DESCRIBE | "lakeformation:database:describe", "lakeformation:table:describe" |
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot