The OCI Designer Toolkit Query Feature

July 15, 2020 | 3 minute read
Padraic Russell
Director of Software Development
Text Size 100%:

A couple of months ago, we introduced you to the OCI Designer Toolkit, or OKIT. OKIT simplifies provisioning allowing users to turn architecture diagrams into service instances on Oracle Cloud Infrastructure (OCI). We further showed you how to create reusable and customizable templates enabling teams to standardize their deployment architectures. Today I want to introduce the Query feature in OKIT.  With Query you can turn provisioned services back into architecture diagrams and it can help you start down the path of Infrastructure as Code.

The Query Option

OKIT includes an introspection tool that provides a holistic view of what is deployed in a region.  The Query feature interacts with the public OCI APIs using the OCI Python SDK, similar to OCI's Command Line Interface.

This simple deployment example below includes a load balancer and two instances provisioned into a single public subnet, all inside a virtual cloud network (VCN) which itself contains an Internet Gateway.  Viewing all the details in OCI Console requires navigation to multiple screens but with OKIT this information can be viewed in a single pane. The Query option pulls all of the details for the specified compartment, builds up the diagram, and separates them by region.

Using Queries

To get started, locate the Query option right off the main menu.

Query Dialog

The query dialog presents a few fields to consider before submitting the request.

  • Connection Profile: Select any connection profile defined in the configuration file referenced when OKIT was first deployed. 
  • Region(s): Select one or more OCI regions. This field supports multi-select and each region will be display in its own tab on the canvas.
  • Compartment: Select the compartment that will be used as the root of query. 

Query Results

Each region is displayed in its own tab.  As compartments are global in scope, they will appear across all region queried. In the previous example, the service instances were deployed in the US Phoenix region but notice that with the exception of the compartment, the contents are quite different in UK London where only a single server is deployed. The query results also include all of the properties for the service instances.

Similar to any OKIT document, the query result can be exported to an image file, automation code such as Terraform, Ansible, or you can make a few changes and deploy a new set of services using OCI’s Resource Manager. It is important to note that queries are only a snapshot-in-time and are not updated should anything change in the target OCI compartment itself.  The reverse is also true and changes in the OKIT document created from the query results are not propagated to your OCI environment. In other words, OKIT is not coupled to the provisioned services in OCI in any way.

Post Deployment Documentation and Automation

If you are too busy to fire up your favorite diagramming tool and document your architecture, OKIT can create the diagram dynamically for you. The Query feature will let you take this task off your ever-growing to do list. If you have been too busy iterating on your OCI deployment and now wish you had created code to automate provisioning, OKIT can minimize that reverse engineering step. No more excuses for skipping documentation and no more regrets wishing you had started with automating your infrastructure deployments. With OKIT it is never too late.

Future Posts

The screenshots in this article are based off of OKIT v0.8.0 released in July of 2020.  OKIT remains under active development and is available on GitHub.  New features are added with each release. Keep an eye out for future posts on more advanced OKIT features including Fragments and how to use OKIT directly with OCI’s Resource Manager.

Padraic Russell

Director of Software Development

Previous Post

Calling OCI CLI Using Instance Principal

Vivek Singh | 3 min read

Next Post

Automated CLI Scripts to Scale Autonomous Database CPUs

Vivek Singh | 5 min read