All Products
Search
Document Center

Resource Orchestration Service:Create a stack

最終更新日:Dec 21, 2023

If you want to create and manage a collection of resources, you can use a Resource Orchestration Service (ROS) template or a Terraform template to create a stack.

Use a ROS template to create a stack

  1. Log on to the ROS console.

  2. In the left-side navigation pane, click Stacks.

  3. In the top navigation bar, select the region where you want to create a stack from the region drop-down list. For example, you can select China (Hangzhou).

  4. On the Stacks page, click Create Stack and select Use ROS from the drop-down list.

  5. In the Select Template step, set Specify Template to one of the following values, specify a template based on your business requirements, and then click Next.

    • Select an Existing Template: If you use this value, specify Template Import Method and configure the template parameters. Valid values of Template Import Method:

      • Use URL: Enter the URL of the template and click Extract JSON Content. The template content is autopopulated.

        If you want to use the URL of a ROS 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 code editor, enter the content of the JSON or YAML template. For more information about how to create a JSON or YAML template, see Template structure.

      • My Templates: Select an existing template and a 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 a template version. The template content is autopopulated. For more information about how to share a template, see Share a template with Alibaba Cloud accounts.

    • Use a Sample Template: If you use this value, select a sample template from the Sample Templates drop-down list. The template content is autopopulated.

  6. In the Configure Parameters step, specify the Stack Name parameter and configure parameters in the Configure Template Parameters section.

    Note

    The parameters that you configure vary based on the template you use. Follow the on-screen instructions in the console to configure the parameters.

  7. In the Configure Stack Settings section, configure the following parameters and click Next.

    Parameter

    Description

    Stack Policy

    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 code editor.

    For more information about stack policies, see Stack policies.

    Rollback on Failure

    Valid values:

    • Yes: performs a rollback when the stack fails to be created.

    • No: does not perform a rollback when the stack fails to be created.

    Timeout Period

    If resources failed to be created or updated within the timeout period, the system automatically rolls the resources back to the status before the system creates or updates 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

    This parameter prevents the stack from being unintentionally deleted. Valid values:

    • Enabled: enables deletion protection.

    • Disabled: disables deletion protection.

    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 permissions to manage ROS resources. This ensures that you can create a stack role and 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 the check box, you must manually pay for orders generated for subscription resources. You can view the orders to be paid on the stack details page.

  8. In the Compliance Precheck step, complete the compliance precheck and click Next.

    Note

    The compliance precheck feature is available only for specific resources. For more information, see Compliance precheck of ROS.

    1. In the Evaluate Rules section, add compliance rules.

      You can add compliance rules based on the cloud resources in the ROS template.

    2. Click Evaluate.

      You can modify the template content based on the suggestions that are provided to remediate invalid resources to ensure the compliance of the resources.

  9. In the Check and Confirm step, click Create.

    After the stack is created, Created appears in the Status column of the stack.

Use a Terraform template to create a stack

  1. In the left-side navigation pane, click Stacks.

  2. In the top navigation bar, select the region where you want to create a stack from the region drop-down list. For example, you can select China (Hangzhou).

  3. On the Stacks page, click Create Stack and select Use Terraform from the drop-down list.

  4. In the Select Template step, set Specify Template to one of the following values, specify a template based on your business requirements, and then click Next.

    • Select an Existing Template: If you use this value, specify Template Import Method and configure the template parameters. Valid values of Template Import Method:

      • Use URL: Enter the URL of the template and click Extract JSON Content. The template content is autopopulated.

        If you want to use the URL of a ROS template that is stored in an Object Storage Service OSS bucket, you must configure CORS. For more information, see Configure CORS for a template.

      • Enter Template Content: In the Template Content code editor, enter the content of the Terraform template. For more information about how to create a Terraform template, see Structure of Terraform templates.

      • My Templates: Select an existing template and a 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 a template version. The template content is autopopulated. For more information about how to share a template, see Share a template with Alibaba Cloud accounts.

    • Use a Sample Template: If you use this value, select a sample template from the Sample Templates drop-down list. The template content is autopopulated.

  5. In the Configure Parameters step, specify the Stack Name parameter and configure parameters in the Configure Template Parameters section.

    Note

    The parameters that you configure vary based on the template you use. Follow the on-screen instructions in the console to configure the parameters.

  6. In the Configure Stack Settings section, configure the following parameters and click Next.

    Parameter

    Description

    Stack Policy

    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 code editor.

    For more information about stack policies, see Stack policies.

    Rollback on Failure

    Valid values:

    • Yes: performs a rollback when the stack fails to be created.

    • No: does not perform a rollback when the stack fails to be created.

    Timeout Period

    If resources failed to be created or updated within the timeout period, the system automatically rolls the resources back to the status before the system creates or updates 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

    This parameter prevents the stack from being unintentionally deleted. Valid values:

    • Enabled: enables deletion protection.

    • Disabled: disables deletion protection.

    RAM Role

    The 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 permissions to manage ROS resources. This ensures that you can create a stack role and 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 the check box, you must manually pay for orders generated for subscription resources. You can view the orders to be paid on the stack details page.

  7. In the Compliance Precheck step, complete the compliance precheck and click Next.

    Note

    The compliance precheck feature is available only for specific resources. For more information, see Compliance precheck of ROS.

    1. In the Evaluate Rules section, add compliance rules.

      You can add compliance rules based on the cloud resources in the ROS template.

    2. Click Evaluate.

      You can modify the template content based on the suggestions that are provided to remediate invalid resources to ensure the compliance of the resources.

  8. In the Check and Confirm step, click Create.

    After the stack is created, Created appears in the Status column of the stack.

References