We can retrieve Instance Metadata like OCID, Display Name, Region, Availability Domain, Fault domain, Compartment OCID, Instance shape, Subnet CIDR, etc in three ways.
Using oci-metadata
- With Linux7, The oci-metadata utility is used to display or update metadata for a compute instance running in the Oracle Cloud Infrastructure.
- “oci-metadata” utility is provided by the rpm oci-utils which is installed by default on all the Oracle-provided Linux images.
#oci-metadata Instance details: Display Name: tech Region: uk-london-1 Canonical Region Name: us-ashburn-1 Availability Domain: DSdu:US-ASHBURN-1-AD-3 Fault domain: FAULT-DOMAIN-1 OCID: ocid1.instance.oc1.us-ashburn-1.abwgiljrfu6w22gihsxj4h6m6ybabv3mb23edmqhj4kamvv2sdodk7voplfq Compartment OCID: ocid1.compartment.oc1..aaaaaaaamlbsubwajqyvzyrqas6e6sbl3iqp55u6yloyxmg4muaks5xvxbuq Instance shape: VM.Standard2.1 Image ID: ocid1.image.oc1.uk-london-1.aaaaaaaavrftjg3fa2uw5ndqin3tjme3jc4vpxnsysoxetlswsr6aqlfwurq Created at: 1563931505006 state: Running agentConfig: monitoringDisabled: False Instance Metadata: ssh_authorized_keys: ssh-rsa xxxxxxxx rsa-key-20180707 Networking details: VNIC OCID: ocid1.vnic.oc1.us-ashburn-1.abwgiljr2hzgelbhzjf3hvo6bztwju4wm6xrphiu3ojmtfpcks5caut4763q VLAN Tag: 1359 Private IP address: x.x.x.x MAC address: xx:xx:xx:xx:xx:xx Subnet CIDR block: x.x.x.x/24
Using Console
You can log in to Oracle Cloud Console. Go to the Server and you can see all the details
Using Curl from Metadata Service
- Each Server runs a metadata service. and is an HTTP endpoint listening on 169.254.169.254.
- We can find the metadata using the curl command below on all the OCI servers
curl -L http://169.254.169.254/opc/v1/instance/
The IP address 169.254.169.254 is a link-local address and is valid only from the instance.
if the v2 version is enabled, we can use the below command
curl -H "Authorization: Bearer Oracle" -L http://169.254.169.254/opc/v2/instance
I hope you like this article How To Retrieve Instance Metadata from Server
Related Articles
How to configure Automatic Managed backup on DBCS
How to configure Automatic Managed Backup on ExaCS
Troubleshooting backup Failures in ExaCS
Oracle Database Cloud Backup Module
DBCLI commands