CodexBloom - Programming Q&A Platform

OCI Data Science Notebook scenarios to Access Object Storage: 'Permission Denied' scenarios

👀 Views: 411 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-12
OCI Object Storage Data Science Python

I'm testing a new approach and I'm trying to access an Object Storage bucket from my OCI Data Science Notebook, but I keep running into a 'Permission Denied' behavior..... I've ensured that the bucket is set to allow access from my user, but I'm still exploring. Here's what I've done so far: 1. I created an Object Storage bucket named `my-bucket` in the same compartment as my Data Science project. 2. I've attached a policy to the compartment: ``` Allow group DataScienceGroup to manage objects in bucket my-bucket ``` 3. In the Data Science Notebook, I'm using the `oci` Python SDK to list files in the bucket: ```python import oci config = oci.config.from_file() object_storage_client = oci.object_storage.ObjectStorageClient(config) namespace = object_storage_client.get_namespace().data objects = object_storage_client.list_objects(namespace, 'my-bucket').data for obj in objects: print(obj.name) ``` 4. I've confirmed that my user is part of the `DataScienceGroup`. Despite this, I still receive the following behavior: ``` oci.exceptions.ServiceError: (403, 'Forbidden', 'User does not have permission to perform this operation.') ``` I've double-checked the policies and they appear to be set correctly. Is there something I'm missing in the configuration or permissions? Any guidance on where to look next would be greatly appreciated! I'm using Python 3.9 in this project.