Skip to content

AWS Lambda function that sends SES notifications to Azure Log Analytics

Notifications You must be signed in to change notification settings

scheduleonce/aws-ses-to-azure-log-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aws-ses-to-azure-log-analytics

A lambda function that sends sns notifications about emails to azure-log-analytics

styled with prettier

What is this for?

SES is capable of sending reports about email delivery (deliveries, bounces, rejects) to SNS. However, there's no built in way to pipe these reports into something like azure-log-analytics. This Lambda function bridges the gap and allows to send the reports to ES.

+-------+     +-------+     +--------+     +---------------------+
|  SES  +---> |  SNS  +---> | Lambda +---> | Azure Log Analytics |
+-------+     +-------+     +--------+     +---------------------+

Deploying the function

Lambda requires you to include any npm dependencies your function needs with the bundle. Prepare the zip bundle:

$ npm install --production
$ zip -r lambda-bundle.zip *

Then upload the bundle directly to Lambda through the upload button

Usage

There are couple of steps that need to be done on AWS console to make this work:

  1. Create a topic on SNS for the email deliveries.
  2. Set up notifications for you SES email address. Set these notifications to be sent to the topic you created.
  3. Create a lambda function with a trigger for SNS. Set the topic on that trigger to the topic you created.
  4. Subscribe to the topic and set Lambda as the destination for notifications.

The function expects several environment variables to be set:

  • WORKSPACEID - WorkspaceID is the unique identifier for the Log Analytics workspace.
  • SHAREDKEY - Primary Key ID of Log Analytics workspace.
  • APIVERSION - The version of the API to use with this request. Currently, it's 2016-04-01.
  • PREFIX - The index name prefix. For example, if PREFIX='aws_ses_emails'

    Note: Index name do not allow hyphen(-).

About

AWS Lambda function that sends SES notifications to Azure Log Analytics

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published