Creating a Compute Instance Group Environment
Learn how to create a reference to an instance group environment.
Before you begin, you need these things:
- 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.Note
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
ocarunuser with sudo privileges. Follow these steps:
- Follow the steps for creating an instance.
- To configure advanced settings, click Show Advanced Options.
- For Initialization Script, enter the following cloud-init script to grant the
#cloud-config users: - default - name: ocarun sudo: ALL=(ALL) NOPASSWD:ALL
- When you finish configuring the instance, click Create.
For more information, see Running Commands on an Instance.
Using the Console
- Open the navigation menu and click Developer Services. Under DevOps, click Projects.
- Select an existing project, or create a DevOps project.
- Click Create environment.
- For Environment type, select Instance Group.
- Enter a name and optional 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.
- Click Next.
To add instances, select one of the following options:
- Filter - Manually select the instances for the instance group.
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.
If you select Filter option, then follow these steps to add instances:
- Click Add instance.
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.
- Use the Filter by state, Filter by shape, and Filter by text fields to further narrow down the search for compute hosts.
- Select instances from the displayed list to create an instance group, and click Add instance.
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.
If you select Query option, then follow these steps to add instances:
- Click Edit query.
- Use the Region field to select compute hosts from a specific region.
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'.
- Click Add instance query.
- 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.
Using the CLI
To create a reference to an instance group environment, run the
oci devops deploy-environment create-compute-instance-environment
Required parameters for the
To get all the commands for
oci devops deploy-environment -h
To get help for the
oci devops deploy-environment create-compute-instance-environment -h
Using the API
To create a reference to an instance group environment, use the
deployEnvironmentType attribute, specify the