A change set can help you preview the impacts of a change operation on a stack before you update the stack. This topic describes how to use a change set to update a stack in Resource Orchestration Service (ROS).
Scenario
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, you can preview whether key resources are deleted or replaced by a stack update. You can create a change set to update the 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 is created. For more information, see Create a stack.
Limits
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 created. |
UPDATE_FAILED | The stack fails to be updated. |
UPDATE_COMPLETE | The stack is updated. |
ROLLBACK_COMPLETE | The resources of the stack are rolled back. |
ROLLBACK_FAILED | The resources of the stack fail to be rolled back. |
IMPORT_CREATE_COMPLETE | The stack is created by using imported resources. |
IMPORT_UPDATE_COMPLETE | The stack is updated by using imported resources. |
IMPORT_UPDATE_FAILED | The stack fails to be updated by using imported resources. |
IMPORT_UPDATE_ROLLBACK_COMPLETE | The resources are rolled back after the stack fails to be updated by using imported resources. |
IMPORT_UPDATE_ROLLBACK_FAILED | The resources fail to be rolled back after the stack fails to be updated by using imported resources. |
CHECK_FAILED | The stack fails to be validated. |
CHECK_COMPLETE | The stack is validated. |
Supported methods
ROS console: You can use a change set to update a stack in the ROS console.
For more information, see the "Update a stack in the ROS console" section of this topic.
ROS API operation: You can use a change set to update a stack by calling a specific ROS API operation.
For more information, see CreateChangeSet.
Alibaba Cloud CLI: You can use a change set to update a stack by using Alibaba Cloud CLI.
For more information, see the "Update a stack by using Alibaba Cloud CLI" section of this topic.
Update a stack in the ROS console
Log on to the ROS console.
In the left-side navigation pane, click Stacks.
In the top navigation bar, select the region where the stack you want to manage resides from the region drop-down list. In this example, China (Hangzhou) is selected.
On the Stacks page, find the stack and click the stack ID.
On the stack details page, click the Change Sets tab.
On the Change Sets tab, click Create Change Set.
In the Select Template step, select an existing template or a sample template based on your business requirements, and click Next.
In the Configure Parameters step, configure the Change Set Name parameter and parameters in the Configure Template Parameters section.
NoteParameters in the Configure Template Parameters section are parsed from the template. Follow the on-screen instructions to configure the template parameters.
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 parameters. Then, click Next.
In the Check and Confirm step, click Create Change Set.
Update a stack by using Alibaba Cloud CLI
Install Alibaba Cloud CLI.
For more information, see Windows.
Configure an Alibaba Cloud credential.
For more information, see Configure a credential in interactive mode (fast).
Update a stack by creating a change set.
Run the
aliyun ros CreateChangeSet
command to update a stack by creating a change set.You must set the ChangeSetType parameter to UPDATE and configure the StackName, RegionId, TemplateBody, and ChangeSetName parameters. For more information, see CreateChangeSet.
aliyun ros CreateChangeSet --ChangeSetType UPDATE --StackName <Name of the stack for which you want to create the change set> --RegionId <Region ID of the change set> --TemplateBody <Structure that contains the template body> --ChangeSetName <Change set name>
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.
You can call an API operation to update a stack by creating a change set. For more information, see CreateChangeSet.