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

0 votes
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, 2019 in AWS by Lakshminarayanan
• 1,370 points
1,184 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, 2019 by Kalgi
• 52,350 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
• 58,020 points
9,028 views
0 votes
1 answer
0 votes
1 answer
+2 votes
3 answers
+2 votes
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, 2019 in AWS by Kalgi
• 52,350 points
1,065 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP