Skip to content

oneupcompany/lambda-mongodb-s3-backup

 
 

Repository files navigation

This is a simple AWS Lambda function that uses mongodump to backup a MongoDB database to S3. It uses Serverless to zip up the directory and deploy to AWS.

Deployment instructions

Create a .env file in the root directory and add the following environment variables:

export MONGO_URL = mongodb://<user>:<password>@<host>:<port>/<database>
export S3_PATH = <s3bucket>/<folder>/...etc

Source the environment file so Serverless can access the values:

. ./.env

Deploy the lambda function with Serverless:

serverless deploy --aws-profile profilename

Your function is now deployed and will run every 2 hours. Change the execution frequency in serverless.yml.


Lambda configuration

The serverless.yml file contains a set of default configuration for the lambda. You can change these settings to fit your needs.

About

backup mongodb and upload the zip file to s3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%