Moving an Object Storage Bucket to a Different Compartment

Move an Object Storage bucket to a different compartment in your Oracle Cloud Infrastructure tenancy.

    1. On the Buckets list page, select the Object Storage bucket that you want to work with. If you need help finding the list page or the bucket, see Listing Buckets.
    2. To view the buckets in a different compartment, use the Compartment filter to switch compartments.
      You must have permission to work in a compartment to see the resources in it. If you're not sure which compartment to use, contact an administrator. For more information, see Understanding Compartments.
    3. From the Actions menu for the bucket, select Move resource.
    4. In the Move resource panel, select the destination compartment from the list.
    5. Select Move resource.
  • Use the oci os bucket update command and required parameters to move the bucket to a different compartment:

    oci os bucket update --name bucket_name --compartment-id destination_compartment_ocid [OPTIONS]

    where destination_compartment_ocid is the compartment OCID associated with the destination compartment for the bucket you're moving.

    For example:

    oci os bucket update --name MyBucket --compartment-id ocid.compartment.oc1..exampleuniqueID
    {
      "data": {
        "approximate-count": null,
        "approximate-size": null,
        "auto-tiering": null,
        "compartment-id": "new_ocid.compartment.oc1..exampleuniqueID",
        "created-by": "ocid1.user.oc1..exampleuniqueID",
        "defined-tags": {},
        "etag": "fe4fb648-8ddd-42eb-9732-d431aafac354",
        "freeform-tags": {},
        "id": "ocid1.bucket.oc1..exampleuniqueID",
        "is-read-only": false,
        "kms-key-id": null,
        "metadata": {
          "department": "Finance"
        },
        "name": "MyBucket",
        "namespace": "MyNamespace",
        "object-events-enabled": false,					
        "object-lifecycle-policy-etag": null,
        "public-access-type": "NoPublicAccess",
        "replication-enabled": false,
        "storage-tier": "Standard",
        "time-created": "2020-06-22T19:04:05.879000+00:00",
        "versioning": "Disabled"
      },
      "etag": "fe4fb648-8ddd-42eb-9732-d431aafac354"
    }

    For a complete list of parameters and values for CLI commands, see the CLI Command Reference.

  • Run the GetBucket operation with the compartmentID of the destination compartment to move a bucket to a different 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