Creating Instances Using the CLI

For using the CLI, the name and configuration parameters of an orchestration are stored in a file in JavaScript Object Notation (JSON) format.

See Orchestration Templates for more information about orchestration format.

An example of working with an orchestration to add, start, monitor, and stop the instantiation of an instance is shown here. The orchestration in this example is stored in a file named myorch.json.

A sample format of the file:

{
  "name": "/mytenant/public/single_instance",
  "description": "Orchestration containing a single instance",
  "oplans": [
    {
      "obj_type": "launchplan",
      "label": "single_instance_plan",
      "objects": [
        {
          "instances": [
            {
              "name": "/mytenant/public/single_instance",
              "label": "single_instance",
              "shape": "oc3",
              "imagelist": "/oracle/public/linux6_16.1.1_64",
              "networking": {
                "net0": {
                  "vnet": "/mytenant/public/ipoib-vnet"
                }
              }
            }
          ]
        }
      ]
    }
  ]
}

Use the following steps to add and start the orchestration:

  1. Add the orchestration to the system.

    oracle-compute add orchestration myorch.json

    When you add the orchestration, the state of the orchestration is stopped.

  2. Start the orchestration.

    oracle-compute start orchestration /mytenant/public/single_instance -f json

    {
     "list": [
      {
       "status": "starting",
       "info": {},
        "warnings": {}
       },
       "account": "/mytenant/default",
       "description": "Orchestration containing a single instance",
       "relationships": [],
       "uri": "https://api/orchestration/mytenant/public/single_instance",
       "oplans": [
        {
         "status": "starting",
         "info": {},
          "warnings": {}
         },
         "obj_type": "launchplan",
         "ha_policy": "",
         "label": "single_instance_plan",
         "objects": [
          {
           "instances": [
            {
             "networking": {
              "net0": {
               "vnet": "/mytenant/public/myvnet"
              }
             },
             "name": "/mytenant/public/single_instance",
             "uri": null,
             "label": "single_instance",
             "shape": "oc3",
             "imagelist": "/oracle/public/linux6_16.1.1_64"
            }
           ]
          }
         ]
        }
       ],
       "status_timestamp": "2015-11-30T08:07:30Z",
       "name": "/mytenant/public/single_instance"
      }
     ]
    }
    
  3. Watch the orchestration progress.

    oracle-compute get orchestration /mytenant/public/single_instance -Fname,status

    The orchestration moves to the Ready status if no errors are reported. The orchestration is in full operation.

The instance is launched and moves to the running state.