create_application_version ( $application_name, $version_label, $opt )

Creates an application version for the specified application.

Once you create an application version with a specified Amazon S3 bucket and key location, you cannot change that Amazon S3 location. If you change the Amazon S3 location, you receive an exception when you attempt to launch an environment from the application version.

Access

public

Parameters

Parameter

Type

Required

Description

$application_name

string

Required

The name of the application. If no application is found with this name, and AutoCreateApplication is false, returns an InvalidParameterValue error.

$version_label

string

Required

A label identifying this version. Constraint: Must be unique per application. If an application version already exists with this label for the specified application, AWS Elastic Beanstalk returns an InvalidParameterValue error.

$opt

array

Optional

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

  • Description - string - Optional - Describes this version.
  • SourceBundle - array - Optional - The Amazon S3 bucket and key that identify the location of the source bundle for this version. If data found at the Amazon S3 location exceeds the maximum allowed source bundle size, AWS Elastic Beanstalk returns an InvalidParameterValue error. Default: If not specified, AWS Elastic Beanstalk uses a sample application. If only partially specified (for example, a bucket is provided but not the key) or if no data is found at the Amazon S3 location, AWS Elastic Beanstalk returns an InvalidParameterCombination error.
    • x - array - Optional - This represents a simple array index.
      • S3Bucket - string - Optional - The Amazon S3 bucket where the data is located.
      • S3Key - string - Optional - The Amazon S3 key where the data is located.
  • AutoCreateApplication - boolean - Optional - Determines how the system behaves if the specified application for this version does not already exist: true: Automatically creates the specified application for this version if it does not already exist. false: Returns an InvalidParameterValue if the specified application for this version does not already exist.
    • true: Automatically creates the specified application for this release if it does not already exist.
    • false: Throws an InvalidParameterValue if the specified application for this release does not already exist.
    Default: false Valid Values: true | false
  • 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

Creates a new application version.

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

// Create a new S3 storage location for use with Elastic Beanstalk.
$s3_bucket = (string) $bean->create_storage_location()->body->S3Bucket()->first();

$response = $bean->create_application_version('my-application', '1.0', array(
	'Description' => 'Version 1.0 of the application.',
	'SourceBundle' => array(
		'S3Bucket' => 'elasticbeanstalk-us-east-1',
		'S3Key' => 'resources/sampleapp.war'
	),
	'AutoCreateApplication' => 'true'
));

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

Related Methods

Source

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

public function create_application_version($application_name, $version_label, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['ApplicationName'] = $application_name;
    $opt['VersionLabel'] = $version_label;
    
    // Optional map (non-list)
    if (isset($opt['SourceBundle']))
    {
        $opt = array_merge($opt, CFComplexType::map(array(
            'SourceBundle' => $opt['SourceBundle']
        ), 'member'));
        unset($opt['SourceBundle']);
    }

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

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback