I am attempting to move 2 small storage buckets from one region to another. One of them went without a hitch, the other refuses with the following error:
$ gcloud storage buckets relocate gs://mybucket --location=europe-west6 --dry-run
ERROR: (gcloud.storage.buckets.relocate) HTTPError 412: Bucket has incompatible features: Managed Prefixes must be disabled
What on earth are “managed prefixes”? Not only do I not recollect enabling anything of that sort, but even after looking hard and long at the help pages, documentation, and googling for it, as far as I can tell, no such feature even exists.
(Both buckets do have subfolders; the documentation says hierarchical namespaces are required for folders in a bucket, and that buckets with hierarchical namespaces cannot be relocated. Both buckets do not have hierarchical namespaces enabled. So I think the documentation is wrong on this topic, and it is not the issue I’m running into, especially given that one of the buckets relocated fine, folders and all).
When you apply an IAM policy on a managed folder, the access granted in the policy applies to any object within the bucket that uses the managed folder path as a prefix in the object name.
You can check if there are managed folders on a GCS using:
gcloud storage managed-folders list gs://my-bucket/
Yes, “managed folders” was exactly what was causing the issue. I wish the error message had been more useful.
The reason it worked for the other bucket was that, apparently, that one was using “simulated folders”. It wasn’t clear to me that there’s 2 kinds of folders, and the documentation I linked in my initial post is rather misleading on this.