Instances in OCI
tags :
Compute Instances or VM in OCI #
Available OS images source_type image and source_id reddit ref
Terraform resource core_instance
OCI compute overview documentation
resource "oci_core_instance" "llms_embeddings_parsers_compute_instance"
availability_domain = data.oci_identity_availability_domains.ADs.availability_domains[0]["name"]
compartment_id = var.compartment_ocid
display_name = "llms-embeddings-parsers-compute-instance"
# shape = "VM.Standard.E3.Flex"
shape = "VM.Standard.E2.1.Micro"
metadata =
ssh_authorized_keys = var.ssh_authorized_keys
create_vnic_details
# subnet_id = var.private_subnet_ocid
subnet_id = var.public_subnet_ocid
display_name = "nicnamenew$count.indexllmmanager"
hostname_label = "hostnamenew$count.indexllmmanager"
skip_source_dest_check = false
assign_public_ip = true
source_details
source_type = "image"
# Canonical-Ubuntu-22.04-2024.01.05-0
source_id = "ocid1.image.oc1.me-jeddah-1.aaaaaaaacmo6cytspaux6dacv2ee4j2xu4k5t2nljatxjmk2cf7g4d6aqdjq"
# source_id = "ocid1.image.oc1.sa-saopaulo-1.aaaaaaaalit6gg565vyysvcu3i5jxslligf2fng23tktjv4b2rfdoltfadcq"
count = 1
agent_config
is_management_disabled = "false"
is_monitoring_disabled = "false"
# shape_config
# ocpus = 1
# memory_in_gbs = 4
#
# launch_options
# boot_volume_type = "ISCSI"
# firmware = "UEFI_64"
#
Types of VM #
https://www.oracle.com/sa/cloud/compute/virtual-machines/#rc30p1
Shape Flexibility #
A flexible shape lets users customize the number of virtual CPUs (vCPUs) and the amount of memory (RAM) when launching or resizing virtual machines(VM).
- The Network bandwidth and number of virtual network interfaces (VNIC) scale proportionately with the number of. This flexibility lets engineers build VMs that match their workloads, enabling the organization to optimize performance and minimize cost.
The flexible shapes are:
- VM.Standard3.Flex ( Intel)
- VM.Standard.E4.Flex (AMD )
- VM.Standard.E5.Flex (AMD)
- VM.Standard.A1.Flex (ARM processor from )
- VM.DenseIO.E4.Flex (AMD)
- VM.Optimized3.Flex (Intel)
Compute flexibility #
ref Different CPU Architecture.
Standard shapes provide a balance of cores, memory, and network resources, and are available with Intel, AMD, and Arm-based processors. Dense I/O shapes can be used for large databases, big data workloads, and applications that require high-performance local storage. GPU shapes include Intel or AMD CPUs and NVIDIA graphics processors for AI/ML workloads and video rendering. Optimized shapes are ideal for high performance computing (HPC) workloads.
Features #
- Standard shapes support AMD,
- ARM-based Ampere, and Intel processors
- Additional shapes include dense I/O, GPU, optimized, and DVH
- Dense I/O shapes for applications that require high-performance local storage
- GPU shapes for hardware-accelerated workloads
- Optimized shapes for workloads that require high-frequency processor cores
Instance flexibility #
Burstable instances #
provide a baseline level of CPU performance with the ability to burst to a higher level to support occasional spikes in usage. Burstable instances are designed for scenarios where an instance is typically idle or has low CPU utilization with occasional spikes in usage. They’re also ideal for scaled-down workloads that don’t require a full core.
Preemptible #
instances improve economics for workloads that only need to run for brief periods or that can be interrupted when the capacity is reclaimed. Preemptible instances behave the same as regular compute instances, but the capacity is reclaimed when it’s needed elsewhere, and the instances are terminated.
Capacity flexibility #
On-demand capacity #
Pay for only the compute capacity consumed. With on-demand capacity, customers pay for compute capacity by the second, and pay only for the seconds that their instances are running.
Reserved capacity #
Reserve capacity for future usage, and ensure that capacity is available to create compute instances whenever it’s needed. When instances are terminated, the capacity is returned to the reservation, and the unused capacity in the reservation increases.
Dedicated capacity #
Run VM instances on dedicated servers that are a single tenant and not shared with other customers. This feature lets customers meet compliance and regulatory requirements or to meet host-based licensing requirements.
Opening Port #
open ports on the virtualmachine, stackoverflow #+jjkkrc sh sudo apt install firewalld sudo firewall-cmd –zone=public –permanent –add-port=80/tcp sudo firewall-cmd –reload #+end_src check if ports are opened
Ansible in Private Network #
Configuring a VM using Ansible via the OCI Bastion Service
Networking, how to increase network speed? #
Connection speed #
Connection between control or client machine and OCI cloud Increase or decrease bandwidth using Oracle Cloud Infrastructure FastConnect OCI URL
Could not increase the speed but using the command it is possible to install pip packages without persistent ssh connection.
nohup /opt/apps/venv/bin/python -m pip install -r backend/requirements.txt > ~/install_log.txt 2>&1 &
# even this is failing, the download is too slow, fails with https connection timeout error
Observation #
The speed of pip installation is affected, slow, other downloads are faster, checked `speedtest-cli`,
pip install speedtest-cli
speedtest-cli
and downloaded binaries files with wget was faster, I have seen download speeds of 1000Mbps
VM Firewall #
on the Ubuntu image used in the OCI, this firewalld library was used to managed VM . ref