Reading data from S3 using Lambda
s3 = boto3.client('s3')response = s3.get_object(Bucket=bucket, Key=key)emailcontent = response['Body'].read().decode('utf-8')
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.