Launching stacks from a command

The launch-stack command can be used to launch a stack from a blueprint. In order to launch a stack using the launch-stack command you will need to supply the command with the “inputs” required by the blueprint via a json file.

Tip

You can generate a “template” inputs json file by executing the get-blueprint command with the --geninput option (see below).


See also

For more details on the launch_stack command including additional options refer to the launch-stack command reference page in this document.

Example

In this example the blueprint with ID 90 will be launched. You can display the blueprints using the list-blueprints command to determine the blueprint ID.

Generate an inputs template json file with the inputs defined in the blueprint.

get-blueprint 90 --geninput chef_apache_inputs.json
Loading API environment
  API access validated
  API access key type is User, userId: 10
  Found public catalog, id= 15
  Found Company catalog, id= 10
Defaulting to Company catalog, id: 10
  Found 1 required inputs
Writing template to file (chef_apache_inputs.json)

Display the json file.

cat chef_apache_inputs.json
[
  {
    "cloudAccountId": 0,
    "serverProductId": 0,
    "name": "product_selector"
  }
]

Update the json file with the required values for the inputs.

  1. Determine the cloud account ID (cloudAccountId).

    You can execute the dcm-list-accounts command to display the cloud account(s).

    dcm-list-accounts
    
    +------------+--------------+----------+----------------+--------+
    | Account ID | Account Name | Customer | Default Budget | Status |
    +------------+--------------+----------+----------------+--------+
    | 201        | ACME AWS     | 200      | 200            | ACTIVE |
    +------------+--------------+----------+----------------+--------+
    
  2. Determine the server product ID (serverProductId) for the desired region in that cloud. In this example the desired region is us-east-1.

    You can execute the dcm-list-regions command to display the regions.

    dcm-list-regions
    
    +-----------+----------------+-------+----------------+----------------+--------+
    | Region ID | Provider ID    | Cloud | Region Name    | Description    | Status |
    +-----------+----------------+-------+----------------+----------------+--------+
    | 14        | ap-northeast-1 | 1     | ap-northeast-1 | ap-northeast-1 | ACTIVE |
    | 11        | ap-southeast-1 | 1     | ap-southeast-1 | ap-southeast-1 | ACTIVE |
    | 12        | ap-southeast-2 | 1     | ap-southeast-2 | ap-southeast-2 | ACTIVE |
    | 13        | eu-central-1   | 1     | eu-central-1   | eu-central-1   | ACTIVE |
    | 10        | eu-west-1      | 1     | eu-west-1      | eu-west-1      | ACTIVE |
    | 16        | sa-east-1      | 1     | sa-east-1      | sa-east-1      | ACTIVE |
    | 15        | us-east-1      | 1     | us-east-1      | us-east-1      | ACTIVE |
    | 17        | us-west-1      | 1     | us-west-1      | us-west-1      | ACTIVE |
    | 18        | us-west-2      | 1     | us-west-2      | us-west-2      | ACTIVE |
    +-----------+----------------+-------+----------------+----------------+--------+
    

    Execute the dcm-list-server-products command to get the server product ID. Specify the region ID on the command. In this example the server product ID for the m1.medium server product is being determined.

    dcm-list-server-products --regionid 15 | grep UNIX | grep "m1.medium"
    
    | 3008              | us-east-1          | m1.medium           | m1.medium                                      | UNIX     | USD      | 0.087       |
    

    Note

    In the above example the serverProductID for the m1.medium server product is 3008

  3. Edit the json inputs file and fill in the cloudAccountId and serverProductId.

    [
      {
        "cloudAccountId": 201,
        "serverProductId": 3008,
        "name": "product_selector"
      }
    ]
    
  4. Launch the stack from the blueprint by executing the launch_stack command. Specify the inputs json file, the blueprint ID and the stack name.

launch-stack --inputpath chef_apache_inputs.json 90 "acme-apache"
Loading API environment
  API access validated
  Found public catalog, id= 15
  Found Company catalog, id= 10
  Default Account found, id= 1 , name= Amazon Web Services
Defaulting to Company catalog, id: 10
Started Stack launch, jobId '239'