Updated on 2026-11-06 GMT+08:00

Creating a Custom Agency

During job development, if you need to access external services (such as OBS for data upload or download), configure the corresponding permission agency when creating an endpoint. The agency is a prerequisite for accessing external services and must be created and configured by users.

This section describes how to create a custom agency, authorize services, and add the new agency to the job configuration.

You can control the permissions of the agency used by an endpoint. A custom minimum permission policy should be used to reduce the risk of unauthorized operations and meet security compliance requirements.

Notes and Constraints

When creating a custom agency, do not set the agency name to ai_datalake_admin_trust.

Step 1: Create an Agency and Assign Permissions

  1. Sign in to the IAM console.
  2. In the upper-right corner of the page, hover over the username and select Identity and Access Management from the drop-down menu.
  3. Create an agency.
    1. In the left navigation pane, choose Agencies.
    2. On the Agencies page, click Create Agency.
    3. On the Create Agency page, configure the key parameters as follows:
      • Agency Name: Enter a name for the agency, for example, aidatalake_obs_agency_access.
      • Agency Type: Select Cloud service.
      • Cloud Service: Search for AI DataLake.
      • Validity Period: Specify the maximum session duration for temporary access credentials obtained through programmatic access. For example, select Unlimited.

      For more information about the parameters, see Creating a Trust Agency and Assigning Permissions.

    4. After configuring the agency parameters, click OK.
  4. Create a policy and assign permissions.
    1. In the Agency Created dialog box, click Authorize.
    2. In the upper right corner of the Authorize Agency page, click Create Policy.
    3. Configure policy information.
      1. Enter a policy name, for example, aidatalake-obs-agency.
      2. Select JSON for Policy View.
      3. In the Policy Content area, paste a custom policy. For details, see Agency Permission Policies for Common Scenarios.
      4. Enter a description for the policy, if required.
    4. Click Next.
    5. Select the new custom policy, click Next, and then click OK.

Step 2: Configure Agency Permissions for a Job

  • Aura: When creating a session API using AuraJobV2, you can pass the name of the created agency through the agency_name field in the request. The system automatically obtains a temporary credential based on the agency for job running.
  • Ray, Spark, and Flink: Select the corresponding agency when creating an endpoint.

Configuring an AuraJobV2 Agency

  • After a session is created, the agency cannot be changed. To change the agency, create a session again.
  • After modifying agency permissions, wait several minutes for the changes to take effect.
  1. Use an API tool, such as Postman, to call the API to create a session.

    For details about calling APIs, see Calling APIs.

    An example request is as follows:

    POST /v2/workspaces/{workspace_id}/aura-sessions
    
    {
      "endpoint_name" : "aura-job-iqr0",
      "catalog_context" : {
        "catalog_name" : "aurasql_default",
        "agency_name": "aidatalake_obs_agency_access"
      }
    }

    Table 1 describes the parameters. For more information, see Creating a Session.

    Table 1 Parameter description

    Parameter

    Description

    Example Value

    workspace_id

    The ID of the workspace.

    302ce559-9759-4586-9885-90d6c0b4****

    endpoint_name

    The name of the Aura endpoint.

    aura-job-iqr0

    catalog_name

    The name of the LakeFormation catalog.

    aurasql_default

    agency_name

    Enter the agency name created in Step 1: Create an Agency and Assign Permissions.

    aidatalake_obs_agency_access

  2. If a response similar to the following is returned, the session has been successfully created:
    {
      "session_id" : "ac8111bf-3601-4905-8ddd-b41d3e63****",
      "status" : "RUNNING"
    }

Configuring a Ray Agency

When creating a RayCluster or RayJob endpoint, configure the History Server storage agency and endpoint agency.

  1. Log in to the AI DataLake console.
  2. In the upper left corner of the page, select the target workspace.
  3. In the left navigation pane, choose Engine Endpoints > Ray. The Ray engine endpoint list appears.
  4. Click Create Endpoint in the upper right corner of the page and configure the endpoint settings. For details, see Creating a Ray Engine Endpoint.

Configuring a Spark Agency

When creating a SparkSQL or SparkJob endpoint, select the new agency in the Storage Settings or Job Agency Settings area.

After assigning an agency to a job, proceed with caution when modifying agency permissions. Changes to these permissions may affect the normal operation of the job.

  1. Log in to the AI DataLake console.
  2. In the upper left corner of the page, select the target workspace.
  3. In the left navigation pane, choose Engine Endpoints > Spark. The Spark engine endpoint list appears.
  4. In the upper right corner of the page, click Create Endpoint.
  5. Configure the basic information for the endpoint. For details, see Creating a Spark Engine Endpoint.
  6. Configure agency parameters.

    Agency: Select the agency created in Step 1: Create an Agency and Assign Permissions.

    • SparkSQL endpoint: In the Storage Settings area, select the target agency.
    • SparkJob endpoint: In the Storage Settings and Job Agency Settings areas, select the target agency.

Configuring a Flink Agency

When creating a FlinkJob endpoint, select the new agency in the Storage Settings and Job Agency Settings areas.

After assigning an agency to a job, proceed with caution when modifying agency permissions. Changes to these permissions may affect the normal operation of the job.

  1. Log in to the AI DataLake console.
  2. In the upper left corner of the page, select the target workspace.
  3. In the left navigation pane, choose Engine Endpoints > Flink. The Flink engine endpoint list appears.
  4. In the upper right corner of the page, click Create Endpoint.
  5. Configure the basic information for the endpoint. For details, see Creating a Flink Engine Endpoint.
  6. In the Storage Settings and Job Agency Settings areas, select the target agency.

    Agency: Select the agency created in Step 1: Create an Agency and Assign Permissions.