whenever generate report in frontend then this report send to user mail using lambda+sqs+ses

+1 vote
Hi all,

I'm new to lambda function. its my requirement "whenever generate report in frontend then this report send to user mail using lambda+sqs+ses". I dont know anything in this lambda. so please guide me . I was helpless
Oct 19 in AWS by Latchu
• 380 points
44 views

1 answer to this question.

+1 vote

You can create a trigger and send an email using ses. Below is the example of a lambda function:

var aws = require('aws-sdk');
var ses = new aws.SES();

exports.handler = (event, context, callback) => {
    
     var params = {
        Destination: {
            ToAddresses: ["recipientEmailAddress"]
        },
        Message: {
            Body: {
                Text: { Data: "Test"
                    
                }
                
            },
            
            Subject: { Data: "Test Email"
                
            }
        },
        Source: "sourceEmailAddress"
    };

         ses.sendEmail(params, function (err, data) {
        callback(null, {err: err, data: data});
        if (err) {
            console.log(err);
            context.fail(err);
        } else {
            
            console.log(data);
            context.succeed(event);
        }
    });
};
answered Oct 21 by Kalgi
• 42,410 points
Many thanks kalgi
i will send one description. I need to setup this. Please read it and tell me how to achieve? Below is description about lambda function.

# AWS Lambda Function to Generate Reports based on the selected filters

This lambda function is triggered by AWS SQS. When ever a user tries to generate historical report from example Webapp(Production server) the request will be placed in the SQS queue. All the filters like start date, end date, status etc.., will be available in the Queue. Once the message is added in the queue it will trigger the lambda function which gets the filters in message and interacts with Aurora DB to fetch the data based on them. This fetched data is formatted and written to CSV file. Which is then pushed to the AWS S3 bucket. Once the file is successfully uploaded to S3 bucket, an Email is sent to the user who requested the report. AWS SES will send an email along with the CSV report URL to download it. I need solution asap.

Related Questions In AWS

0 votes
0 answers
+2 votes
3 answers

How to send email to non-verified email address using AWS SES

While running in sandbox mode you can ...READ MORE

answered Jul 26, 2018 in AWS by Priyaj
• 56,920 points
1,135 views
+1 vote
3 answers

Log in to AWS using Access Key ID and Secret Access Key ID

Access keys consist of an access key ...READ MORE

answered Aug 17, 2018 in AWS by Priyaj
• 56,920 points
1,189 views
0 votes
1 answer
0 votes
1 answer
+2 votes
3 answers
+1 vote
1 answer

How To Become Certified in AWS-Solution-Architect-Associate Exam??

Hey @Robii,  Start with some basic research about ...READ MORE

answered Apr 9 in AWS by Kalgi
• 42,410 points
82 views