All Products
Search
Document Center

Resource Orchestration Service:CreateChangeSet

Last Updated:Feb 22, 2024

Creates change sets.

Operation description

Limits

You can create and execute change sets to update running stacks. For more information about change sets, see Overview .

Usage notes

  • A stack can contain up to 20 change sets.
  • Change sets reflect only the changes of stacks. Change sets do not reflect whether stacks are updated.
  • You cannot use change sets to check the following items: whether the upper limit of your Alibaba Cloud account is reached, whether resources that cannot be updated are updated, and whether your Alibaba Cloud account has permissions to modify resources. These items may cause stack updates to fail. If stacks fail to be updated, Resource Orchestration Service (ROS) rolls back the resources to the original status.

In this topic, a change set named MyChangeSet is created in the China (Hangzhou) region. In this example, the template of the stack whose ID is 4a6c9851-3b0f-4f5f-b4ca-a14bf691**** is updated to {"ROSTemplateFormatVersion":"2015-09-01"}.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ros:CreateChangeSetWRITE
  • stack
    acs:ros:{#regionId}:{#accountId}:stack/*
  • stack
    acs:ros:{#regionId}:{#accountId}:stack/{#stackId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
StackIdstringNo

The ID of the stack for which you want to create a change set. ROS compares the stack information with the information that you submit, such as a modified template or a changed parameter value, to generate the change set.

Note This parameter takes effect only for change sets of the UPDATE or IMPORT.
4a6c9851-3b0f-4f5f-b4ca-a14bf691****
StackPolicyURLstringNo

The URL of the file that contains the stack policy. The URL must point to a policy that is located on an HTTP or HTTPS web server or in an Object Storage Service (OSS) bucket, such as oss://ros/stack-policy/demo and oss://ros/stack-policy/demo?RegionId=cn-hangzhou. The policy file can be up to 16,384 bytes in length.

Note If you do not specify the region of the OSS bucket, the value of RegionId is used.

You can specify only one of the following parameters: StackPolicyBody and StackPolicyURL.
The URL can be up to 1,350 bytes in length.

If you set ChangeSetType to CREATE, you can specify StackPolicyBody or StackPolicyURL. If you set ChangeSetType to UPDATE, you can specify only one of the following parameters:

  • StackPolicyBody
  • StackPolicyURL
  • StackPolicyDuringUpdateBody
  • StackPolicyDuringUpdateURL
oss://ros/stack-policy/demo
StackPolicyBodystringNo

The structure of the stack policy body. The policy body must be 1 to 16,384 bytes in length. If you set ChangeSetType to CREATE, you can specify StackPolicyBody or StackPolicyURL. If you set ChangeSetType to UPDATE, you can specify only one of the following parameters:

  • StackPolicyBody
  • StackPolicyURL
  • StackPolicyDuringUpdateBody
  • StackPolicyDuringUpdateURL
{"Statement":[{"Effect":"Allow","Action":"Update:*","Principal":"*","Resource":"*"}]}
StackNamestringNo

The name of the stack for which you want to create the change set.
The name can be up to 255 characters in length and can contain digits, letters, hyphens (-), and underscores (_). The name must start with a digit or a letter.

Note This parameter takes effect only if you set ChangeSetType to CREATE or IMPORT.
MyStack
UsePreviousParametersbooleanNo

Specifies whether to use the values that were passed last time for the parameters that you do not specify in the current request. Valid values:

  • true
  • false (default)
Note This parameter takes effect only if you set ChangeSetType to UPDATE or IMPORT.
true
ChangeSetTypestringNo

The type of the change set. Valid values:

  • CREATE: creates a change set for a new stack.
  • UPDATE (default): creates a change set for an existing stack.
  • IMPORT: creates a change set for a new stack or an existing stack to import resources that are not managed by ROS.

If you create a change set for a new stack, ROS generates a unique stack ID for the stack. The stack remains in the REVIEW_IN_PROGRESS state until you execute the change set.
If you want to create a change set for a new stack, do not set ChangeSetType to UPDATE. If you want to create a change set for an existing stack, do not set ChangeSetType to CREATE.

UPDATE
DescriptionstringNo

The description of the change set. The description can be up to 1,024 bytes in length.

It is a demo.
RegionIdstringYes

The region ID of the change set. You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
ClientTokenstringNo

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that the value is unique among different requests.
The token can contain letters, digits, hyphens (-), and underscores (_) and cannot exceed 64 characters in length.
For more information, see How to ensure idempotence.

123e4567-e89b-12d3-a456-42665544****
TemplateURLstringNo

The URL of the file that contains the template body. The URL must point to a template that is located on an HTTP or HTTPS web server or in an OSS bucket, such as oss://ros/template/demo and oss://ros/template/demo?RegionId=cn-hangzhou. The template body can be up to 524,288 bytes in length.

Note If you do not specify the region of the OSS bucket, the value of RegionId is used.

You can specify only one of the following parameters: TemplateBody, TemplateURL, and TemplateId.

The URL can be up to 1,024 bytes in length.

oss://ros/template/demo
StackPolicyDuringUpdateURLstringNo

The URL of the stack policy based on which the stack is updated. The URL must point to a policy that is located on an HTTP or HTTPS web server or in an OSS bucket, such as oss://ros/stack-policy/demo and oss://ros/stack-policy/demo?RegionId=cn-hangzhou. The policy file can be up to 16,384 bytes in length.

Note If you do not specify the region of the OSS bucket, the value of RegionId is used.

The URL can be up to 1,350 bytes in length.
If you need to update protected resources, specify a temporary overriding stack policy for the resources during the update. If you do not specify a stack policy, the existing policy that is associated with the stack is used. This parameter takes effect only if you set ChangeSetType to UPDATE. You can specify only one of the following parameters:

  • StackPolicyBody
  • StackPolicyURL
  • StackPolicyDuringUpdateBody
  • StackPolicyDuringUpdateURL
oss://ros/stack-policy/demo
TemplateBodystringNo

The structure of the template body. The template body must be 1 to 524,288 bytes in length.
If the length of the template body is longer than required, we recommend that you add parameters to the HTTP POST request body to prevent request failures caused by excessive length of URLs.

You can specify only one of the following parameters: TemplateBody, TemplateURL, and TemplateId.

{"ROSTemplateFormatVersion":"2015-09-01"}
TimeoutInMinuteslongNo

The amount of time that can elapse before the stack enters the CREATE_FAILED or UPDATE_FAILED state.
If you set ChangeSetType to CREATE, this parameter is required. If you set ChangeSetType to UPDATE, this parameter is optional.

  • Unit: minutes.
  • Valid values: 10 to 1440.
  • Default value: 60.
12
DisableRollbackbooleanNo

Specifies whether to disable rollback when the stack fails to be created.
Valid values:

  • true: disables rollback for the stack when the stack fails to be created.
  • false (default): enables rollback for the stack when the stack fails to be created.
Note This parameter takes effect only if you set ChangeSetType to CREATE or IMPORT.
false
ChangeSetNamestringYes

The name of the change set.
The name can be up to 255 characters in length and can contain digits, letters, hyphens (-), and underscores (_). The name must start with a digit or a letter.

Note Make sure that the name is unique among all names of change sets that are associated with the specified stack.
MyChangeSet
StackPolicyDuringUpdateBodystringNo

The structure of the temporary overriding stack policy. The policy body must be 1 to 16,384 bytes in length.
If you need to update protected resources, specify a temporary overriding stack policy for the resources during the update. If you do not specify a temporary overriding stack policy, the existing stack policy that is associated with the stack is used.
This parameter takes effect only if you set ChangeSetType to UPDATE. You can specify only one of the following parameters:

  • StackPolicyBody
  • StackPolicyURL
  • StackPolicyDuringUpdateBody
  • StackPolicyDuringUpdateURL
{"Statement":[{"Effect":"Allow","Action":"Update:*","Principal":"*","Resource":"*"}]}
RamRoleNamestringNo

The name of the Resource Access Management (RAM) role. Resource Orchestration Service (ROS) assumes the RAM role to create the stack and uses the credentials of the role to call the APIs of Alibaba Cloud services.
ROS assumes the role to perform operations on the stack. If you have permissions to perform operations on the stack but do not have permissions to use the RAM role, ROS still assumes the RAM role. You must make sure that the least privileges are granted to the RAM role.
If you do not specify this parameter, ROS uses the existing role that is associated with the stack. If no roles are available for ROS to assume, ROS uses a temporary credential that is generated from the credentials of your Alibaba Cloud account.
The name of the RAM role can be up to 64 bytes in length.

test-role
ReplacementOptionstringNo

Specifies whether to enable replacement update if a resource property is changed and you cannot modify the new resource property. For a change, the physical ID of the resource remains unchanged. For a replacement update, the existing resource is deleted, a new resource is created, and the physical ID of the resource is changed. Valid values:

  • Enabled
  • Disabled (default)
Note Operations that you perform to modify the resource properties for an update take precedence over operations you perform to replace the resource properties for an update. This parameter takes effect only if you set ChangeSetType to UPDATE.
Disabled
TemplateIdstringNo

The ID of the template. This parameter applies to shared and private templates.

You can specify only one of the following parameters: TemplateBody, TemplateURL, and TemplateId.

5ecd1e10-b0e9-4389-a565-e4c15efc****
TemplateVersionstringNo

The version of the template.

Note This parameter takes effect only if you specify TemplateId.
v1
Parametersobject []No

The parameters that are defined in the template.

ParameterKeystringYes

The key of parameter N that is defined in the template. If you do not specify the key and value of a parameter, ROS uses the default name and value that are defined in the template. Maximum value of N: 200.

Note Parameters is optional. If you specify Parameters, you must also specify Parameters.N.ParameterKey.
Amount
ParameterValuestringYes

The value of parameter N that is defined in the template. Maximum value of N: 200.

Note Parameters is optional. If you specify Parameters, you must also specify Parameters.N.ParameterValue.
12
NotificationURLsarrayNo

The callback URLs that are used to receive stack events.

stringNo

The callback URL that is used to receive stack events. Valid values:

  • HTTP POST URL

Each URL can be up to 1,024 bytes in length.

  • eventbridge

When the status of a stack changes, ROS sends an event notification to the EventBridge service. To view the event information, perform the following operations: Log on to the EventBridge console. In the left-side navigation pane, click Event Buses.

Note This feature is supported in the China (Hangzhou), China (Shanghai), China (Beijing), China (Hong Kong), and China (Zhangjiakou) regions.

You can specify up to five callback URLs. When the status of a stack changes, ROS sends a notification to the specified URL. When rollback is enabled for the stack, notifications are sent if the stack is in the CREATE_ROLLBACK or ROLLBACK state, but are not sent if the stack is in the CREATE_FAILED, UPDATE_FAILED, or IN_PROGRESS state. ROS does not send notifications when the stack is in the IN_PROGRESS state.
ROS sends notifications regardless of whether you specify the Outputs section. The following sample code provides an example on the content of a notification:

{
   "Outputs": [
       {
           "Description": "No description given",
           "OutputKey": "InstanceId",
           "OutputValue": "i-xxx"
       }
   ],
   "StackId": "80bd6b6c-e888-4573-ae3b-93d29113****",
   "StackName": "test-notification-url",
   "Status": "CREATE_COMPLETE"
}
http://example.com/ros-notify
ResourcesToImportobject []No

The resources that you want to import into the stack.

ResourceIdentifierstringYes

The key-value mapping between strings. The value is a JSON string that identifies resource N that you want to import.
A key is an identifier for a resource and a value is an assignment of data to the key. For example, VpcId is a key that indicates the ID of a virtual private cloud (VPC), and vpc-2zevx9ios**** is a value that is assigned to VpcId. You can call the GetTemplateSummary operation to obtain the key of a resource.

Note This parameter takes effect only if you set ChangeSetType to IMPORT. ResourcesToImport is optional. If you specify ResourcesToImport, you must also specify ResourcesToImport.N.ResourceIdentifier.
{"VpcId": "vpc-2zevx9ios******"}
LogicalResourceIdstringYes

The logical ID of resource N that you want to import. The logical ID specifies the name of resource N that is defined in the template.

Note This parameter takes effect only if you set ChangeSetType to IMPORT. ResourcesToImport is optional. If you specify ResourcesToImport, you must also specify ResourcesToImport.N.LogicalResourceId.
Vpc
ResourceTypestringYes

The type of resource N that you want to import. The resource type must be the same as the resource type that is defined in the template.

Note This parameter takes effect only if you set ChangeSetType to IMPORT. ResourcesToImport is optional. If you specify ResourcesToImport, you must also specify ResourcesToImport.N.ResourceType.
ALIYUN::ECS::VPC
TemplateScratchIdstringNo

The ID of the scenario template.

4a6c9851-3b0f-4f5f-b4ca-a14bf691****
ParallelismlongNo

The maximum number of concurrent operations that can be performed on resources. By default, this parameter is empty. You can set this parameter to an integer that is greater than or equal to 0. If you set this parameter to a specific value, ROS associates the value with the stack. The value can affect subsequent operations on the stack.

This parameter takes effect only if you set ChangeSetType to CREATE or UPDATE.

  • Valid values for change sets of the CREATE type:

    • If you set this parameter to an integer that is greater than 0, the integer is used.
    • If you set this parameter to 0 or leave this parameter empty, no limit is imposed on ROS stacks. However, the default value in Terraform is used for Terraform stacks. In most cases, the default value in Terraform is 10.
  • Valid values for change sets of the UPDATE type:

    • If you set this parameter to an integer that is greater than 0, the integer is used.
    • If you set this parameter to 0, no limit is imposed on ROS stacks. However, the default value in Terraform is used for Terraform stacks. In most cases, the default value in Terraform is 10.
    • If you leave this parameter empty, the value that you specified for this parameter in the previous request is used. If you left this parameter empty in the previous request, no limit is imposed on ROS stacks. However, the default value in Terraform is used for Terraform stacks. In most cases, the default value in Terraform is 10.
1

For more information about common request parameters, see Common parameters.

Response parameters

ParameterTypeDescriptionExample
object
ChangeSetIdstring

The ID of the change set.

e85abe0c-6528-43fb-ae93-fdf8de22****
RequestIdstring

The ID of the request.

B288A0BE-D927-4888-B0F7-B35EF84B6E6F
StackIdstring

The ID of the stack.

4a6c9851-3b0f-4f5f-b4ca-a14bf691****

Examples

Sample success responses

JSONformat

{
  "ChangeSetId": "e85abe0c-6528-43fb-ae93-fdf8de22****",
  "RequestId": "B288A0BE-D927-4888-B0F7-B35EF84B6E6F",
  "StackId": "4a6c9851-3b0f-4f5f-b4ca-a14bf691****"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-01-11The internal configuration of the API is changed, but the call is not affectedsee changesets
Change itemChange content
The internal configuration of the API is changed, but the call is not affected.
2023-08-15The internal configuration of the API is changed, but the call is not affectedsee changesets
Change itemChange content
The internal configuration of the API is changed, but the call is not affected.