If you want to create and manage a collection of resources, you can use a Resource Orchestration Service (ROS) or Terraform template to create a stack.
Use a ROS template to create a stack
Log on to the ROS console.
In the left-side navigation pane, choose Deployment > Stacks.
In the top navigation bar, select the region where you want to create a stack from the region drop-down list. In this example, China (Hangzhou) is selected.
On the Stacks page, click Create Stack. In the Specify Template section of the Select Template step, click Select an Existing Template.
Use a template based on your business requirements and click Next.
If you do not want to use a sample template, set the Template Import Method parameter to one of the following values and configure the template settings:
Use URL: Enter the URL of your template and click Extract Template Content. The template content is autopopulated.
If you want to use the URL of a template that is stored in an Object Storage Service (OSS) bucket, you must configure cross-origin resource sharing (CORS). For more information, see Configure CORS for a template.
Enter Template Content: In the Template Content section, click the ROS tab, click JSON or YAML, and then enter the content of your template in the editor. For more information about how to write a template in the JSON or YAML format, see Template structure.
My Templates: Select an existing template and template version. The template content is autopopulated. For more information about how to create a template, see Create a template.
Shared Template: Select a shared template and template version. The template content is autopopulated. For more information about how to share a template, see Share a template with Alibaba Cloud accounts.
If you want to use a sample template, set the Template Import Method parameter to Sample Template and select a sample template from the Sample Templates drop-down list. The template content is autopopulated.
In the Configure Parameters step, specify the Stack Name parameter and configure parameters in the Configure Template Parameters section.
NoteThe parameters that you must configure vary based on the template you use. Follow the on-screen instructions in the console to configure the parameters.
In the Configure Stack Settings section, configure the following parameters and click Next.
Parameter
Description
Stack Policy
The stack policy settings. Valid values:
No Stack Policy: You do not need to specify a stack policy.
Input Stack Policy: You must upload a stack policy file or enter a stack policy in the Input Stack Policy section.
For more information about stack policies, see Stack policies.
Rollback on Failure
Specifies whether to perform a rollback when the stack fails to be created. Valid values:
Yes
No
Timeout Period
The timeout period for creating or updating all resources. If all resources fail to be created or updated within the timeout period, ROS automatically rolls the resources back to the status before ROS attempts to create or update the resources.
Valid values: 10 to 1440.
Unit: minutes.
Maximum Concurrent Resources
The maximum number of concurrent operations that can be performed on resources. If you set this parameter to a value other than 0, the value is used. If you set this parameter to 0, no limit is imposed.
If you leave this parameter empty when you update a stack or continue to create a stack, the value that you specified for this parameter in the previous operation is used.
Deletion Protection
The deletion protection feature that prevents the stack from being unintentionally deleted. Valid values:
Enabled
Disabled
RAM Role
The Resource Access Management (RAM) role of which the trusted entity is ROS. You can create a RAM role and grant the minimum permissions to the RAM role based on the required permissions of resources in the template.
If you specify a RAM role, ROS creates resources based on the permissions of the RAM role.
If you want to create resources by using a stack role instead of the current account, make sure that the current account has the management permissions on ROS. This ensures that you can use the stack role to create resources. For more information, see Use a stack role.
For more information about how to create a RAM role and grant permissions to the RAM role, see Create a RAM role for a trusted Alibaba Cloud service and Grant permissions to a RAM role.
If you do not specify a RAM role, ROS creates the stack based on the permissions of the current account.
Tags
A tag is a key-value pair that you can use to classify stacks.
To add a tag, click Add. In the Edit tag dialog box, configure the Tag key and Tag value parameters and click OK.
Resource Group
The resource group to which the stack belongs. If you do not specify a resource group, the stack is added to the default resource group.
For more information about how to create a resource group, see Create a resource group.
Stack Event Callback URLs
The callback URLs that are used to receive the events of the stack.
Manual Payment
Specifies whether to manually pay for the subscription resources that are involved in the template.
If you select Manual Payment, you must manually pay for orders generated for subscription resources. On the stack details page, you can view the orders to be paid.
In the Compliance Precheck step, complete the compliance precheck and click Next.
NoteOnly specific resources support the compliance precheck feature. For more information, see Compliance precheck.
In the Evaluate Rules section, add compliance rules.
You can add compliance rules based on the cloud resources in the template.
Click Evaluate.
If non-compliant resources are found, you can click Remediation Suggestions to adopt the suggestions that are provided to remediate invalid resource configurations or template content. This ensures the compliance of resources.
In the Check and Confirm step, click Create.
If the stack is created, Created appears in the Status column of the stack.
Use a Terraform template to create a stack
In the left-side navigation pane, choose Deployment > Stacks.
In the top navigation bar, select the region where you want to create a stack from the region drop-down list. In this example, China (Hangzhou) is selected.
On the Stacks page, click Create Stack.
In the Specify Template section of the Select Template step, use a template based on your business requirements and click Next.
If you do not want to use a sample template, set the Template Import Method parameter to one of the following values and configure the template settings:
Use URL: Enter the URL of your template and click Extract Template Content. The template content is autopopulated.
If you want to use the URL of a template that is stored in an OSS bucket, you must configure CORS. For more information, see Configure CORS for a template.
Enter Template Content: In the Template Content section, click the Terraform tab and enter the content of your template in the editor. For more information about how to write a Terraform template, see Structure of Terraform templates.
My Templates: Select an existing template and template version. The template content is autopopulated. For more information about how to create a template, see Create a Terraform template.
Shared Template: Select a shared template and template version. The template content is autopopulated. For more information about how to share a template, see Share a template with Alibaba Cloud accounts.
If you want to use a sample template, set the Template Import Method parameter to Sample Template and select a sample template from the Sample Templates drop-down list. The template content is autopopulated.
In the Configure Parameters step, specify the Stack Name parameter and configure parameters in the Configure Template Parameters section.
NoteThe parameters that you must configure vary based on the template you use. Follow the on-screen instructions in the console to configure the parameters.
In the Configure Stack Settings section, configure the following parameters and click Next.
Parameter
Description
Stack Policy
The stack policy settings. Valid values:
No Stack Policy: You do not need to specify a stack policy.
Input Stack Policy: You must upload a stack policy file or enter a stack policy in the Input Stack Policy section.
For more information about stack policies, see Stack policies.
Rollback on Failure
Specifies whether to perform a rollback when the stack fails to be created. Valid values:
Yes
No
Timeout Period
The timeout period for creating or updating all resources. If all resources fail to be created or updated within the timeout period, ROS automatically rolls the resources back to the status before ROS attempts to create or update the resources.
Valid values: 10 to 1440.
Unit: minutes.
Maximum Concurrent Resources
The maximum number of concurrent operations that can be performed on resources. If you set this parameter to a value other than 0, the value is used. If you set this parameter to 0, no limit is imposed.
If you leave this parameter empty when you update a stack or continue to create a stack, the value that you specified for this parameter in the previous operation is used.
Deletion Protection
The deletion protection feature that prevents the stack from being unintentionally deleted. Valid values:
Enabled
Disabled
RAM Role
The Resource Access Management (RAM) role of which the trusted entity is ROS. You can create a RAM role and grant the minimum permissions to the RAM role based on the required permissions of resources in the template.
If you specify a RAM role, ROS creates resources based on the permissions of the RAM role.
If you want to create resources by using a stack role instead of the current account, make sure that the current account has the management permissions on ROS. This ensures that you can use the stack role to create resources. For more information, see Use a stack role.
For more information about how to create a RAM role and grant permissions to the RAM role, see Create a RAM role for a trusted Alibaba Cloud service and Grant permissions to a RAM role.
If you do not specify a RAM role, ROS creates the stack based on the permissions of the current account.
Tags
A tag is a key-value pair that you can use to classify stacks.
To add a tag, click Add. In the Edit tag dialog box, configure the Tag key and Tag value parameters and click OK.
Resource Group
The resource group to which the stack belongs. If you do not specify a resource group, the stack is added to the default resource group.
For more information about how to create a resource group, see Create a resource group.
Stack Event Callback URLs
The callback URLs that are used to receive the events of the stack.
Manual Payment
Specifies whether to manually pay for the subscription resources that are involved in the template.
If you select Manual Payment, you must manually pay for orders generated for subscription resources. On the stack details page, you can view the orders to be paid.
In the Compliance Precheck step, complete the compliance precheck and click Next.
NoteOnly specific resources support the compliance precheck feature. For more information, see Compliance precheck.
In the Evaluate Rules section, add compliance rules.
You can add compliance rules based on the cloud resources in the template.
Click Evaluate.
If non-compliant resources are found, you can click Remediation Suggestions to adopt the suggestions that are provided to remediate invalid resource configurations or template content. This ensures the compliance of resources.
In the Check and Confirm step, click Create.
If the stack is created, Created appears in the Status column of the stack.
References
The following topics describe how to manage a stack:
The following topics describe how to manage existing resources by using the resource import feature: