Skip to content

Instantly share code, notes, and snippets.

@turtlemonvh
turtlemonvh / README.md
Last active May 27, 2025 05:42
Lambda example: Grab new versions of MaxMind's GeoIP City DB, saving to S3

Python lambda example: MMDB Archiver

A Python3.4 lambda function that:

  • gets a list of all previously downloaded databases from listing files on S3
  • get the md5 of the latest mmdb file on MaxMind
  • compares that the md5 with historical values
  • if the value is new,
    • downloads the file to the /tmp directory
  • uploads the file to s3
from traildb import TrailDBConstructor, TrailDB
# using the trailDB provided as a part of the tutorial
ob = TrailDB("wikipedia-history-small")
def getEvents():
"""
get all events of db
"""