All Products
Search
Document Center

Resource Orchestration Service:UpdateStack

Last Updated:Feb 22, 2024

Updates a stack.

Operation description

The values of parameters in the Parameters section vary based on the value that you specify for the UsePreviousParameters parameter in the request. If you do not add the parameters that are defined in the template to the Parameters section, take note of the following items:

  • UsePreviousParameters is set to false: If the template parameters have default values, the default values are used. Otherwise, you must specify values for the template parameters in the Parameters section.
  • UsePreviousParameters is set to true: If you specify values for the template parameters when you create a stack, the values are used. If you leave the template parameters empty when you create a stack but the template parameters have default values, the default values are used.

This topic describes how to update a stack. In this example, the template body of a stack whose ID is 4a6c9851-3b0f-4f5f-b4ca-a14bf691**** in the China (Beijing) region 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:UpdateStackWRITE
  • stack
    acs:ros:{#regionId}:{#accountId}:stack/{#stackId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
StackIdstringYes

The ID of the stack.

4a6c9851-3b0f-4f5f-b4ca-a14bf691****
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 be up to 64 characters in length, and can contain letters, digits, hyphens (-), and underscores (_).

For more information, see Ensure idempotence.

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

The structure that contains the body of the temporary overriding stack policy. The policy body must be 1 to 16,384 bytes in length.

If you want to update protected resources, you must specify a temporary overriding stack policy during the update. If you do not specify a temporary overriding stack policy, the existing policy that is 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:

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

The timeout period for the update operation on the stack.

  • Default value: 60.
  • Unit: minutes.
10
TemplateBodystringNo

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 exceeds the upper limit, we recommend that you add parameters to the HTTP POST request body to prevent request failures caused by excessively long URLs.

Note You must specify only one of the following parameters: TemplateBody, TemplateURL, and TemplateId.
{"ROSTemplateFormatVersion": "2015-09-01"}
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 or oss://ros/stack-policy/demo?RegionId=cn-hangzhou. The policy file can be up to 16,384 bytes in length. If you do not specify the region ID of the OSS bucket, the value of the RegionId parameter is used.

Note You can specify only one of the StackPolicyBody and StackPolicyURL parameters.

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

oss://ros-stack-policy/demo
StackPolicyDuringUpdateURLstringNo

The URL of the file that contains the temporary overriding stack policy. 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 or 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 ID of the OSS bucket, the value of the RegionId parameter is used.

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

If you want to update protected resources, you must specify a temporary overriding stack policy during the update. If you do not specify a temporary overriding stack policy, the existing policy that is 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:

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

The structure that contains the stack policy body. The policy body must be 1 to 16,384 bytes in length.

Note You can specify only one of the StackPolicyBody and StackPolicyURL parameters.
{"Statement": [{"Action": "Update:*", "Resource": "*", "Effect": "Allow", "Principal": "*"}]}
UsePreviousParametersbooleanNo

Specifies whether to use the values specified in the previous request for the parameters that you do not specify in the current request.

Valid values:

  • true
  • false
true
RegionIdstringYes

The ID of the region in which the stack is deployed. You can call the DescribeRegions operation to query the most recent region list.

cn-beijing
DisableRollbackbooleanNo

Specifies whether to roll back the resources in the stack when the stack fails to be updated.

Default value: false. Valid values:

  • true
  • false
false
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 or oss://ros/template/demo?RegionId=cn-hangzhou. The template body must be 1 to 524,288 bytes in length. If you do not specify the region ID of the OSS bucket, the value of the RegionId parameter is used.

Note You must specify only one of the following parameters: TemplateBody, TemplateURL, and TemplateId.
oss://ros-template/demo
RamRoleNamestringNo

The name of the 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 RAM 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 assumes the existing RAM role that is associated with the stack. If no RAM roles are available, ROS uses a temporary credential that is generated from the credentials of your account.

The name of the RAM role can be up to 64 bytes in length.

test-role
ReplacementOptionstringNo

Specifies whether to enable the replacement update feature. If you cannot change resource properties, you can enable the replacement update feature to replace the resource properties. If the replacement update feature is used, the existing resource is deleted and a new resource is created. The physical ID of the new resource is different from the physical ID of the deleted resource.

Default value: Disabled. Valid values:

  • Enabled
  • Disabled
Note Changes have higher priorities than replacement updates.
Disabled
TemplateIdstringNo

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

Note You must specify only one of the following parameters: TemplateBody, TemplateURL, and TemplateId.
5ecd1e10-b0e9-4389-a565-e4c15efc****
TemplateVersionstringNo

The version of the template. This parameter takes effect only when the TemplateId parameter is specified.

v1
Parametersobject []No

The parameters.

ParameterKeystringYes

The name of parameter N. If you do not specify the name and value of a parameter, ROS uses the default name and value in the template.

Maximum value of N: 200.

Note The Parameters parameter is optional. If you specify Parameters, you must specify both Parameters.N.ParameterKey and Parameters.N.ParameterValue.
Amount
ParameterValuestringYes

The value of parameter N. Maximum value of N: 200.

Note The Parameters parameter is optional. If you specify Parameters, you must specify both Parameters.N.ParameterKey and Parameters.N.ParameterValue.
12
Tagsobject []No

The value of tag N that you want to add to the template.

KeystringYes

The key of tag N that you want to add to the stack.

Valid values of N: 1 to 20.

Note
  • The Tags parameter is optional. If you specify Tags, you must specify Tags.N.Key.
  • The tag of a stack is propagated to each resource that supports the tag feature in the stack. For more information, see Propagate tags.
  • usage
    ValuestringNo

    The value of tag N that you want to add to the stack.

    Valid values of N: 1 to 20.

    Note The tag of a stack is propagated to each resource that supports the tag feature in the stack. For more information, see Propagate tags.
    test
    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.

    Note
  • 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 Resource Orchestration Service (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.
  • If you set this parameter to a specific value, ROS associates the value with the stack. The value affects subsequent operations on the stack.
  • 1
    ResourceGroupIdstringNo

    The ID of the resource group.

    rg-acfmxazb4ph6aiy****
    DryRunbooleanNo

    Specifies whether only to validate the stack in the request. Default value: false. Valid values:

    • true: only validates the stack.
    • false: validates and updates the stack.
    Note When no changes are made during the update, the following rules apply: If you set the DryRun parameter to false, the NotSupported error code is returned. If you set the DryRun parameter to true, no error is reported.
    false
    DryRunOptionsarrayNo

    The dry run option in the list format. You can specify only one dry run option.

    Note This parameter takes effect only when DryRun is set to true.
    stringNo

    The dry run option. Valid values:

    • ParameterAnalysis.ConsiderCondition: performs parameter analysis with conditions considered. If you want to perform parameter analysis, we recommend that you use this option. Otherwise, conditions are calculated, and the parameter values before the stack is updated are used for the parameters involved in the calculation.
    Note This option takes effect only for stacks of the ROS type.
    • ParameterAnalysis.Disabled: disables parameter analysis. After this option is used, the Parameters* parameter is not returned in DryRunResult.
    ParameterAnalysis.ConsiderCondition

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

    Response parameters

    ParameterTypeDescriptionExample
    object
    RequestIdstring

    The ID of the request.

    B288A0BE-D927-4888-B0F7-B35EF84B6E6F
    StackIdstring

    The ID of the stack.

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

    The dry run result. This parameter is returned only if DryRun is set to true.

    ParametersAllowedToBeModifiedarray

    The parameters that can be modified. If you change only values of the parameters in a stack template and use the template to update the stack, no validation errors are caused.

    string

    The parameters that can be modified. If you change only values of the parameters in a stack template and use the template to update the stack, no validation errors are caused.

    param1
    ParametersConditionallyAllowedToBeModifiedarray

    The parameters that can be modified under specific conditions. If you change only values of the parameters in a stack template and use the template to update the stack, the new values of the parameters determine whether validation errors are caused.

    string

    The parameters that can be modified under specific conditions. If you change only values of the parameters in a stack template and use the template to update the stack, the new values of the parameters determine whether validation errors are caused.

    param2
    ParametersUncertainlyAllowedToBeModifiedarray

    The parameters that can be modified under uncertain conditions. If you change only values of the parameters in a stack template and use the template to update the stack, the actual running environment determines whether validation errors are caused.

    string

    The parameters that can be modified under uncertain conditions. If you change only values of the parameters in a stack template and use the template to update the stack, the actual running environment determines whether validation errors are caused.

    param3
    ParametersNotAllowedToBeModifiedarray

    The parameters that cannot be modified. If you change only values of the parameters in a stack template and use the template to update the stack, validation errors are caused.

    string

    The parameters that cannot be modified. If you change only values of the parameters in a stack template and use the template to update the stack, validation errors are caused.

    param4
    ParametersCauseInterruptionIfModifiedarray

    The parameters whose changes cause service interruptions.

    Note
  • This parameter is supported only for a small number of resource types.
  • This parameter is valid only for updates on ROS stacks.
  • string

    The parameter whose change causes a service interruption. If you change only values of the parameters in a stack template and use the template to update the stack, service interruptions are caused.

    param1
    ParametersConditionallyCauseInterruptionIfModifiedarray

    The parameters whose changes cause service interruptions under specific conditions.

    Note
  • This parameter is supported only for a small number of resource types.
  • This parameter is valid only for updates on ROS stacks.
  • string

    The parameter whose change causes a service interruption under specific conditions. If you change only values of the parameters in a stack template and use the template to update the stack, the new values and the update type determine whether service interruptions are caused.

    param2
    ParametersUncertainlyCauseInterruptionIfModifiedarray

    The parameters whose changes cause service interruptions under uncertain conditions.

    Note
  • This parameter is supported only for a small number of resource types.
  • This parameter is valid only for updates on ROS stacks.
  • string

    The parameter whose change causes a service interruption under uncertain conditions. If you change only values of the parameters in a stack template and use the template to update the stack, the actual running environment determines whether service interruptions are caused.

    param3
    ParametersCauseReplacementIfModifiedarray

    The parameters whose changes trigger replacement updates for resources.

    Note
  • This parameter can be returned only if ReplacementOption is set to Enabled.
  • This parameter is valid only for updates on ROS stacks.
  • string

    The parameter whose change triggers a replacement update for resources. If you change only values of the parameters in a stack template and use the template to update the stack, replacement updates are triggered for resources.

    param5
    ParametersConditionallyCauseReplacementIfModifiedarray

    The parameters whose changes trigger replacement updates for resources under specific conditions.

    Note
  • This parameter can be returned only if ReplacementOption is set to Enabled.
  • This parameter is valid only for updates on ROS stacks.
  • string

    The parameter whose change triggers a replacement update for resources under specific conditions. If you change only values of the parameters in a stack template and use the template to update the stack, the new values determine whether replacement updates are triggered for resources.

    param6
    ParametersUncertainlyCauseReplacementIfModifiedarray

    The parameters whose changes trigger replacement updates for resources under uncertain conditions.

    Note
  • This parameter can be returned only if ReplacementOption is set to Enabled.
  • This parameter is valid only for updates on ROS stacks.
  • string

    The parameter whose change triggers a replacement update for resources under uncertain conditions. If you change only values of the parameters in a stack template and use the template to update the stack, the actual running environment determines whether replacement updates are triggered for resources.

    param7
    Http status codeError codeError messageDescription
    400CircularDependencyCircular Dependency Found: {reason}.The error message returned because the template contains circular dependencies. reason indicates the cause of the error.
    400InvalidSchema{reason}.The error message returned because the template format is invalid. reason indicates the cause of the error.
    400InvalidTemplateAttributeThe Referenced Attribute ({resource} {name}) is incorrect.The error message returned because the resource property that is referenced in the Outputs section of the template is invalid. resource indicates the resource name. name indicates the property name.
    400InvalidTemplatePropertyTypeThe specified value type of ({resource} {section}) is incorrect.The error message returned because the type of the resource property that is defined in a section of the template is invalid. resource indicates the resource name. section indicates the section name.
    400InvalidTemplateReferenceThe specified reference "{name}" (in {referencer}) is incorrect.The error message returned because the template contains an invalid reference. name indicates the reference name. referencer indicates the referencer name.
    400InvalidTemplateSectionThe template section is invalid: {section}.The error message returned because the template contains an invalid section. section indicates the section name.
    400InvalidTemplateVersionThe template version is invalid: {reason}.The error message returned because the template version is invalid. reason indicates the cause of the error.
    400StackPolicyValidationFailedAction denied by stack policy: {reason}.The error message returned because the update failed to be validated based on the stack policy. reason indicates the cause of the error.
    400StackValidationFailed{reason}.The error message returned because the stack failed to be validated. reason indicates the cause of the error.
    400UnknownUserParameterThe Parameter ({name}) was not defined in template.The error message returned because the specified parameter is not defined in the template. name indicates the parameter name.
    400UserParameterMissingThe Parameter {name} was not provided.The error message returned because no value is specified for the parameter that is defined in the template. name indicates the parameter name.
    404StackNotFoundThe Stack ({name}) could not be found.The error message returned because the stack does not exist. name indicates the name or ID of the stack.
    409ActionInProgressStack {name} already has an action ({action}) in progress.The error message returned because the stack is being changed. name indicates the name or ID of the stack. action indicates the change operation.
    404TemplateNotFoundThe Tempalte ({ ID }) could not be found.The error message returned because the template does not exist. ID indicates the ID of the template.
    404TemplateNotFoundThe Template { ID } with version { version } could not be found.The error message returned because the template or template version does not exist. ID indicates the ID of the template. version indicates the version of the template.

    Examples

    Sample success responses

    JSONformat

    {
      "RequestId": "B288A0BE-D927-4888-B0F7-B35EF84B6E6F",
      "StackId": "4a6c9851-3b0f-4f5f-b4ca-a14bf691****",
      "DryRunResult": {
        "ParametersAllowedToBeModified": [
          "param1"
        ],
        "ParametersConditionallyAllowedToBeModified": [
          "param2"
        ],
        "ParametersUncertainlyAllowedToBeModified": [
          "param3"
        ],
        "ParametersNotAllowedToBeModified": [
          "param4"
        ],
        "ParametersCauseInterruptionIfModified": [
          "param1"
        ],
        "ParametersConditionallyCauseInterruptionIfModified": [
          "param2"
        ],
        "ParametersUncertainlyCauseInterruptionIfModified": [
          "param3"
        ],
        "ParametersCauseReplacementIfModified": [
          "param5"
        ],
        "ParametersConditionallyCauseReplacementIfModified": [
          "param6"
        ],
        "ParametersUncertainlyCauseReplacementIfModified": [
          "param7"
        ]
      }
    }

    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-07-27The request parameters of the API has changed. The response structure of the API has changedsee changesets
    Change itemChange content
    Input ParametersThe request parameters of the API has changed.
      Added Input Parameters: DryRunOptions
    Output ParametersThe response structure of the API has changed.