Skip to content

Instantly share code, notes, and snippets.

@shadabshaukat
Last active May 6, 2021 03:16
Show Gist options
  • Select an option

  • Save shadabshaukat/2571e4aa5b3eea997f2ec67b3fee6eac to your computer and use it in GitHub Desktop.

Select an option

Save shadabshaukat/2571e4aa5b3eea997f2ec67b3fee6eac to your computer and use it in GitHub Desktop.
OCI S3 Compatible API
import boto3
s3 = boto3.resource(
 's3',
 region_name="ap-sydney-1",
 aws_secret_access_key="**************",
 aws_access_key_id="****************************************",
 endpoint_url="https://ocicpm.compat.objectstorage.ap-sydney-1.oraclecloud.com"
)
 
# Print out bucket names
for bucket in s3.buckets.all():
 print(bucket.name)
# 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')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment