IBM Cloud: How can I enable Public Access on a storage bucket from CLI?

329 views Asked by At

I successfully enable Public Access to one of my buckets in IBM Cloud Object Storage and used the console (browser UI). I followed these steps. In the UI, the access group is shown as Public Access with ID AccessGroupId-PublicAccess. But I cannot find it when using the CLI, either when listing all access groups or trying to retrieve it directly:

$ ibmcloud iam access-group AccessGroupId-PublicAccess

Retrieving access group AccessGroupId-PublicAccess under account Henrik's Account as HENRIK...

FAILED Access group AccessGroupId-PublicAccess was not found

How can I see details on that access group, how can I assign a new policy to it for a given storage bucket?

1

There are 1 answers

0
data_henrik On BEST ANSWER

With the latest IBM Cloud CLI update, the "Public Access" access group is visible. Now I can create and see public access policies for my Cloud Object Storage (COS) buckets:

Here is how I created a public access policy:

ibmcloud iam access-group-policy-create "Public Access" --roles "Content Reader" 
--service-instance 47b57632-xxxx-yyyy-zzzz-03eb35b5ef23 --resource-type bucket
--resource henrik-fra-bucket-public-web --service-name cloud-object-storage

Thereafter, check that the policy exists for the access group "Public Access":

ibmcloud iam access-group-policies "Public Access" --output json

The output should be the same as if you would use the IBM Cloud console (Web UI).