Search code examples
oracle-cloud-infrastructure

What is the maximum length that an Oracle Cloud ID (OCID) can have?


I want to store some Oracle Cloud IDs in a database, and thinking about the column width. It would be good if it would fit any OCID for now and in the future. So I'm wondering, what is the maximum length or size that an OCID can have?

The documentation on OCIDs does not mention this... The format seems to imply a fairly fixed format, but there are no maximum length indications..

From tenancy renaming documentation it is apparent that the tenancy part can be up to 25 characters, but I'm unsure about the other parts.


Solution

  • You're right, this doesn't seem to be defined anywhere. e.g this is an oracle page talking about OCIDs but doesn't give the length:

    https://docs.public.oneportal.content.oci.oraclecloud.com/en-us/iaas/Content/General/Concepts/identifiers.htm#Resource_Identifiers

    However I did find this obscure bit of code from some cloud-foundry thing:

    https://github.com/cloudfoundry-incubator/bosh-oracle-cpi-release/blob/master/src/github.com/oracle/bosh-oracle-cpi/vendor/oracle/oci/core/models/volume_backup_policy.go

    // The OCID of the volume backup policy.
    // Required: true
    // Max Length: 255
    // Min Length: 1
    

    So I'd say the max length is 255. I know its not much to go on, but 255 seems like a good bet for this sort of modern id.