AWS Lambda Function for SES to DynamoDB
--------------------------Lambda Code Begins------------------------ console.log('Loading event'); var aws = require('aws-sdk'); var ddb = new aws.DynamoDB({params: {TableName: 'SESNotifications'}}); exports.handler = function(event, context) { console.log('Received event:', JSON.stringify(event, null, 2)); var SnsPublishTime = event.Records[0].Sns.Timestamp var SnsTopicArn = event.Records[0].Sns.TopicArn; var SESMessage = event.Records[0].Sns.Message SESMessage = JSON.parse(SESMessage); var SESMessageType = SESMessage.notificationType; var SESMessageId = SESMessage.mail.messageId; var SESDestinationAddress = SESMessage.mail.destination.toString(); var LambdaReceiveTime = new Date().toString(); if (SESMessageType == 'Bounce') { var SESreportingMTA = SESMessage.bounce.reportingMTA; var SESbounceSummary = JSON.stringify(SESMessage.bounce.bouncedRecipients); var itemParams = {Item: {SESMessageId: {S: SESMessageId}, SnsPublishTime: {S: SnsPublishTime}, SESreportingMTA: {S: SESreportingMTA}, SESDestinationAddress: {S: SESDestinationAddress}, SESbounceSummary: {S: SESbounceSummary}, SESMessageType: {S: SESMessageType}}}; ddb.putItem(itemParams, function(err, data) { if(err) { context.fail(err)} else { console.log(data); context.succeed(); } }); } else if (SESMessageType == 'Delivery') { var SESsmtpResponse1 = SESMessage.delivery.smtpResponse; var SESreportingMTA1 = SESMessage.delivery.reportingMTA; var itemParamsdel = {Item: {SESMessageId: {S: SESMessageId}, SnsPublishTime: {S: SnsPublishTime}, SESsmtpResponse: {S: SESsmtpResponse1}, SESreportingMTA: {S: SESreportingMTA1}, SESDestinationAddress: {S: SESDestinationAddress }, SESMessageType: {S: SESMessageType}}}; ddb.putItem(itemParamsdel, function(err, data) { if(err) { context.fail(err)} else { console.log(data); context.succeed(); } }); } else if (SESMessageType == 'Complaint') { var SESComplaintFeedbackType = SESMessage.complaint.complaintFeedbackType; var SESFeedbackId = SESMessage.complaint.feedbackId; var itemParamscomp = {Item: {SESMessageId: {S: SESMessageId}, SnsPublishTime: {S: SnsPublishTime}, SESComplaintFeedbackType: {S: SESComplaintFeedbackType}, SESFeedbackId: {S: SESFeedbackId}, SESDestinationAddress: {S: SESDestinationAddress }, SESMessageType: {S: SESMessageType}}}; ddb.putItem(itemParamscomp, function(err, data) { if(err) { context.fail(err)} else { console.log(data); context.succeed(); > } }); } }; ------------------------Lambda Code Ends----------------------------
相關推薦
AWS Lambda Function for SES to DynamoDB
--------------------------Lambda Code Begins------------------------ console.log('Loading event'); var aws = require('aws-sdk'); var ddb = new a
Pass Custom Headers Through Amazon API Gateway to an AWS Lambda Function
By default, a Lambda function only ingests the request body received by an API created in the API Gateway. To pass custom headers f
【C++錯誤處理】no matching function for call to transform
初學C++哈,不知道這個錯誤是不是很silly,高手輕拍。情況如下: #include #include #include using namespace std; int main (int argc, char * const argv[]){ stri
One click creation of an AWS Lambda trigger for any device
AWS IoT 1-Click is a service that enables simple devices to trigger AWS Lambda functions that can execute an action. AWS IoT 1-Click supported dev
caffe編譯Matlab介面報錯:208: 4: error: no matching function for call to remove_if
caffe編譯Matlab介面報錯:208:4: error: no matching function for call to remove_if(std::vector 問題: MEX matlab/+caffe/private/caffe_.c
AWS Lambda enables functions that can run up to 15 minutes
Amazon Web Services is Hiring. Amazon Web Services (AWS) is a dynamic, growing business unit within Amazon.com. We are currently hiring So
AWS Lambda Console Now Enables You to Manage and Monitor Serverless Applications
Amazon Web Services is Hiring. Amazon Web Services (AWS) is a dynamic, growing business unit within Amazon.com. We are currently hiring So
Build an AWS Lambda Deployment Package for Python
This command displays the folder structure. The main Python function files for your application must be in the root of your project folder. Oth
Grant Internet Access to a VPC Lambda Function
If your Lambda function needs to access private VPC resources (for example, an Amazon RDS DB instance or Amazon EC2 instance), you must associa
Connect a Lambda Function to a Dedicated VPC
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "
Subscribe a Lambda Function to a Push
Amazon Web Services is Hiring. Amazon Web Services (AWS) is a dynamic, growing business unit within Amazon.com. We are currently hiring So
Extend AWS DeepLens to Send SMS Notifications with AWS Lambda
AWS DeepLens is a deep learning enabled developer toolkit with a video camera. It enables you to develop machine learning skills using hands-on co
waiting for it to exit..
currently waiting another holding another app is currently holding the yum lock;waiting for it to exit...2009-02-04 20:58有時用yum升級一些文件時,會出現以下情況:anot
Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work
重新 master 過去的 cati stop ica clas mas ids 配置MySQL主從復制,遇到報錯 Fatal error: The slave I/O thread stops because master and slave have equal My
使用AWS Lambda自動定時快照EBS卷
imp delet def watch host %s date create creat 一、創建IAM策略IAM->策略->創建策略->JSON{ "Version": "2012-10-17",
MonitoredTrainingSession指定is_chief之後,一直報:tensorflow:Waiting for model to be ready. Ready_for_local_init_op: Variables not initializ
dev class lan variables red ini ecs fail var MonitoredTrainingSession指定is_chief之後,報錯:tensorflow:Waiting for model to be ready. Ready_f
Direct Shape Regression Networks for End-to-End Face Alignment
端到端人臉對齊的直接形狀迴歸網路1 主要的挑戰在於人臉影象和相關的面部形狀之間的高度非線性關係,這種非線性關係是基於標記的相關性耦合。現有的方法主要依賴於級聯迴歸,存在固有的缺點,例如對初始化的強依賴性和未能利用相關的標記。 本文提出了一種**直接形狀迴歸網路(direct shap
React和webpack解決 waiting for roots to load...to reload the inspector
使用chrome除錯工具,react-devtools總是顯示 "waiting for roots to load...to reload the inspector" and a button saying "click here". 我使用的是react-devtools4.0版本 有兩
Oracle Error ORA-22835 Buffer too small for CLOB to CHAR
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!  
Druid 執行緒池配置時遇到的問題 “(*) property for user to setup”
Druid 阿里巴巴提供的一個執行緒池,標榜的是最好的執行緒池。可以有SQL監控的web功能。按照官網的參考配置 https://github.com/alibaba/druid/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98。 spring