Building Your First Orchestration v2

Sample Orchestration v2 for Creating a Single Instance

You can define all your cloud resources in a single orchestration and manage the resources individually.

Use the following sample JSON as a starting point for building your first orchestration.

{
  "description": "Simple orchestration with an instance, storage volumes, ssh key, and a security list",
  "name": "/Compute-acme/joe.jonathan@example.com/simple_orchestration",
  "desired_state": "active",
  "objects": [
    {
      "type": "SSHKey",
      "label": "my_key",
      "template": {
        "enabled": false,
        "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDzU21CEj6JsqIMQAYwNbmZ5P2BVxA...",
        "name": "/Compute-acme/jack.jones@example.com/key1"
       }
    },
    {
      "type": "SecList",
      "label": "my_seclist",
      "template": {
        "name": "/Compute-acme/joe.jonathan@example.com/my_instances"
      }
    },
    {
      "type": "StorageVolume",
      "label": "boot_volume",
      "description": "Boot disk for your instance",
      "persistent": true,
      "template": {
        "name": "/Compute-acme/jack.jones@example.com/BootVolume",
        "bootable": true,
        "imagelist": "/oracle/public/OL_6.7_UEKR4_x86_64",
        "properties": [
          "/oracle/public/storage/default"
         ],
         "size": "23G"
      }
    },
    {
      "type": "StorageVolume",
      "label": "data_volume",
      "description": "Data disk for your instance",
      "persistent": true,
      "template": {
        "name": "/Compute-acme/jack.jones@example.com/DataVolume",
        "properties": [
          "/oracle/public/storage/default"
         ],
         "size": "2G"
      }
    },
    {
      "type": "IPReservation",
      "label": "ip_reservation",
      "description": "IP reservation for your instance",
      "persistent": true,
      "template": {
        "parentpool": "/oracle/public/ippool",
        "permanent": true
      }
    },
    {
      "type": "Instance",
      "description": "demo instance",
      "label": "demo_instance",
      "template": {
        "label": "demo_instance",
        "shape": "oc3",
        "networking": {
          "eth0": {
            "seclists": [ "{{my_seclist:name}}" ],
            "nat": "ipreservation:{{ip_reservation:name}}"
          }
        },
        "storage_attachments": [
        {
          "index": 1,
          "volume": "{{boot_volume:name}}"
        },
        {
          "index": 2,
          "volume": "{{data_volume:name}}"
        }
        ],
      "boot_order": [1],
      "sshkeys": [
        "{{my_key:name}}"
        ]
      }
    }
  ],
  "tags": ["sample"]
}
This sample orchestration does the following:
  • Defines an instance with the label demo_instance, the oc3 shape, and using the /oracle/public/OL_6.7_UEKR4_x86_64 image.

  • Defines and associates an SSH public key with the label my_key with the instance.

  • Defines a security list with the label my_seclist and adds the instance to it.

  • Defines and attaches the bootable storage volume with the label boot_volume to the instance.

  • Defines and attaches the data storage volume with the label data_volume to the instance.

  • Defines an IP reservation with the label ip_reservation and associates it with the instance.

Note:

To learn about the structure of an orchestration, see Orchestration v2 Templates and Samples. For information about all the attributes that you can define in an orchestration, see Attributes in Orchestrations v2.

Steps for Building Your First Orchestration v2

  1. Copy the sample orchestration JSON to a plain text file, and open the file in any text editor.
  2. Replace the name of the orchestration with an appropriate three-part name (/Compute-identity_domain/user/object).

    Note:

    While editing the sample, remember to replace all the placeholder values with values specific to your environment. For example, replace the identity domain acme with your identity domain and the user name joe.jonathan@example.com with your user name.

  3. Change the value of the imagelist attribute to any image that you want to use.
  4. Under template, change the value of the label attribute to any label that you want.
  5. If you want to attach the instance to more security lists, define each security list in the orchestration, and reference each security list in the instance. In the instance object, remember to enclose each security-list name in double quotation marks and separate the security-list names by using commas. See the following example:
    "seclists": [
      "{{my_seclist:name}}",
      "{{my_devlist:name}}",
      "{{my_prodlist:name}}"
    ]
  6. If you’re creating a Linux instance enabled for SSH access, replace the key in the my_key object with your public key.
    If you want to add more SSH keys, define each key as an object in the orchestration, and reference each key in double quotation marks and separate the keys by using commas. See the following example:
    "sshkeys": [
      "{{my_key1:name}}",
      "{{my_key2:name}}",
      "{{my_key3:name}}"
    ]

    Note:

    You don’t need to do this if you’re creating a Windows instance, because you can’t log in to a Windows instance using SSH. To log in to your Windows instance using RDP, see Accessing a Windows Instance Using RDP.

  7. Save the JSON file.

    You should also validate your JSON file. You can do this by using a third-party tool, such as JSONLint, or any other validation tool of your choice. If your JSON format isn’t valid, then an error message is displayed when you upload the orchestration.

    Note:

    Oracle doesn’t support or endorse any third-party JSON-validation tool.

Your orchestration JSON file is ready now.

To create instances by using this orchestration, you must upload it to Compute Classic. See Uploading an Orchestration v2.