oracle-cloud-infrastructureoci-java-sdk

How to create a configuration file for monitoring Oracle Cloud Compute VM?


I have seen the below lines in oracle cloud documentation.

ConfigFile config 
= ConfigFileReader.parse("~/.oci/config");
ConfigFile configWithProfile 
= ConfigFileReader.parse("~/.oci/config", "DEFAULT");

Is 'config' a folder or a file? If it is a file, what is the extension for it?

This is a sample code of how the content looks like.

[DEFAULT]
   user=ocid1.user.oc1..aaaaaaaat5nvwcna5j6aqzjcaty5eqbb6qt2jvpkanghtgdaqedqw
   3rynjq
   fingerprint=20:3b:97:13:55:1c:5b:0d:d3:37:d8:50:4e:c5:3a:34
   key_file=~/.oci/oci_api_key.pem
  tenancy=ocid1.tenancy.oc1..aaaaaaaaba3pv6wkcr4jqae5f15p2b2m2yt2j6rx32uzr4h
   25vqstifsfdsq
   region=us-ashburn-1

[ADMIN_USER]
   user=ocid1.user.oc1..aaaaaaaa65vwl7zut55hiavppn4nbfwyccuecuch5tewwm32rgqvm
   6i34unq
   fingerprint=72:00:22:7f:d3:8b:47:a4:58:05:b8:95:84:31:dd:0e
   key_file=keys/admin_key.pem
   pass_phrase=mysecretphraseCopy

Solution

  • It's a file, that does not have an extension. Most likely, you could add an extention like ".txt" to the file if you'd like, as long as your code references the correct file path (including the added file extension).

    Please see this page for more details on the OCI config file.