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, regionfrom oci_core_instance;
select display_name, id, time_created, lifecycle_state as state, shape, regionfrom 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_namefrom 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_namefrom oci_core_instance as inst inner join oci_identity_compartment as comp on inst.compartment_id = comp.idorder 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 countfrom oci_core_instancegroup by shape;
select shape, count(shape) as countfrom oci_core_instancegroup 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_gbsfrom 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_gbsfrom oci_core_instance;
Query examples
- blockstorage_block_volume_attached_instances
- blockstorage_block_volume_unattached_report
- blockstorage_boot_volume_attached_instances
- blockstorage_boot_volume_unattached_report
- compute_images_for_compute_instance
- compute_instance_1_year
- compute_instance_24_hrs
- compute_instance_30_days
- compute_instance_365_days
- compute_instance_90_days
- compute_instance_age_report
- compute_instance_by_compartment
- compute_instance_by_creation_month
- compute_instance_by_public_ip
- compute_instance_by_region
- compute_instance_by_tenancy
- compute_instance_by_type
- compute_instance_core
- compute_instance_count
- compute_instance_input
- compute_instance_launch_options
- compute_instance_monitoring
- compute_instance_monitoring_disabled_count
- compute_instance_overview
- compute_instance_public_instance_count
- compute_instance_shape
- compute_instance_state
- compute_instance_tag
- compute_instance_total_cores
- vcn_network_security_group_assoc
Control examples
Schema for oci_core_instance
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
agent_config | jsonb | Options for the Oracle Cloud Agent software running on the instance. | |
availability_config | jsonb | Options for defining the availability of a VM instance after a maintenance event that impacts the underlying hardware. | |
availability_domain | text | = | The availability domain the instance is running in. |
capacity_reservation_id | text | = | The OCID of the compute capacity reservation this instance is launched under. |
compartment_id | text | = | The OCID of the compartment in Tenant in which the resource is located. |
dedicated_vm_host_id | text | The OCID of dedicated VM host. | |
defined_tags | jsonb | Defined 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_name | text | = | A user-friendly name. Does not have to be unique, and it's changeable. |
extended_metadata | jsonb | Additional metadata key/value pairs that user provided to instance. | |
fault_domain | text | The 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_tags | jsonb | Free-form tags for resource. This tags can be applied by any user with permissions on the resource. | |
id | text | = | The OCID of the instance. |
instance_options | jsonb | Optional mutable instance options. | |
ipxe_script | text | When 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_mode | text | Specifies the configuration mode for launching virtual machine (VM) instances. | |
launch_options | jsonb | LaunchOptions Options for tuning the compatibility and performance of VM shapes. | |
lifecycle_state | text | = | The current state of the instance. |
metadata | jsonb | Custom metadata that you provided to instance. | |
platform_config | jsonb | The platform configuration for the instance. | |
region | text | The OCI region in which the resource is located. | |
shape | text | The shape of the instance. The shape determines the number of CPUs and the amount of memory allocated to the instance. | |
shape_config | jsonb | The shape configuration for an instance. The shape configuration determines the resources allocated to an instance. | |
shape_config_baseline_ocpu_utilization | text | The baseline OCPU utilization for a subcore burstable VM instance. | |
shape_config_gpus | bigint | The number of GPUs available to the instance. | |
shape_config_local_disks | bigint | The number of local disks available to the instance. | |
shape_config_local_disks_total_size_in_gbs | double precision | The aggregate size of all local disks, in gigabytes. | |
shape_config_max_vnic_attachments | bigint | The maximum number of VNIC attachments for the instance. | |
shape_config_memory_in_gbs | double precision | The total amount of memory available to the instance, in gigabytes. | |
shape_config_networking_bandwidth_in_gbps | double precision | The networking bandwidth available to the instance, in gigabits per second. | |
shape_config_ocpus | double precision | The total number of OCPUs available to the instance. | |
source_details | jsonb | Contains the details of the source image for the instance. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
system_tags | jsonb | Tags added to instances by the service. | |
tags | jsonb | A map of tags for the resource. | |
tenant_id | text | =, !=, ~~, ~~*, !~~, !~~* | The OCID of the Tenant in which the resource is located. |
tenant_name | text | The name of the Tenant in which the resource is located. | |
time_created | timestamp with time zone | The date and time the instance was created | |
time_maintenance_reboot_due | timestamp with time zone | The 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. | |
title | text | Title 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