update_stack ( $stack_name, $opt )

Updates a stack as specified in the template. After the call completes successfully, the stack update starts. You can check the status of the stack via the DescribeStacks action.

To get a copy of the template for an existing stack, you can use the GetTemplate action.

Tags that were associated with this stack during creation time will still be associated with the stack after an UpdateStack operation.

For more information about creating an update template, updating a stack, and monitoring the progress of the update, see Updating a Stack.

Access

public

Parameters

Parameter

Type

Required

Description

$stack_name

string

Required

The name or stack ID of the stack to update.

Must contain only alphanumeric characters (case sensitive) and start with an alpha character. Maximum length of the name is 255 characters.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • TemplateBody - string - Optional - Structure containing the template body. (For more information, go to the AWS CloudFormation User Guide.) Conditional: You must pass TemplateBody or TemplateURL. If both are passed, only TemplateBody is used.
  • TemplateURL - string - Optional - Location of file containing the template body. The URL must point to a template located in an S3 bucket in the same region as the stack. For more information, go to the AWS CloudFormation User Guide. Conditional: You must pass TemplateURL or TemplateBody. If both are passed, only TemplateBody is used.
  • Parameters - array - Optional - A list of Parameter structures that specify input parameters for the stack.
    • x - array - Optional - This represents a simple array index.
      • ParameterKey - string - Optional - The key associated with the parameter.
      • ParameterValue - string - Optional - The value associated with the parameter.
  • Capabilities - string|array - Optional - The list of capabilities that you want to allow in the stack. If your stack contains IAM resources, you must specify the CAPABILITY_IAM value for this parameter; otherwise, this action returns an InsufficientCapabilities error. IAM resources are the following: AWS::IAM::AccessKey, AWS::IAM::Group, AWS::IAM::Policy, AWS::IAM::User, and AWS::IAM::UserToGroupAddition. Pass a string for a single value, or an indexed array for multiple values.
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Source

Method defined in services/cloudformation.class.php | Toggle source view (25 lines) | View on GitHub

public function update_stack($stack_name, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['StackName'] = $stack_name;
    
    // Optional list + map
    if (isset($opt['Parameters']))
    {
        $opt = array_merge($opt, CFComplexType::map(array(
            'Parameters' => $opt['Parameters']
        ), 'member'));
        unset($opt['Parameters']);
    }
    
    // Optional list (non-map)
    if (isset($opt['Capabilities']))
    {
        $opt = array_merge($opt, CFComplexType::map(array(
            'Capabilities' => (is_array($opt['Capabilities']) ? $opt['Capabilities'] : array($opt['Capabilities']))
        ), 'member'));
        unset($opt['Capabilities']);
    }

    return $this->authenticate('UpdateStack', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback