Access control
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 |
|
Topic |
|
Subscription |
|
Connector |
|
Authorized operations (Action) and corresponding resources
Project
API operation | Action | Resource description |
|
|
|
|
|
|
|
|
|
|
|
|
Topic
API operation | Action | Resource description |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subscription
API operation | Action | Resource description |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Connector
API operation | Action | Resource description |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
PubSub
API operation | Action | Resource description |
|
|
|
|
|
|
|
|
|
Access conditions (Condition)
Condition key | Description | Value type or format |
| Specifies the IP address range. | IP addresses. The asterisk (*) wildcard is supported. |
| Specifies whether the request is sent over HTTPS. | Boolean: |
| Specifies whether multi-factor authentication (MFA) is used during user logon. | Boolean: |
| Specifies the access time. | UTC time in ISO 8601 format, such as |
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"
}
]
}