In this article, we will be covering MongoDB database dump and uploading the dump to Amazon Web Services’ S3 Bucket through EC2 instance.

MongoDB is an open-source NoSQL database. It is scalable, open source, high performance and document oriented. The database supports JSON data-modeling and horizontal scalability, which makes it an ideal database for storing and fetching document-oriented data for current WebApps.Firstly, to take the database backup on S3 bucket, a connection of the EC2 instance and S3 bucket to be used needs to be established. And for that, the user requires an AWS account with an IAM user, access keys & secret keys for that user and ‘aws cli’ installed which is AWS’s command line interface. For this, go to the this link to follow ‘Prerequisites’ and ‘Install/Update’.

After installing aws cli, type in the following command:

  $  aws configure
  AWS Access Key ID [None]: [SAMPLE KEY]
  AWS Secret Access Key [None]: [SAMPLE KEY]
  Default region name [None]: us-west-2
  Default output format [None]: json
 

Fill in the required credentials with your access key ID, secret access key and the default region of your S3 bucket and default output format to be put as ‘json’