Well, hello there. I've had a couple people contact me and ask me to write a post about a project I had completed. This is that post.
I recently had a project come my way where I need to accept user input in the form of an excel sheet, parse through the rows and cells, and post the responses to a third party system, all while generating logs to the original submitter.
Hm.
Immediately my mind went to a traditional LAMP (Linux, Apache, MySQL, PHP) stack website where users log in, upload their sheet, and results appear there.
It seemed to intrusive through, to ask my users to go through these extra steps. Think of the documentation I'd have to write..
Instead, I thought differently. Most individuals in a work environment use email. How do I harness that?
With AWS' SES (Simple Email Service), S3, and Lambda.
I created a departmental mailbox to use for the purpose of receiving emails from users with an attachment, something simple like risk@company.org, with certain subjects or phrases triggering a mail rule to redirect the email to... aws-risk@email.prod.aws.edu (more on that in the next paragraph).
I utilized Amazon Web Services Route 53 to create a DNS MX record for this purpose-- I named this one email.prod.aws.edu Note: aws.edu is a registered domain in route 53 for the purposes of this scenario.
Using Simple Email Service I was able to configure aws-risk@email.prod.aws.edu to immediately, upon email arrival, save its contents to an S3 bucket.
Here's where those of you familiar with Lambda and AWS will "ahhh" to. One of the triggers for a Lambda function is exactly that-- an object created in S3!
"Small section of the lambda function that checks for the item written in S3"
I was able to write all the code in Python, to parse through the rows and cells in the sheet, POST contents to third party system, and send a log back to the user back through SES. All through that one Lambda function, that awesome S3 bucket, and of course, the hero of the show, SES.
Top comments (0)