Use ROS to manage ActionTrail resources. The following example writes a Resource Orchestration Service template to create a trail.
Supported resources
ROS simplifies cloud resource management. Define your Alibaba Cloud resources (such as ECS and ApsaraDB RDS instances) and their dependencies in a template, and ROS creates and configures them automatically. What is Resource Orchestration Service?
ROS supports the following ActionTrail resources:
-
ALIYUN::ACTIONTRAIL::Trail: Creates a trail.
-
ALIYUN::ACTIONTRAIL::TrailLogging: Enables or disables logging for a trail.
Permissions
This example creates a trail. By default, Resource Orchestration Service uses the current user's credentials. The user needs these permissions:
-
AliyunActionTrailFullAccess: Provides full access to ActionTrail.
-
AliyunLogFullAccess: Provides full access to Simple Log Service (SLS).
An Alibaba Cloud account has full API permissions, which poses security risks. We recommend that you create a RAM user for API access and daily operations, and grant only the required permissions. Authorize a RAM User.
Procedure
-
Log on to the ROS console and select a region from the Region drop-down list.
-
In the left-side navigation pane, click Stacks, and then select Create Stack > Use ROS:
-
Specify Template: Select Select an Existing Template.
-
Template Import Method: Select Enter Template Content.
-
-
Under Template Content, select ROS and enter the following code in YAML or JSON format.
This example creates a trail named
test-trailusing the ALIYUN::ACTIONTRAIL::Trail resource type. -
Click Next. For Rollback on Failure, select Yes.
-
Click Create.
-
View the output.

-
After the stack is created, use OpenAPI, SDKs, or the ActionTrail console to verify the
test-trailtrail.