API Gateway uses the service-linked role AliyunServiceRoleForApigatewayPutEventsToEventBridge to publish events to your event bus in EventBridge. A service-linked role is a RAM role that a cloud service automatically creates and manages with predefined permissions. For more information, see the RAM documentation on service-linked roles.
Role details
| Property | Value |
|---|---|
| Role name | AliyunServiceRoleForApigatewayPutEventsToEventBridge |
| Role type | Service-linked role (RAM role) |
| Attached policy | AliyunServiceRolePolicyForApigatewayPutEventsToEventBridge |
Policy content:
The attached policy grants API Gateway permission to call the eventbridge:PutEvents action on all EventBridge resources, allowing API Gateway to publish events to any event bus in your account.
{
"Version": "1",
"Statement": [
{
"Effect": "Allow",
"Action": "eventbridge:PutEvents",
"Resource": "*"
}
]
}
When the role is created
When you create a backend service of the EventBridge type, API Gateway prompts you to create the AliyunServiceRoleForApigatewayPutEventsToEventBridge service-linked role. After the role is created, API Gateway uses it to publish events to your event bus whenever you create and call APIs that use the EventBridge backend service.
Delete the AliyunServiceRoleForApigatewayPutEventsToEventBridge role
Before you delete the AliyunServiceRoleForApigatewayPutEventsToEventBridge service-linked role, delete all backend services and APIs that depend on it. After the dependent resources are removed, you can delete the role from the RAM console.
Step 1: Delete the dependent backend services
-
Log on to the API Gateway console.
-
In the left-side navigation pane, choose Manage APIs > Backend Services.
-
On the Backend Services page, use the Type column to filter for EventBridge backend services.
-
Find the backend service that you want to delete and click Delete in the Actions column.
-
Repeat the previous step for each EventBridge backend service that you want to remove.
Step 2: Delete the role
-
Log on to the RAM console.
-
In the left-side navigation pane, choose Identities > Roles.
-
Find the
AliyunServiceRoleForApigatewayPutEventsToEventBridgerole and click Delete in the Actions column.