Configure cross-account push authorization for ApsaraMQ for MNS topics to enable message delivery across Alibaba Cloud accounts.
Prerequisites
You must have two Alibaba Cloud accounts: Account A and Account B.
-
Alibaba Cloud account A: The account ID is
testAccountID. -
Alibaba Cloud account B: The account ID is
testAccountID1.
This example uses Account A to push messages to Account B.
Step 1: Create a RAM role for Account B
-
Create a Resource Access Management (RAM) role that Account A can assume.
-
Log on to the RAM console with Alibaba Cloud account B or a RAM user with administrative permissions.
-
In the left-side navigation pane, choose .
-
On the Roles page, click Create Role.
-
On the Create Role page, set the Principal Type to Cloud Service, select the Alibaba Cloud service, and then click OK.
-
In the Create Role dialog box, enter a role name and click OK.
-
-
Modify the trust policy of the RAM role.
-
On the Trust Policy tab, click Edit Trust Policy.
-
Modify the trust policy in the editor and click OK.
NoteChange
"Service": "mns.aliyuncs.com"to"Service": "testAccountID@mns.aliyuncs.com". ReplacetestAccountIDwith the ID of Alibaba Cloud account A.
-
Step 2: Grant cross-account permissions to the RAM role
Push to an ApsaraMQ for MNS queue
-
Log on to the RAM console with Alibaba Cloud account B or a RAM user with administrative permissions.
-
In the left-side navigation pane, choose .
-
On the Policies page, click Create Policy.
-
On the Create Policy page, click the Visual Editor tab.
-
Configure the permission policy and click OK.
-
For Effect, select Allow.
-
For Service, select ApsaraMQ for MNS.
-
For Action, select Select action(s), and then select the mns:SendMessage checkbox in the Write section.
-
For Resource, select All resource(s) or Specified resource(s).
-
-
In the Create Policy dialog box, enter a Policy Name name and Description, and then click OK.
-
In the left-side navigation pane, choose .
-
On the Roles page, click the name of the RAM role created in Step 1.
-
On the Permissions tab, click Precise Permission.
-
In the Precise Permission dialog box, configure the following settings and click OK:
-
policy type: Select {type}.
-
Policy Name: Enter the custom policy name.
-
Push to Function Compute
-
Log on to the RAM console with Alibaba Cloud account B or a RAM user with administrative permissions.
-
In the left-side navigation pane, choose .
-
On the Roles page, click the name of the RAM role created in Step 1.
-
On the Permissions tab, click Add Permissions.
-
In the Add Permissions panel, configure the following settings and click OK.
-
Resource Scope: Select Account.
-
Policies: Select the AliyunFCInvocationAccess checkbox.
-
Push to Message Queue for Apache Kafka
-
Log on to the RAM console with Alibaba Cloud account B or a RAM user with administrative permissions.
-
In the left-side navigation pane, choose .
-
On the Policies page, click Create Policy.
-
On the Create Policy page, click the JSON Editor tab, replace the content with the following policy, and then click OK.
{ "Version": "1", "Statement": [ { "Effect": "Allow", "Action": "eventbridge:*EventStreaming", "Resource": "*" } ] } -
In the Create Policy dialog box, enter a Policy Name name and Description, and then click OK.
-
In the left-side navigation pane, choose .
-
On the Roles page, click the name of the RAM role created in Step 1.
-
On the Permissions tab, click Precise Permission.
-
In the Precise Permission dialog box, configure the following settings and click OK:
-
policy type: Select {type}.
-
Policy Name: Enter the custom policy name.
-
Step 3: Obtain the ARN of the RAM role
When Account A creates a cross-account subscription, enter the RAM role ARN in the Service-linked Role field.
-
Log on to the RAM console with Alibaba Cloud account B or a RAM user with administrative permissions.
-
In the left-side navigation pane, choose .
-
On the Roles page, click the name of the RAM role created in Step 1.
-
In the Basic Information section, click Copy next to the ARN.
Related topics
Cross-account subscription guides for ApsaraMQ for MNS: