- Newest
- Most votes
- Most comments
When using Boto you need to initialize an S3 client. Then you use that client to get the object. You then need to convert the object to a usable format.
Look at this link for samples on how to use Boto3 with S3 buckets. Specifically look at the Get an object from a bucket
sample.
https://docs.aws.amazon.com/code-library/latest/ug/python_3_s3_code_examples.html
Hi,
I see you are importing several boto
related libraries, but you script doesn't actually make use of them as far as I can tell. Based on the script you shared, I believe you need to add the code that lists the objects in your bucket. Once you do that, you can continue to develop your code to load each file into memory, or download it to disk, etc.
Here is a basic example using boto3
which should list the objects in your bucket.
import boto3
session = boto3.Session( aws_access_key_id='<your_access_key_id>', aws_secret_access_key='<your_secret_access_key>')
s3 = session.resource('s3')
my_bucket = s3.Bucket('<your_bucket_name>')
for my_bucket_object in my_bucket.objects.all():
print(my_bucket_object.key)
Relevant content
- asked a year ago
- Accepted Answerasked 2 years ago
- asked 14 days ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 6 months ago