Listing Object Storage Buckets
View a list of the Object Storage buckets in a compartment.
Use the oci os bucket list command and required parameters to list the buckets in a compartment:
oci os bucket list --compartment-id compartment_ocid [OPTIONS]
For example:
oci os bucket list --compartment-id ocid.compartment.oc1..exampleuniqueID --namespace MyNamespace { "data": [ { "compartment-id": "ocid.compartment.oc1..exampleuniqueID", "created-by": "ocid1.user.oc1..exampleuniqueID", "defined-tags": null, "etag": "c8889cd1-8414-41fb-84b7-3738c39e62c5", "freeform-tags": null, "name": "MyStandardBucket", "namespace": "MyNamespace", "time-created": "2020-05-22T19:22:25.032000+00:00" }, { "compartment-id": "ocid.compartment.oc1..exampleuniqueID", "created-by": "ocid1.user.oc1..exampleuniqueID", "defined-tags": null, "etag": "7b7c3dc1-713f-4996-b176-a938345cae8e", "freeform-tags": null, "name": "MyArchiveBucket", "namespace": "MyNamespace", "time-created": "2020-06-22T13:04:05.879000+00:00" } ] }
By default, getting a list of buckets returns up to the first 1,000 buckets in the compartment.
Using Field Tags
By default when listing buckets,
null
is returned as the value for both free-form and defined tags. To include resource tag data, include the--fields tags
parameter:oci os bucket list --compartment-id compartment_ocid --fields tags [OPTIONS]
For example:
oci os bucket list --compartment-id ocid.compartment.oc1..exampleuniqueID --fields tags { "data": [ { "compartment-id": "ocid1.compartment.oc1..exampleuniqueID", "created-by": "ocid1.user.oc1..exampleuniqueID", "defined-tags": { "example_tag_namespace_Financials": { "production": "Unit 5" }, "example_tag_namespace_Operations": { "costcenter": "85" } }, "etag": "48af18cf-1edd-4b05-9f36-a629d5032260", "freeform-tags": { "Project": "prototype 3" }, "name": "MyStandardBucket", "namespace": "MyNamespace", "time-created": "2020-05-27T18:52:16.951000+00:00" } ] }
Run the ListBuckets operation to list the buckets in a compartment.
When accessing the Object Storage API, the bucket name is used with the Object Storage namespace name to form the request URL:
n/object_storage_namespace/b/bucket