Creating a Compute Instance Group Environment

Create a reference to an instance group environment.


The prerequisites to create an instance group environment are as follows:

  • Create a compute instance.

    If you are creating an instance through a private network, then Network Address Translation (NAT) gateway must be set up. For more information, see NAT Gateway.


    DevOps only supports instance group deployments to Oracle Linux and CentOS.
  • If any of your commands in the instance group deployment configuration artifact require sudo privileges, then you have to grant ocarun user with sudo privileges. Follow these steps:
    1. Follow the steps for creating an instance.
    2. To configure advanced settings, click Show Advanced Options.
    3. For Initialization Script, enter the following cloud-init script to grant the sudo privilege:
       - default
       - name: ocarun
         sudo: ALL=(ALL) NOPASSWD:ALL
    4. When you finish configuring the instance, click Create.

    For more information, see Running Commands on an Instance.

For accessing DevOps using the Oracle Cloud Console, REST API, and CLI, see Accessing DevOps.

    1. Open the navigation menu and click Developer Services. Under DevOps, click Projects.
    2. On the DevOps Projects page, select an existing project, or create a DevOps project.
    3. On the details page of the project, from the left side, click Environments.
    4. On the Environments page, click Create environment.
    5. In the Basic information section, provide the following details and click Next:
      • Select Instance Group as the environment type.
      • Enter a name for the environment.
      • (Optional) Add a description for the environment.
      • (Optional) To add tags to the environment, click Show tagging options. Tagging is a metadata system that lets you organize and track the resources in your tenancy.

        If you have permissions to create a resource, you also have permissions to add free-form tags to that resource.

        To add a defined tag, you must have permissions to use the tag namespace.

        For more information, see Resource Tags.

    6. To add instances, select one of the following options:
      1. Filter - Manually select the instances for the instance group.
      2. Query - Specify a query to select instances at runtime.
        Queries apply search conditions to specific resource types and let you filter results. For more information, see Search Language Syntax.
    7. If you select Filter option, then follow these steps to add instances:
      1. Click Add instance.
      2. Use the Region and Compartment fields to select compute hosts from a specific region and compartment.

        Each instance group can have compute hosts only from one region at a time.
      3. Use the Filter by state, Filter by shape, and Filter by text fields to further narrow down the search for compute hosts.
      4. Select instances from the displayed list to create an instance group, and click Add instance.
      5. Select the instance group to reference.
        To remove instance from the group, click Remove instance. Removing instance from the group does not result in deletion of these instances. They remain in running state.
    8. If you select Query option, then follow these steps to add instances:
      1. Click Edit query.
      2. Use the Region field to select compute hosts from a specific region.
      3. Enter the query to add instances at runtime.
        DevOps includes the instances that match the query output during the deployment run. You can use this option to dynamically add instances for instance group deployment at runtime. Freeform tags can be used to tag the required resources in the query, for example, freeformTags.key = 'app' && freeformTags.value = 'helloword'.
      1. Click Add instance query.
    9. Click Create environment.

    A reference to the selected instance group environment is created. You can create a deployment pipeline to deploy artifacts to instance groups.

  • To create a reference to an instance group environment, run the create-compute-instance-environment command:

    oci devops deploy-environment create-compute-instance-environment

    Required parameters for the create-compute-instance-environment command:

    • --compute-instance-group-selectors
    • --project-id

    To get all the commands for deploy-environment:

    oci devops deploy-environment -h

    To get help for the create-compute-instance-environment command:

    oci devops deploy-environment create-compute-instance-environment -h
  • To create a reference to an instance group environment, use the CreateDeployEnvironment operation. For the deployEnvironmentType attribute, specify the COMPUTE_INSTANCE_GROUP value.