使用更改集更新资源栈

更新时间:
复制 MD 格式

A change set lets you preview the impact of proposed changes on your running resources before you apply them. This topic describes how to use a change set to update a stack in Resource Orchestration Service (ROS).

Use cases

If you want to preview the impacts of changes to a stack before you update the stack resources, you can update the stack by using a change set. For example, a change set can help you preview whether key resources are deleted or replaced by a stack update. You can create a change set to update a stack. The change set helps you preview impacts of the update operation on the stack before the stack update takes effect. The stack update takes effect only after you successfully execute the change set on the stack. Before you execute a change set, you can check and modify the template of the stack that you want to update to meet your business requirements.

Prerequisites

A stack must already exist. For more information, see Create a stack.

Limitations

You can create a change set only for a stack that is in one of the following states.

State

Description

CREATE_COMPLETE

The stack is successfully created.

UPDATE_FAILED

The stack update failed.

UPDATE_COMPLETE

The stack update is complete.

ROLLBACK_COMPLETE

The stack rollback is complete.

ROLLBACK_FAILED

The stack rollback failed.

IMPORT_CREATE_COMPLETE

The stack is successfully created from imported resources.

IMPORT_UPDATE_COMPLETE

The stack is successfully updated with imported resources.

IMPORT_UPDATE_FAILED

The stack update from imported resources failed.

IMPORT_UPDATE_ROLLBACK_COMPLETE

The stack update from imported resources failed, and the rollback is complete.

IMPORT_UPDATE_ROLLBACK_FAILED

The stack update from imported resources failed, and the rollback also failed.

CHECK_FAILED

The stack validation failed.

CHECK_COMPLETE

The stack validation is complete.

Supported methods

  • Console: Use the ROS console to update a stack with a change set.

    For instructions, see the procedures in this topic.

  • API: Call the CreateChangeSet API operation to update a stack with a change set.

    For more information, see CreateChangeSet.

  • Alibaba Cloud CLI: Use the Alibaba Cloud CLI to update a stack with a change set.

    For instructions, see the procedures in this topic.

Update a stack by using the console

  1. Log in to the ROS console.

  2. In the navigation pane on the left, 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, select China (Hangzhou).

  4. On the Stacks page, click the name of your stack.

  5. On the stack details page, click the Change Sets tab.

  6. On the Change Sets tab, click Create Change Set.

  7. On the Select Template page, select an existing or public template, and then click Next.

  8. On the Configure Parameters page, set the Change set name and other parameters from the template.

    Note

    The template parameters are parsed from the selected template. Enter the values as prompted on the page.

  9. In the Configure Change Set section, configure the Stack Policy, Rollback on Failure, Timeout Period, Maximum Concurrent Resources, RAM Role, and Whether to enable replacement update options. Then, click Next.

  10. On the Check and Confirm page, click Create Change Set.

Update a stack by using the CLI

  1. Install the Alibaba Cloud CLI.

    For more information, see Install Alibaba Cloud CLI.

  2. Configure Alibaba Cloud credentials.

    For more information, see Configure credentials.

  3. Create a change set to update the stack.

    Run the aliyun ros CreateChangeSet command. You must set the ChangeSetType parameter to UPDATE and specify the stack name, region ID, template, and change set name.

    For more information, see CreateChangeSet.

    aliyun ros CreateChangeSet --ChangeSetType UPDATE --StackName <your_stack_name> --RegionId <your_region_id> --TemplateBody <your_template_body> --ChangeSetName <your_change_set_name> 
  4. Run the aliyun ros ExecuteChangeSet command to execute the change set.

    aliyun ros ExecuteChangeSet --ChangeSetId <change_set_id>

References

  • You can view the impacts of a change set on a stack and check the stack template. For more information, see View a change set and Data structures.

  • After you execute a change set on a stack, ROS automatically deletes other change sets that are associated with the stack. For more information, see Execute a change set.

  • If a change set cannot meet your business requirements on a stack update, you can delete the change set. For more information, see Delete a change set.

  • To create a change set using the API, see CreateChangeSet.