update_environment ( $opt )

Updates the environment description, deploys a new application version, updates the configuration settings to an entirely new configuration template, or updates select configuration option values in the running environment.

Attempting to update both the release and configuration is not allowed and AWS Elastic Beanstalk returns an InvalidParameterCombination error.

When updating the configuration settings to a new template or individual settings, a draft configuration is created and DescribeConfigurationSettings for this environment returns two setting descriptions with different DeploymentStatus values.

Access

public

Parameters

Parameter

Type

Required

Description

$opt

array

Optional

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

  • EnvironmentId - string - Optional - The ID of the environment to update. If no environment with this ID exists, AWS Elastic Beanstalk returns an InvalidParameterValue error. Condition: You must specify either this or an EnvironmentName, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error.
  • EnvironmentName - string - Optional - The name of the environment to update. If no environment with this name exists, AWS Elastic Beanstalk returns an InvalidParameterValue error. Condition: You must specify either this or an EnvironmentId, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error.
  • VersionLabel - string - Optional - If this parameter is specified, AWS Elastic Beanstalk deploys the named application version to the environment. If no such application version is found, returns an InvalidParameterValue error.
  • TemplateName - string - Optional - If this parameter is specified, AWS Elastic Beanstalk deploys this configuration template to the environment. If no such configuration template is found, AWS Elastic Beanstalk returns an InvalidParameterValue error.
  • Description - string - Optional - If this parameter is specified, AWS Elastic Beanstalk updates the description of this environment.
  • OptionSettings - array - Optional - If specified, AWS Elastic Beanstalk updates the configuration set associated with the running environment and sets the specified configuration options to the requested value.
    • x - array - Optional - This represents a simple array index.
      • Namespace - string - Optional - A unique namespace identifying the option’s associated AWS resource.
      • OptionName - string - Optional - The name of the configuration option.
      • Value - string - Optional - The current value for the configuration option.
  • OptionsToRemove - array - Optional - A list of custom user-defined configuration options to remove from the configuration set for this environment.
    • x - array - Optional - This represents a simple array index.
      • Namespace - string - Optional - A unique namespace identifying the option’s associated AWS resource.
      • OptionName - string - Optional - The name of the configuration option.
  • 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.

Examples

Update an environment.

sleep(5);

// Instantiate the class
$bean = new AmazonElasticBeanstalk();

$response = $bean->update_environment(array(
	'EnvironmentName' => 'my-environment',
	'Description' => 'This is an updated environment description.',
	'OptionSettings' => array(
		array(
			'Namespace' => 'aws:elasticbeanstalk:sns:topics',
			'OptionName' => 'Notification Protocol',
			'Value' => 'sqs'
		),
		array(
			'Namespace' => 'aws:autoscaling:trigger',
			'OptionName' => 'MeasureName',
			'Value' => 'CPUUtilization'
		)
	),
	'OptionsToRemove' => array(
		array(
			'Namespace' => 'aws:autoscaling:asg',
			'OptionName' => 'MinSize'
		)
	)
));

// Success?
var_dump($response->isOK());
Result:
bool(true)

Related Methods

Source

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

public function update_environment($opt = null)
{
    if (!$opt) $opt = array();
            
    // Optional list + map
    if (isset($opt['OptionSettings']))
    {
        $opt = array_merge($opt, CFComplexType::map(array(
            'OptionSettings' => $opt['OptionSettings']
        ), 'member'));
        unset($opt['OptionSettings']);
    }
    
    // Optional list + map
    if (isset($opt['OptionsToRemove']))
    {
        $opt = array_merge($opt, CFComplexType::map(array(
            'OptionsToRemove' => $opt['OptionsToRemove']
        ), 'member'));
        unset($opt['OptionsToRemove']);
    }

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

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback