You can use Alibaba Cloud Resource Access Management (RAM) to manage permissions on the console and API operations of ApsaraMQ for Kafka. RAM eliminates the need to share the AccessKey pair of your Alibaba Cloud account with other users. You can grant the RAM users of your Alibaba Cloud account the minimum required permissions. An AccessKey pair consists of an AccessKey ID and an AccessKey secret.

RAM policies

In RAM, policies are a set of permissions that are described based on the policy structure and syntax. Each policy describes the resources on which permissions are granted, the API operations that are allowed or denied, and the conditions that are required for the policy to take effect. For more information, see Policy structure and syntax.

In RAM, a policy is a resource entity. ApsaraMQ for Kafka supports the following types of policies:

  • System policy: System policies are created and maintained by Alibaba Cloud. These policies are suitable for implementing coarse-grained permission control on RAM users. System policies cannot be modified after they are created.
  • Custom policy: You can create, update, and delete custom policies. These policies are suitable for implementing fine-grained permission control on RAM users. You need to maintain the versions of custom policies.

System policies

The following table describes the system policies that are supported by ApsaraMQ for Kafka.

PolicyDescription
AliyunKafkaFullAccessThe management permissions on ApsaraMQ for Kafka. RAM users to whom this policy is attached are granted the permissions to perform all operations on the console and API of Message Queue for Apache Kafka. This policy grants permissions that are equivalent to the permissions of an Alibaba Cloud account on Message Queue for Apache Kafka.
AliyunKafkaReadOnlyAccessThe read-only permissions on ApsaraMQ for Kafka. RAM users to whom this policy is attached are granted only the read-only permissions on all Message Queue for Apache Kafka resources that belong to their Alibaba Cloud accounts. This policy does not grant permissions to perform operations on the console or API of Message Queue for Apache Kafka.

Examples of system policies

Attach the AliyunKafkaFullAccess system policy to a RAM user. The RAM user is granted the permissions to perform all operations on the console and API of Message Queue for Apache Kafka. The granted permissions are equivalent to the permissions of the corresponding Alibaba Cloud account on Message Queue for Apache Kafka. The following code displays the content of the policy:

{
    "Version": "1",
    "Statement": [
        {
            "Action": "alikafka:*",
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Custom policies

The following table describes the custom policies that are supported by ApsaraMQ for Kafka.

ActionPermission descriptionRead-only
ReadOnlyOnly reads all resources.Yes
ListInstanceViews instances.Yes
StartInstanceDeploys instances.No
UpdateInstanceUpdates instance configurations.No
ReleaseInstanceRelease instances.No
ListTopicViews topics.Yes
CreateTopicCreate topics.No
UpdateTopicUpdates topic configurations.No
DeleteTopicDeletes topics.No
ListGroupViews groups.GroupYes
CreateGroupCreates groups.GroupNo
UpdateGroupUpdates group configurations.GroupNo
DeleteGroupDeletes groups.GroupNo
QueryMessageQueries messages.Yes
SendMessageSends messages.No
DownloadMessageDownloads messages.Yes
CreateMessageSearchEnables message retrieval.No
OperateMessageSearchStarts and stops message retrieval tasks.No
ListMessageSearchViews retrieved messages.Yes
DeleteMessageSearchDeletes message retrieval tasks.No
CreateDeployment
  • Creates FC sink connectors.
  • Creates MaxCompute sink connectors.
  • Creates OSS sink connectors.
  • Creates Elasticsearch sink connectors.
  • Creates MySQL source connectors.
  • Creates DLA sink connectors.
No
DeleteDeployment
  • Deletes FC sink connectors.
  • Deletes MaxCompute sink connectors.
  • Deletes OSS sink connectors.
  • Deletes Elasticsearch sink connectors.
  • Deletes MySQL source connectors.
  • Deletes DLA sink connectors.
No
ListDeploymentsViews connectors.Yes
UpdateDeploymentRemarkChanges connector descriptions.No
GetDeploymentLogQueries the operational logs of connectors.Yes
OperateDeploymentStarts and stops connectors.No
CreateOtsSinkDeploymentCreates Tablestore sink connectors.No
OperateOtsSinkDeploymentStarts and stops Tablestore sink connectors.No
DeleteOtsSinkDeploymentDeletes Tablestore sink connectors.No
CreateAdbSinkDeploymentCreates AnalyticDB sink connectors.No
OperateAdbSinkDeploymentStarts and stops AnalyticDB sink connectors.No
DeleteAdbSinkDeploymentDeletes AnalyticDB sink connectors.No
EnableAclEnables the access control list (ACL) feature.No
CreateAclCreates ACLs.No
DeleteAclDeletes ACLs.No
ListAclQueries ACLs.Yes
CreateSaslUserCreates Simple Authentication and Security Layer (SASL) users.No
DeleteSaslUserDeletes SASL users.No
ListSaslUserQueries SASL users.Yes
CreateETLTaskCreates ETL tasks.No
ListETLTaskQueries ETL tasks.Yes
DeleteETLTaskDeletes ETL tasks.No
UpdateConsumerOffsetResets the consumer offset of a consumer group.No

Examples of custom policies

Attach the AliyunKafkaCustomAccess policy to a RAM user. The RAM user is granted only the permissions to use the console or API of Message Queue for Apache Kafka to perform the following operations on the alikafka_post-cn-xxx instance: view the instance, view topics, view groups, query messages, and download messages.Group The following code displays the content of the policy:

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
              "alikafka:ListInstance",
              "alikafka:ListTopic",
              "alikafka:ListGroup",
              "alikafka:QueryMessage",
              "alikafka:DownloadMessage"
                       ],
            "Resource": "acs:alikafka:*:*:alikafka_post-cn-xxx",
            "Effect": "Allow"
        }
    ]
}