Site icon EasyOraDBA

Accessing OCI Buckets from AWS Python SDK

1. Create Customer Secret Key from OCI User settings. S3 compatibility key is now called “customer secret key”

Link :

2. Install Python packages –> oci, awscli, boto3 (boto3 is Amazons Python SDK)

3. Add the secret key credentials to a .py file using below code. This will list out your OCI buckets and upload a sample file in /tmp from your local instance(VM) to OCI bucket. In my case the bucket is called “Shadab-DB-Migrate”

import boto3
import oci

config= oci.config.from_file(“~/.oci/config”)

s3 = boto3.resource(

# Print out bucket names
for bucket in s3.buckets.all():

# Upload a File to you OCI Bucket, 2nd value is your bucket name
s3.meta.client.upload_file(‘/tmp/hello.txt’, ‘Shadab-DB-Migrate’, ‘hello.txt’)

[2] the first to like this

Exit mobile version