steampipe plugin install oci

Table: oci_core_instance - Query OCI Core Instances using SQL

Oracle Cloud Infrastructure (OCI) Core Instances are virtual server hosts in the cloud. They are the basic compute unit and can be customized based on the needs of the application. Core Instances help in running applications, hosting websites, and supporting large scale analytics scenarios.

Table Usage Guide

The oci_core_instance table provides insights into the Core Instances within Oracle Cloud Infrastructure (OCI). As a Cloud Engineer, you can explore instance-specific details through this table, including instance configurations, state, and associated metadata. Utilize it to uncover information about instances, such as those with specific shapes, the availability domains of instances, and the verification of instance configurations.

Examples

Basic info

Discover the segments that are crucial in understanding the status and location of instances in Oracle Cloud Infrastructure. This can be useful in managing resources and optimizing performance across different regions.

select
display_name,
id,
time_created,
lifecycle_state as state,
shape,
region
from
oci_core_instance;
select
display_name,
id,
time_created,
lifecycle_state as state,
shape,
region
from
oci_core_instance;

List instances along with the compartment details

Determine the areas in which specific instances are located and their associated compartment details, helping to better manage and organize your resources.

select
inst.display_name,
inst.id,
inst.shape,
inst.region,
comp.name as compartment_name
from
oci_core_instance inst
inner join oci_identity_compartment comp on (inst.compartment_id = comp.id)
order by
comp.name,
inst.region,
inst.shape;
select
inst.display_name,
inst.id,
inst.shape,
inst.region,
comp.name as compartment_name
from
oci_core_instance as inst
inner join oci_identity_compartment as comp on inst.compartment_id = comp.id
order by
comp.name,
inst.region,
inst.shape;

Count the number of instances by shape

Analyze the distribution of instances based on their shape to understand the usage pattern and optimize resource allocation. This can help in making informed decisions about infrastructure scaling and cost management.

select
shape,
count(shape) as count
from
oci_core_instance
group by
shape;
select
shape,
count(shape) as count
from
oci_core_instance
group by
shape;

List instances with shape configuration details

Explore instances to understand their configuration details such as maximum VNIC attachments, memory, networking bandwidth, OCPUs, GPU, and local disk size. This can help in assessing the resources consumed by these instances and planning for future resource allocation.

select
display_name,
shape_config_max_vnic_attachments,
shape_config_memory_in_gbs,
shape_config_networking_bandwidth_in_gbps,
shape_config_ocpus,
shape_config_baseline_ocpu_utilization,
shape_config_gpus,
shape_config_local_disks,
shape_config_local_disks_total_size_in_gbs
from
oci_core_instance;
select
display_name,
shape_config_max_vnic_attachments,
shape_config_memory_in_gbs,
shape_config_networking_bandwidth_in_gbps,
shape_config_ocpus,
shape_config_baseline_ocpu_utilization,
shape_config_gpus,
shape_config_local_disks,
shape_config_local_disks_total_size_in_gbs
from
oci_core_instance;

Schema for oci_core_instance

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
agent_configjsonbOptions for the Oracle Cloud Agent software running on the instance.
availability_configjsonbOptions for defining the availability of a VM instance after a maintenance event that impacts the underlying hardware.
availability_domaintext=The availability domain the instance is running in.
capacity_reservation_idtext=The OCID of the compute capacity reservation this instance is launched under.
compartment_idtext=The OCID of the compartment in Tenant in which the resource is located.
dedicated_vm_host_idtextThe OCID of dedicated VM host.
defined_tagsjsonbDefined tags for resource. Defined tags are set up in your tenancy by an administrator. Only users granted permission to work with the defined tags can apply them to resources.
display_nametext=A user-friendly name. Does not have to be unique, and it's changeable.
extended_metadatajsonbAdditional metadata key/value pairs that user provided to instance.
fault_domaintextThe name of the fault domain the instance is running in. A fault domain is a grouping of hardware and infrastructure within an availability domain.
freeform_tagsjsonbFree-form tags for resource. This tags can be applied by any user with permissions on the resource.
idtext=The OCID of the instance.
instance_optionsjsonbOptional mutable instance options.
ipxe_scripttextWhen a bare metal or virtual machine instance boots, the iPXE firmware that runs on the instance is configured to run an iPXE script to continue the boot process.
launch_modetextSpecifies the configuration mode for launching virtual machine (VM) instances.
launch_optionsjsonbLaunchOptions Options for tuning the compatibility and performance of VM shapes.
lifecycle_statetext=The current state of the instance.
metadatajsonbCustom metadata that you provided to instance.
platform_configjsonbThe platform configuration for the instance.
regiontextThe OCI region in which the resource is located.
shapetextThe shape of the instance. The shape determines the number of CPUs and the amount of memory allocated to the instance.
shape_configjsonbThe shape configuration for an instance. The shape configuration determines the resources allocated to an instance.
shape_config_baseline_ocpu_utilizationtextThe baseline OCPU utilization for a subcore burstable VM instance.
shape_config_gpusbigintThe number of GPUs available to the instance.
shape_config_local_disksbigintThe number of local disks available to the instance.
shape_config_local_disks_total_size_in_gbsdouble precisionThe aggregate size of all local disks, in gigabytes.
shape_config_max_vnic_attachmentsbigintThe maximum number of VNIC attachments for the instance.
shape_config_memory_in_gbsdouble precisionThe total amount of memory available to the instance, in gigabytes.
shape_config_networking_bandwidth_in_gbpsdouble precisionThe networking bandwidth available to the instance, in gigabits per second.
shape_config_ocpusdouble precisionThe total number of OCPUs available to the instance.
source_detailsjsonbContains the details of the source image for the instance.
system_tagsjsonbTags added to instances by the service.
tagsjsonbA map of tags for the resource.
tenant_idtextThe OCID of the Tenant in which the resource is located.
tenant_nametextThe name of the Tenant in which the resource is located.
time_createdtimestamp with time zoneThe date and time the instance was created
time_maintenance_reboot_duetimestamp with time zoneThe date and time the instance is expected to be stopped/started. After that time if instance hasn't been rebooted, Oracle will reboot the instance within 24 hours of the due time.
titletextTitle of the resource.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- oci

You can pass the configuration to the command with the --config argument:

steampipe_export_oci --config '<your_config>' oci_core_instance