oci.config.from_file(file_location='~/.oci/config', profile_name='DEFAULT')

Create a config dict from a file.

  • file_location – Path to the config file. Defaults to ~/.oci/config and with a fallback to environment variable OCI_CONFIG_FILE, then ~/.oraclebmc/config.
  • profile_name – The profile to load from the config file. Defaults to “DEFAULT”

A config dict that can be used to create clients.

oci.config.validate_config(config, **kwargs)
oci.regions.endpoint_for(service, region=None, endpoint=None, service_endpoint_template=None, endpoint_service_name=None)

Returns the base URl for a service, either in the given region or at the specified endpoint.

If endpoint and region are provided, endpoint is used.

If the region information is not available in the existing maps, following sources are checked in order: 1. Regions Configuration File at ~/.oci/regions-config.json 2. Region Metadata Environment variable 3. Instance Metadata Service

Lookup from Instance Metadata Service is disabled by default. To enable, call enable_instance_metadata_service()

The region metadata schema is: {

“realmKey” : string, “realmDomainComponent” : string, “regionKey” : string, “regionIdentifier” : string


For example, for the Sydney OC1 region, the schema would be filled out as follows: {

“realmKey” : “OC1”, “realmDomainComponent” : “”, “regionKey” : “SYD”, “regionIdentifier” : “ap-sydney-1”


If the region still cannot be resolved, we fall back to OC1 realm.

If alloy mode is enabled, and OCI_ALLOY_REGION_COEXIST is not set, only the alloy regions are available. If you want to access OCI and alloy regions at the same time, please set OCI_ALLOY_REGION_COEXIST to True. Fallback to OC1 realm is not available when OCI_ALLOY_REGION_COEXIST is not set.