Change sets can help you manage various types of imported cloud resources. This topic describes how to use a change set to create a stack in Resource Orchestration Service (ROS).
Scenario
If you want to manage a large number of cloud resources and preview the creation effect of the resources before a stack that contains the resources is created, you can create the stack by using a change set. You must use this feature together with the resource import feature. For more information, see Import an existing resource to create a stack. You can use the resource import feature to import cloud resources to create a stack. Then, you can use a change set to preview the creation effect of the resources before the stack takes effect. A stack can manage cloud resources as expected only after you successfully execute the change set on the stack. Before you execute a change set, you can check and modify the stack template to meet your business requirements.
Supported methods
ROS console: You can use a change set to create a stack for resource management in the ROS console.
For more information, see Import an existing resource to create a stack.
ROS API operation: You can use a change set to create a stack by calling a specific ROS API operation.
For more information, see CreateChangeSet.
Alibaba Cloud CLI: You can use a change set to create a stack by using Alibaba Cloud CLI.
For more information, see the "Create a stack by using Alibaba Cloud CLI" section of this topic.
Create 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).
Create a stack by using a change set. You can use one of the following methods:
In the value of the
TemplateBody
parameter, you must specify the deletion policy for resources.To import resources, you must specify the
ResourcesToImport
parameter.Run the
aliyun ros ExecuteChangeSet
command to execute the change set.aliyun ros ExecuteChangeSet --ChangeSetId <Change set ID>
Create a stack by creating a change set
Run the aliyun ros CreateChangeSet
command to create a stack by creating a change set.
You must set the ChangeSetType parameter to CREATE
and configure the StackName, RegionId, TemplateBody, and ChangeSetName parameters. For more information, see CreateChangeSet.
aliyun ros CreateChangeSet --ChangeSetType CREATE --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>
Create a stack by importing resources
Run the aliyun ros CreateChangeSet
command to create a stack by importing resources.
You must set the ChangeSetType parameter to IMPORT
and configure the StackName, RegionId, TemplateBody, ResourcesToImport, and ChangeSetName parameters. For more information, see CreateChangeSet.
aliyun ros CreateChangeSet --ChangeSetType IMPORT --StackName <Name of the stack to be created by using the change set> --RegionId <Region ID of the change set> --TemplateBody <Structure that contains the template body> --ChangeSetName <Change set name> --ResourcesToImport <Resources to be imported>
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 create a stack by creating a change set. For more information, see CreateChangeSet.