-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guide to using AWS Lambda with AWS Simple Email Service #99
Conversation
Codecov Report
@@ Coverage Diff @@
## master #99 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 5 5
Lines 230 230
=====================================
Hits 230 230 Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #99 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 5 5
Lines 230 230
=====================================
Hits 230 230 Continue to review full report at Codecov.
|
@finnhodgkin only just saw this. 😮 |
README.md
Outdated
@@ -77,6 +77,7 @@ something to S3 on each execution cycle you could rack up the bill! | |||
* [Use the callback parameter with node v4.3](#the-callback-parameter) | |||
* [Trigger a Lambda function using an event from DynamoDB](#triggering-a-lambda-function-using-an-event-from-dynamodb) | |||
* [Trigger a Lambda function using the Simple Notification System](#trigger-a-lambda-function-using-the-simple-notification-system) | |||
* [Trigger a Lambda function when an email comes in to the AWS Simple Web Service](#trigger-a-lambda-function-when-an-email-is-received-by-amazon-simple-email-service) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AWS Simple Web Service
>> AWS Simple Email Service (SES)
#### Save the email to S3 | ||
Go back to the rule set you created for your Lambda function. Add a new action to it, this one should be an S3 action, with the bucket you want to use selected. This will save the email to S3. Make sure this action is positioned **above** your Lambda function: | ||
|
||
![ses management console - google chrome_006](https://user-images.githubusercontent.com/22300773/28177094-a0e16bfc-67f1-11e7-8676-feabc437295f.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have access to Photoshop here and the Linux alternatives are a bit of a pain to use. Happy to update this when I get home from my holiday 🍹
README.md
Outdated
"Action": [ | ||
"logs:CreateLogStream", | ||
"logs:PutLogEvents", | ||
"s3:*" // This allows all S3 functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fairly certain these comments aren't allowed. (which is a shame because they are instructive ...)
|
||
So now when we receive an email it is save to S3 and a function is triggered. Next we need we need to hook the two up so our Lambda function reads the saved file, and saves the body in a nice readable way. | ||
|
||
#### Save the body to S3 using AWS Lambda |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we save all incoming emails it's possible for a SPAMer to flood our Lambda and cause us to waste loadz-a-money on S3 writes ...
$0.05 per 1,000 writes to S3 might not sound like a lot, but it will add up if you consider the volume of spam sent/received. (if you use GMail you won't realise it because Google has amazing filters, but an "un-protected" email address will get hundreds and a reasonably popular domain will get thousands of SPAM emails per day)
Fun Fact: Over 50% of email is SPAM see: https://www.statista.com/statistics/420391/spam-email-traffic-share/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a note with some of the above comment before the S3 section. Should hopefully help to deter people from leaving this set up on their own accounts.
A better exercise could be to process the email with Lambda before saving to S3 so we could run something more interesting like a check for a certain keyword or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@finnhodgkin & @ZooeyMiller so far looks good. just need to update the TOC then should be ready to merge. thanks! 🎉
Codecov Report
@@ Coverage Diff @@
## master #99 +/- ##
=======================================
Coverage ? 100%
=======================================
Files ? 5
Lines ? 230
Branches ? 0
=======================================
Hits ? 230
Misses ? 0
Partials ? 0 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@finnhodgkin thank you for making the time to complete this PR even though it's not your current focus! I really appreciate it! 🥇
Hope you have a great day! ☀️
** Probably not ready for merge because the advice on permissions for S3 is a little dubious... Currently we just open it to anyone and everyone **
Adds a section on Amazon Simple Email Service
Relates to #97 #98