Moving an Object Storage Bucket Between Compartments

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

Important

You can't move a bucket from a security zone to a standard compartment. You also need to ensure that the resource users have enough access permissions for the compartment to which the resource is being moved.

See Managing Compartments for information about compartments and access control.

    1. Open the navigation menu and click Storage. Under Object Storage & Archive Storage, click Buckets.
    2. Select the compartment from the list under List Scope. All buckets in that compartment are listed in tabular form.
    3. Select the bucket that you want to move to another compartment. The bucket's Details page appears.
    4. Click Move Resource. The Move resource dialog box appears.
    5. Select the destination compartment from the list.
    6. Click Move resource.

    The bucket you moved appears in the new compartment.

  • 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