Skip to content

Instantly share code, notes, and snippets.

@ianmas-aws
ianmas-aws / mongoDBWriter_lambda.py
Created March 28, 2017 07:43
Example Lambda Fuction for pushing event data into a MongoDB database
# Run this Lambda function inside a VPC with a MongoDB instance inside it.
# Set up security groups to allow the function to communicate with the MongoDB endpoint
# NAT service or NAT instance is required because the function need to access AWS KMS, which an external endpoint
# Set four environment variables for the function containing the details required for the MongoDB endpoint uri
# I used the Bitnami MongoDB install from the AWS Marketplace
import boto3
import os
from base64 import b64decode