This topic describes how to use Alibaba Cloud CLI version 3.0.25 or later to call the API operations related to change sets.
CreateChangeSet
You can call this operation to create a change set.
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateChangeSet |
The operation that you want to perform. Set the value to CreateChangeSet. |
ChangeSetName | String | Yes | MyChangeSet |
The name of the change set. The name can be up to 255 characters in length, and can contain digits, letters, hyphens (-), and underscores (_). It must start with a letter or digit. Note You must ensure that the name is unique among all change sets associated with a specified
stack.
|
Parameters.N.ParameterKey | String | Yes | Amount |
The key of parameter N. If the key and value of the parameter are not specified, the key and value in the template are used by default. Maximum value of N: 200. |
Parameters.N.ParameterValue | String | Yes | 12 |
The value of parameter N. Maximum value of N: 200. |
RegionId | String | Yes | cn-hangzhou |
The region ID of the change set. You can call the DescribeRegions operation to query the most recent region list. For more information about DescribeRegions, see DescribeRegions. |
StackId | String | No | 4a6c9851-3b0f-4f5f-b4ca-a14bf691**** |
The ID of the stack for which you want to create the change set. ROS generates the change set by comparing the stack information with the information that you submit, such as a modified template or different inputs. This parameter takes effect only when the ChangeSetType parameter is set to UPDATE. |
StackPolicyURL | String | No | oss://ros/stack-policy/demo |
The URL for the file that contains the stack policy. The URL must point to a policy located in an HTTP or HTTPS web server or an Alibaba Cloud OSS bucket. Examples: oss://ros/stack-policy/demo and oss://ros/stack-policy/demo?RegionId=cn-hangzhou. The policy can be up to 16,384 bytes in length and the URL can be up to 1,350 bytes in length. Note If the region of the OSS bucket is not specified, the RegionId parameter value is
used by default.
You can specify one of the StackPolicyBody and StackPolicyURL parameters, but you cannot specify both of them. When you set the ChangeSetType parameter to CREATE, you can specify one of the StackPolicyBody and StackPolicyURL parameters, but you cannot specify both of them. When you set the ChangeSetType parameter to UPDATE, you can specify only one of the following parameters:
|
StackPolicyBody | String | No | {"Statement":[{"Effect":"Allow","Action":"Update:*","Principal":"*","Resource":"*"}]} |
The structure that contains the stack policy body. The stack policy body must be 1 to 16,384 bytes in length. When you set the ChangeSetType parameter to CREATE, you can specify one of the StackPolicyBody and StackPolicyURL parameters, but you cannot specify both of them. When you set the ChangeSetType parameter to UPDATE, you can specify only one of the following parameters:
|
StackName | String | No | MyStack |
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 (_). It must start with a letter or digit. This parameter takes effect only when the ChangeSetType parameter is set to CREATE. |
UsePreviousParameters | Boolean | No | true |
Specifies whether to use the values that were passed last time for the parameters that you do not specify in the current request. Default value: false. Valid values:
This parameter takes effect only when the ChangeSetType parameter is set to UPDATE. |
ChangeSetType | String | No | UPDATE |
The type of the change set. Default value: UPDATE. Valid values:
If you create a change set for a new stack, ROS creates a stack with a unique stack ID. The stack is in the REVIEW_IN_PROGRESS state until you execute the change set. You cannot use the UPDATE type to create a change set for a new stack or the CREATE type to create a change set for an existing stack. |
Description | String | No | It is a demo. |
The description of the change set. The description can be up to 1,024 bytes in length. |
ClientToken | String | No | 123e4567-e89b-12d3-a456-42665544**** |
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 ensure that it is unique among different requests. It can be up to 64 characters in length, and can contain letters, digits, hyphens (-), and underscores (_). For more information, see How to ensure idempotence. |
TemplateURL | String | No | oss://ros/template/demo |
The URL for the file that contains the template body. The URL must point to a template located in an HTTP or HTTPS web server or an Alibaba Cloud OSS bucket. Examples: oss://ros/template/demo and oss://ros/template/demo?RegionId=cn-hangzhou. The template can be up to 524,288 bytes in length, and the URL can be up to 1,024 bytes in length. Note If the region of the OSS bucket is not specified, the RegionId parameter value is
used by default.
You must specify one of the TemplateBody and TemplateURL parameters, but you cannot specify both of them. |
StackPolicyDuringUpdateURL | String | No | oss://ros/stack-policy/demo |
The URL for the file that contains the temporary overriding stack policy. The URL must point to a policy located in an HTTP or HTTPS web server or an Alibaba Cloud OSS bucket. Examples: oss://ros/stack-policy/demo and oss://ros/stack-policy/demo?RegionId=cn-hangzhou. The policy can be up to 16,384 bytes in length and the URL can be up to 1,350 bytes in length. Note If the region of the OSS bucket is not specified, the RegionId parameter value is
used by default.
You can specify one of the StackPolicyBody and StackPolicyURL parameters, but you cannot specify both of them. To update protected resources, specify a temporary overriding stack policy during the update. If you do not specify a stack policy, the current policy that is associated with the stack will be used. This parameter takes effect only when the ChangeSetType parameter is set to UPDATE. You can specify only one of the following parameters:
|
TemplateBody | String | No | {"ROSTemplateFormatVersion":"2015-09-01"} |
The structure that contains 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 avoid request failures due to excessive length of URLs. You must specify one of the TemplateBody and TemplateURL parameters, but you cannot specify both of them. |
TimeoutInMinutes | Long | No | 12 |
The amount of time that can elapse before the stack status changes to CREATE_FAILED or UPDATE_FAILED. This parameter is required when the ChangeSetType parameter is set to CREATE. This parameter is optional when the ChangeSetType parameter is set to UPDATE.
|
DisableRollback | Boolean | No | false |
Specifies whether to disable rollback on stack creation failure. Default value: false. Valid values:
This parameter takes effect only when the ChangeSetType parameter is set to CREATE. |
StackPolicyDuringUpdateBody | String | No | {"Statement":[{"Effect":"Allow","Action":"Update:*","Principal":"*","Resource":"*"}]} |
The structure that contains the body of the temporary overriding stack policy. The stack policy body must be 1 to 16,384 bytes in length. To update protected resources, specify a temporary overriding stack policy to take effect during the update. If no stack policy is specified for this parameter, the current policy associated with the stack is used. This parameter takes effect only when the ChangeSetType parameter is set to UPDATE. You can specify only one of the following parameters:
|
NotificationURLs.N | RepeatList | No | http://my-site.com/ros-notify |
The callback URL that is used to receive stack event N. Only HTTP POST is supported.
Note ROS does not send notifications when the stack is in the IN_PROGRESS state.
Notifications are sent regardless of whether the Outputs parameter is specified. The following segment is an example of a notification:
|
RamRoleName | String | No | test-role |
The name of the RAM role. ROS assumes the specified RAM role to create the stack and call API operations by using the credentials of the role. All operations will be performed under this role. If a RAM user is authorized to perform operations on the stack but does not have the permission to use the role, ROS still uses the role and grants the role the least privilege. If you do not specify this parameter, ROS uses the role previously associated with the stack. If no roles are available, ROS uses the temporary credentials generated from the credentials of your account. The RAM role name can be up to 64 characters in length. |
Sample requests
aliyun ros CreateChangeSet --RegionId cn-beijing --ChangeSetName MyChangeSet --Parameters.1.ParameterKey Amount --Parameters.1.ParameterValue --TemplateURL oss://ros/template/demo
Sample success responses
{
"ChangeSetId":"e8dshe0c-6428-46ab-a5g3-fddss6hg****",
"StackId":"4a6c2547-3v5f-4y7f-bs8a-a14bf639****",
"RequestId":"9C039DDC-98B2-4668-9FCC-EAE9BAEFDD36"
}
GetChangeSet
You can call this operation to query information about a change set.
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | GetChangeSet | The operation that you want to perform. Set the value to GetChangeSet. |
ChangeSetId | String | Yes | 1f6521a4-05af-4975-afe9-bc4b45ad**** |
The ID of the change set. |
--RegionId | String | Yes | cn-hangzhou |
The region ID of the change set. You can call the DescribeRegions operation to query the most recent region list. For more information about DescribeRegions, see DescribeRegions. |
--ShowTemplate | Boolean | No | true |
Specifies whether to show the template. Default value: false. |
Sample requests
aliyun ros GetChangeSet --ChangeSetId 1f6521a4-05af-4975-afe9-bc4b45ad**** --ShowTemplate true
Sample success responses
{ "ExecutionStatus":"AVAILABLE",
"Parameters":[
{
"ParameterValue":"342546988786****",
"ParameterKey":"ALIYUN::AccountId"
},
{
"ParameterValue":"None",
"ParameterKey":"ALIYUN::NoValue"
},
{
"ParameterValue":"cn-beijing",
"ParameterKey":"ALIYUN::Region"
},
{
"ParameterValue":"c18d62d8-51ce-4e8e-b8f6-e00be431****",
"ParameterKey":"ALIYUN::StackId"
},
{
"ParameterValue":"MyStack",
"ParameterKey":"ALIYUN::StackName"
},
{
"ParameterValue":"sg-bfwb3h3eosga1tj5****",
"ParameterKey":"SecurityGroupId"
}
],
"Changes":[
{
"Type":"Resource",
"ResourceChange":{
"LogicalResourceId":"WebServer",
"ResourceType":"ALIYUN::ECS::Instance",
"Action":"Add",
"Details":[],
"Scope":[]
}
}
],
"Description":"It is a demo.",
"TimeoutInMinutes":12,
"ChangeSetId":"1f6521a4-05af-4975-afe9-bc4b45ad****", "StackId":"c18d62d8-51ce-4e8e-b8f6-e00be431****",
"DisableRollback":false,
"ChangeSetName":"MyChangeSet",
"ChangeSetType":"CREATE",
"StackName":"MyStack",
"Status":"CREATE_COMPLETE",
"TemplateBody":"{\"ROSTemplateFormatVersion\":\"2015-09-01\",\"Parameters\":{\"SecurityGroupId\":{\"Type\":\"String\"}},\"Resources\":{\"WebServer\":{\"Type\":\"ALIYUN::ECS::Instance\",\"Properties\":{\"ImageId\":\"centos_7\",\"InstanceType\":\"ecs.c6.large\",\"SecurityGroupId\":{\"Ref\":\"SecurityGroupId\"}}}},\"Outputs\":{\"InstanceId\":{\"Value\":{\"Fn:GetAtt\":[\"WebServer\",\"InstanceId\"]}},\"PublicIp\":{\"Value\":{\"Fn:GetAtt\":[\"WebServer\",\"PublicIp\"]}}}}",
"RequestId":"A46D85A6-9C8E-4603-9989-1FF3F91512F6",
"RegionId":"cn-beijing",
"CreateTime":"2019-09-05T14:39:31"
}
DeleteChangeSet
You can call this operation to delete a change set.
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DeleteChangeSet |
The operation that you want to perform. Set the value to DeleteChangeSet. |
RegionId | String | Yes | cn-hangzhou |
The region ID of the change set. You can call the DescribeRegions operation to query the most recent region list. For more information about DescribeRegions, see DescribeRegions. |
ChangeSetId | String | Yes | 1f6521a4-05af-4975-afe9-bc4b45ad**** |
The ID of the change set. |
Sample requests
aliyun ros DeleteChangeSet --ChangeSetId 1f6521a4-05af-4975-afe9-bc4b45ad****
Sample success responses
{
"RequestId":"A74B9A63-C40A-41B9-9CCE-E4757E48FFA0"
}
ExecuteChangeSet
You can call this operation to execute a change set.
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ExecuteChangeSet |
The operation that you want to perform. Set the value to ExecuteChangeSet. |
RegionId | String | Yes | cn-hangzhou |
The region ID of the change set. You can call the DescribeRegions operation to query the most recent region list. For more information about DescribeRegions, see DescribeRegions. |
ChangeSetId | String | Yes | 1f6521a4-05af-4975-afe9-bc4b45ad**** |
The ID of the change set. |
Sample requests
aliyun ros ExecuteChangeSet --ChangeSetId 1f6521a4-05af-4975-afe9-bc4b45ad****
Sample success responses
{
"RequestId":"0A46C1A6-6823-43A7-8EF1-D8950DCF29D8"
}
ListChangeSets
You can call this operation to query the list of change sets.
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ListChangeSets |
The operation that you want to perform. Set the value to ListChangeSets. |
RegionId | String | Yes | cn-hangzhou |
The region ID of the change set. You can call the DescribeRegions operation to query the most recent region list. For more information about DescribeRegions, see DescribeRegions. |
StackId | String | Yes | 4a6c9851-3b0f-4f5f-b4ca-a14bf691**** |
The ID of the stack. |
ChangeSetName.N | RepeatList | No | MyChangeSet |
The name of change set N. Maximum value of N: 5. Fuzzy search with the asterisk (*) is supported. |
Status.N | RepeatList | No | CREATE_COMPLETE |
The status of change set N. Maximum value of N: 5. Valid values:
|
ExecutionStatus.N | RepeatList | No | AVAILABLE |
The execution status of change set N. Maximum value of N: 5. Valid values:
|
PageNumber | Long | No | 1 |
The number of the page to return. Pages start from page 1. Default value: 1. |
PageSize | Long | No | 10 |
The number of entries to return on each page. Valid values: 1 to 50. Default value: 10. |
ChangeSetId | String | No | 1f6521a4-05af-4975-afe9-bc4b45ad**** |
The ID of the change set. If the detailed information about the change set is not needed, you can use this parameter to replace the GetChangeSet operation. |
Sample requests
aliyun ros ListChangeSets --StackId 4a6c9851-3b0f-4f5f-b4ca-a14bf691****
Sample success responses
{
"PageNumber":1,
"TotalCount":1,
"PageSize":10,
"RequestId":"24AA105D-6AFB-4EBD-923A-DC3A5B10D62A",
"ChangeSets":[
{
"ExecutionStatus":"AVAILABLE",
"Status":"CREATE_COMPLETE",
"Description":"It is a demo.",
"ChangeSetId":"1f6521a4-05af-4975-afe9-bc4b45ad****",
"StackId":"a6c9851-3b0f-4f5f-b4ca-a14bf691****",
"RegionId":"cn-beijing",
"CreateTime":"2019-09-05T14:39:31",
"ChangeSetName":"MyChangeSet",
"ChangeSetType":"UPDATE",
"StackName":"MyStack"
}
]
}