Stan Ostrovskii
Stan Ostrovskii

Reputation: 632

E-mailing CSV file from S3 without downloading it using Python

I need an application to pick up some csv files from an s3 bucket and e-mail them to specified recipients. I was able to make the code work using the solution present at the end of the question here: Python Lambda to send files uploaded to s3 as email attachments

However, this code solution above first downloads the files entirely to local storage, then reads them again and e-mails them. My company strongly prefers I find a solution to e-mail the attachment directly from s3 without having to rely on local storage. Is this possible? If so, how?

Note: I am not using an AWS Lambda, just a regular python application run from a server, unlike the question I refer to.

Upvotes: 0

Views: 507

Answers (1)

horzion
horzion

Reputation: 81

You could design your python application running on the server to send the email via serverless application, say. The serverless app would download the object from s3, before attaching it to the email and sending it.

AWS supports python, and serverless has an SDK for python development.

The sequence of events would look something like

Actor
 |
Python App
 |
Lambda <-> s3
 |
 `
Email Server
 |
User

Upvotes: 1

Related Questions