I have a range of json files stored in an S3 bucket on AWS.
I wish to use AWS lambda python service to parse this json and send the parsed results to an AWS RDS MySQL d
You can use bucket.objects.all() to get a list of the all objects in the bucket (you also have alternative methods like filter
, page_size
and limit
depending on your need)
These methods return an iterator with S3.ObjectSummary objects in it, from there you can use the method object.get
to retrieve the file.
s3 = boto3.client('s3')
response = s3.get_object(Bucket=bucket, Key=key)
emailcontent = response['Body'].read().decode('utf-8')