Access control

Updated at:

This topic describes the RAM-based access control system of DataHub.

DataHub uses Resource Access Management (RAM) to authenticate access to its resources. An Alibaba Cloud account (primary account) has all permissions on the DataHub resources that it owns. RAM users (subaccounts) have no permissions by default when they are created. Access to DataHub resources requires the corresponding permissions to be granted in RAM.

For information about creating RAM users, creating permission policies, and granting permissions, see the RAM documentation.

System policies

System policies are predefined. A corresponding policy can be attached directly to a RAM user if it meets the requirements.

Policy name

Permissions

AliyunDataHubFullAccess

This policy grants all permissions on DataHub to RAM users. In most cases, this policy is used to manage resources in DataHub.

AliyunDataHubReadOnlyAccess

This policy grants read-only permissions on DataHub to RAM users so that the RAM users can query the information about all resources in DataHub. For example, this policy can be used to query the information about a project, view the project list, or read data. However, this policy cannot be used to update, create, or write data.

AliyunDataHubSubscribeAccess

This policy grants RAM users the permissions to subscribe to data in DataHub. This policy can be used to call only the API operations required for data reads, including GetTopic, ListShard, GetRecords, and all operations related to subscriptions and offsets.

AliyunDataHubPublishAccess

This policy grants RAM users the permissions to publish data to DataHub. This policy can be used to call only the API operations required for data writes, including GetTopic, ListShard, and PutRecords.

Custom policies

Custom policies can be created if the system policies do not meet the requirements. In a policy, Action specifies the operations, Resource specifies the resources, and Effect specifies whether to allow or deny these operations. The optional Condition field can be used to further restrict access by specifying conditions. The following sections describe DataHub resource descriptions, authorized operations, and supported condition keys.

Authorized resources (Resource)

DataHub supports RAM authorization for resources such as projects, topics, subscriptions, and connectors. Shard operations are authorized against the topic to which the shards belong. Independent shard-level authorization is not supported.

Resource type

Resource description in RAM

Project

acs:dhs:$region:$accountid:projects/$projectName

Topic

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName

Subscription

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName/subscriptions/$subId

