Giter Club home page Giter Club logo

lambda-mongodb-s3-backup's Introduction

This is simple aws lambda function that uses mongodump to backup mongodb database.

It zips the file and uploads it to an S3 bucket.

Use the following environment variables in your Lambda setup:

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

Instructions

  • Clone this repository.
  • Run - npm install.
  • Zip all the files.
  • Upload the zip to a new aws lambda (upload to s3 and then to the lambda, the file is to big to upload directly)
  • Add S3 Policy to the lambda role to give the lambda permission to write to s3.

Region

This lambda function compiled in EU (Ireland) AMI .

lambda-mongodb-s3-backup's People

Contributors

alonhar avatar ev-sc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lambda-mongodb-s3-backup's Issues

mongodump permission denied

Getting the error

exec error: Error: Command failed: /bin/sh -c mongodump -h xxx -d xxx -u xxx -p xxx -o xxx
/bin/sh: /var/task/mongodump: Permission denied

Have tried adding chmod 777 to mongodump, hasn't worked either.

Has anyone experienced this?

How do you restore the data from s3 using lambda?

Hi,

This is a good example of backup mongodb by lambda function exactly. But as the title said, do you have some corresponding method to restore them using lamdda function (Maybe, it's not necessary to do like this)?

Additionally, where did your mongodump bin file come from?

Thanks! :)

No Lambda Region specified

Every lamda region has a different AMI, which will potentially run native libs a bit differently.
Can you specify the lambda region against which this function was compiled?

Cannot find module 'zip-folder'

I followed the exact instructions provided and got the error below when I tested the function. I then ran "npm install zip-folder" and repeated the steps, but I continued to get the error.

{
"errorMessage": "Cannot find module 'zip-folder'",
"errorType": "Error",
"stackTrace": [
"Module.require (module.js:497:17)",
"require (internal/module.js:20:19)",
"Object. (/var/task/index.js:18:19)",
"Module._compile (module.js:570:32)",
"Object.Module._extensions..js (module.js:579:10)",
"Module.load (module.js:487:32)",
"tryModuleLoad (module.js:446:12)",
"Function.Module._load (module.js:438:3)"
]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.