Skip to content

Daily notification on the absence of an object on AWS S3 Prefix

Notifications You must be signed in to change notification settings

aversag/s3-backup-notifier

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

S3 Backup Notifier ✉️

Deploy s3-backup-notifier

s3 backup notifier intends to daily check the last object date in an AWS S3 bucket, and if it's older than today, send alerting email via AWS Simple Email Service (SES).

I'm using this to monitor the effectiveness of backup of my home automation systems and be alerted on any backup related issue.

Technical details

Fully serverless.

  • Uses AWS Lambda function (Python)
  • Rely on AWS Lambda layer for boto3 and botocore
  • Scheduled Lambda (daily) using CloudWatch Events
  • Uses AWS Simple Email Service (SES) for Emails Notifications

Nb: deployment for my own usage is done using Github Actions, you can check the associated workflow.

Installation

Requirements

  • Configure AWS Credentials (prefer aws-vault)
  • Create a bucket called: <project_name>-artifacts (Prefer versioned and encrypted)

Its using AWS Serverless Application Model (SAM)

Build

Build layer and note the ARN for the deploy step.

$ make layer

And AWS Lambda function package.

$ make package \
    PROJECT=<your_project_name>

Deploy

Deploy CloudFormation stack.

RECIPIENTS var is space-separated

$ make deploy \
    PROJECT=<your_project_name> \
    ENV=<your_env> \
    S3_PREFIX=<buckets_pattern> \
    BUCKETS_BLACKLIST=<buckets_to_exclude> \
    SENDER=<sender_email> \
    RECIPIENTS='recipient_email1,recipient_email2' \
    AWS_REGION='<your_aws_region>' \
    AWS_SES_REGION='<your_aws_ses_region>' \
    BOTOLAYER='<your-boto-layer-name-in-arn>' \
    BOTOLAYERVERSION='<your-boto-layer-version-in-arn>'

Cleaning

Remove unused folders and files after the deployment of your stack.

$ make cleaning

Destroy

$ make tear-down

About

Daily notification on the absence of an object on AWS S3 Prefix

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 60.6%
  • Makefile 39.4%