Connector

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName/connectors/*

Authorized operations (Action) and corresponding resources

Project

API operation

Action

Resource description

CreateProject

dhs:CreateProject

acs:dhs:$region:$accountid:projects/*

ListProject

dhs:ListProject

acs:dhs:$region:$accountid:projects/*

DeleteProject

dhs:DeleteProject

acs:dhs:$region:$accountid:projects/$projectName

GetProject

dhs:GetProject

acs:dhs:$region:$accountid:projects/$projectName

Topic

API operation

Action

Resource description

CreateTopic

dhs:CreateTopic

acs:dhs:$region:$accountid:projects/$projectName/topics/*

ListTopic

dhs:ListTopic

acs:dhs:$region:$accountid:projects/$projectName/topics/*

DeleteTopic

dhs:DeleteTopic

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName

GetTopic

dhs:GetTopic

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName

UpdateTopic

dhs:UpdateTopic

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName

Subscription

API operation

Action

Resource description

CreateSubscription

dhs:CreateSubscription

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName/subscriptions/*

DeleteSubscription

dhs:DeleteSubscription

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName/subscriptions/$subId

GetSubscription

dhs:GetSubscription

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName/subscriptions/$subId

UpdateSubscription

dhs:UpdateSubscription

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName/subscriptions/$subId

ListSubscription

dhs:ListSubscription

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName/subscriptions/*

CommitOffset

dhs:GetSubscription

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName/subscriptions/$subId

GetOffset

dhs:GetSubscription

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName/subscriptions/$subId

Connector

API operation

Action

Resource description

CreateConnector

dhs:CreateConnector

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName/connectors/*

DeleteConnector

dhs:DeleteConnector

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName/connectors/*

GetConnector

dhs:GetConnector

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName/connectors/*

UpdateConnector

dhs:UpdateConnector

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName/connectors/*

ListConnector

dhs:ListConnector

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName/connectors/*

Shard

Shard operations are authorized against topic resources. Therefore, the lack of shard-level access control does not mean that shard operations cannot be authorized.

API operation

Action

Resource description

ListShard

dhs:ListShard

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName

MergeShard

dhs:UpdateShard

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName

SplitShard

dhs:UpdateShard

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName

PubSub

API operation

Action

Resource description

PutRecords

dhs:PutRecords

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName

GetRecords

dhs:GetRecords

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName

GetCursor

dhs:GetRecords

acs:dhs:$region:$accountid:projects/$projectName/topics/$topicName

Access conditions (Condition)

Condition key

Description

Value type or format

acs:SourceIp

Specifies the IP address range.

IP addresses. The asterisk (*) wildcard is supported.

acs:SecureTransport

Specifies whether the request is sent over HTTPS.

Boolean: true or false

acs:MFAPresent

Specifies whether multi-factor authentication (MFA) is used during user logon.

Boolean: true or false

acs:CurrentTime

Specifies the access time.

UTC time in ISO 8601 format, such as 2024-01-10T12:00:00Z

Policy examples

View projects in the DataHub console

// Add the following configuration to Statement to display the projects accessible to the RAM user in the DataHub console.
// ListProject and GetProject permissions are required to display projects in the DataHub console.
{
  "Action": ["dhs:ListProject","dhs:GetProject"],
  "Resource": "acs:dhs:*:*:projects/*",
  "Effect": "Allow"
}

Create a topic in a specified project in the DataHub console

// ListTopic and GetTopic permissions are required to display topics on a project page in the DataHub console.
// The following configuration grants permission to create topics in project test in the DataHub console.
{
  "Version": "1",
  "Statement": [
    {
      "Action": ["dhs:ListProject", "dhs:GetProject"],
      "Resource": "acs:dhs:*:*:projects/*",
      "Effect": "Allow"
    },
    {
      "Action": ["dhs:ListTopic", "dhs:GetTopic", "dhs:CreateTopic"],
      "Resource": "acs:dhs:*:*:projects/test/topics/*",
      "Effect": "Allow"
    }
  ]
}

Query topic information in a specified project

// This custom policy grants a RAM user only the permissions to query topic information in a specified project.
{
  "Version": "1",
  "Statement": [
    {
      "Action": ["dhs:ListTopic", "dhs:GetTopic"],
      "Resource": "acs:dhs:cn-hangzhou:12121312:projects/foo/topics/*",
      "Effect": "Allow"
    }
  ]
}

Grant subscription permissions for topics in a specified project

// Policy example 1 for the new subscription feature: this custom policy grants a RAM user all subscription permissions for topics in project foo.
{
  "Version": "1",
  "Statement": [
    {
      "Action": ["dhs:*Subscription"],
      "Resource": "acs:dhs:cn-hangzhou:*:projects/foo/topics/*/subscriptions/*",
      "Effect": "Allow"
    }
  ]
}

List subscriptions in a specified project

// Policy example 2 for the new subscription feature: this custom policy grants a RAM user only the permissions to query subscriptions in project foo.
{
  "Version": "1",
  "Statement": [
    {
      "Action": ["dhs:ListSubscription"],
      "Resource": "acs:dhs:cn-hangzhou:*:projects/foo/topics/*/subscriptions/*",
      "Effect": "Allow"
    }
  ]
}

Offset operations for a specified subscription

// Policy example 3 for the new subscription feature: this custom policy grants a RAM user only the permissions to commit offsets for subscription 14985645198374IoCK of topic t1 in project foo.
{
  "Version": "1",
  "Statement": [
    {
      "Action": ["dhs:GetSubscription"],
      "Resource": "acs:dhs:cn-hangzhou:*:projects/foo/topics/t1/subscriptions/14985645198374IoCK",
      "Effect": "Allow"
    }
  ]
}

Split or merge shards of a specified topic

// Split or merge shards of a specified topic, including ListShard, SplitShard, and MergeShard.
{
  "Version": "1",
  "Statement": [
    {
      "Action": ["dhs:*Shard"],
      "Resource": "acs:dhs:cn-hangzhou:12121312:projects/foo/topics/bar",
      "Effect": "Allow"
    }
  ]
}