Skip to content

Instantly share code, notes, and snippets.

@kincl
Last active May 13, 2024 20:53
Show Gist options
  • Save kincl/f8f027c103d0b68fd9b9ec8c38255761 to your computer and use it in GitHub Desktop.
Save kincl/f8f027c103d0b68fd9b9ec8c38255761 to your computer and use it in GitHub Desktop.
Using boto3 with RGW
# https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3/client/list_objects.html
# https://boto3.amazonaws.com/v1/documentation/api/latest/guide/s3-uploading-files.html
import os
import boto3
import botocore
s3 = boto3.client('s3', verify=False, region_name="default", endpoint_url=f"https://{os.environ['AWS_S3_ENDPOINT']}")
#s3.upload_file('test.txt', os.environ['AWS_S3_BUCKET'], 'test.txt')
# response = s3.list_buckets()
s3.list_objects(Bucket=os.environ['AWS_S3_BUCKET'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment