You can use Apsara DevOps pipelines to automate the creation of Resource Orchestration Service (ROS) stacks. This topic describes how to use Apsara DevOps pipelines to automate the creation and update of stacks. An Elastic Compute Service (ECS) instance of the Virtual Private Cloud (VPC) type is updated in this example.
Prerequisites
A Resource Access Management (RAM) role is created, and required permissions are granted to the RAM role.
A RAM role such as TestTeamRole is created. For more information, see Create a RAM role for a trusted Alibaba Cloud service.
Required permissions are granted to the RAM role. For more information, see Grant permissions to a RAM role. The following table describes the required permissions.
Permission policy
Description
AliyunTeambitionRolePolicy
Manages Apsara DevOps.
AliyunROSFullAccess
Manages ROS.
AliyunECSFullAccess
Manages ECS.
AliyunVPCFullAccess
Manages VPC.
AliyunRDSFullAccess
Manages ApsaraDB RDS.
A code repository such as Git repository is prepared as the pipeline source.
Background information
Apsara DevOps is an enterprise-level one-stop DevOps solution and provides end-to-end online collaboration services and development tools that cover the entire lifecycle from requirement collection to product development, testing, release, maintenance, and operations. Apsara DevOps integrates with ROS. You can use Apsara DevOps to obtain ROS templates from a code repository to automate the creation and update of stacks.
If you use the ROS console to create and update stacks, you must manually perform operations. To automate the preceding operations, you can use an Apsara DevOps pipeline to create a release process.
In this example, the code of the Create a WordPress Environment Based on ECS and ApsaraDB for RDS template is uploaded to the code repository. A pipeline is created to obtain the code and automate the creation and update of stacks for the WordPress application.
Step 1: Upload the template code to the code repository
Log on to the ROS console.
In the left-side navigation pane, choose .
In the upper-right corner of the page that appears, enter WordPress in the field to search the Create a WordPress Environment Based on ECS and ApsaraDB for RDS template and click View Details.
Upload the template code to the code repository.
Step 2: Create a pipeline to automate the creation of the stack
Log on to Apsara DevOps Flow.
Click Create Pipeline in the upper-right corner.
In the left-side navigation pane, click Others. Select Empty Task and click Create.
In the Add Pipeline Source panel, select a code source and click Add.
Click Empty Task. In the Edit panel, set Task Name and choose .
Set Select Authorization, Alibaba Cloud Region, ROS Role, Stack Name, Stack File Path, and Timeout Period. In the upper-right corner of the page, click Save Only.
NoteIf you create a pipeline for the first time, click Save and Run. In the Run Pipeline dialog box, click Run. The pipeline automatically creates the specified stack.
Click Create Task. In the left-side navigation pane of the Select Task Group panel, click Tool.
In the Tool section, click Manual Approval.
In the Edit panel, set Task Name, Validator Type, and Validator.
Click Save and Run. In the Run Pipeline dialog box, click Run. The pipeline automatically creates the specified stack.
To view the created stack, log on to the ROS console and click Stacks in the left-side navigation pane.
Before the next task, the pipeline has an approval process.
If the process is approved, you can continue to execute the next task of the pipeline.
If the process is not approved, modify the template or configuration file, re-execute the pipeline, and submit another approval.
Step 3: Automate the update of the stack
To automate the creation of the stack, upload the new code of the template to the specified code repository after you update the template. This way, the stack is automatically updated when you run the pipeline to obtain the template code.