DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Building Scalable Real-Time Apps with AstraDB and Vaadin
Register Now

Trending

  • Execution Type Models in Node.js
  • Best Practices for Securing Infrastructure as Code (Iac) In the DevOps SDLC
  • Which Is Better for IoT: Azure RTOS or FreeRTOS?
  • Security Challenges for Microservice Applications in Multi-Cloud Environments

Trending

  • Execution Type Models in Node.js
  • Best Practices for Securing Infrastructure as Code (Iac) In the DevOps SDLC
  • Which Is Better for IoT: Azure RTOS or FreeRTOS?
  • Security Challenges for Microservice Applications in Multi-Cloud Environments
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Terraform Module for Automated MongoDB Backup

Terraform Module for Automated MongoDB Backup

Backing up your database is no small matter, and not where you want human error. Check out how you can improve this by automation.

Vladimir Fedak user avatar by
Vladimir Fedak
·
Mar. 29, 19 · Tutorial
Like (6)
Save
Tweet
Share
10.32K Views

Join the DZone community and get the full member experience.

Join For Free

MongoDB is one of the most widely used databases out there, and creating backups for it is a crucial, yet routine task not to be taken lightly. This is why we decided to automate the process.

github

Manual backups are utterly outdated, not to mention this means keeping in mind all the peculiarities and tagging the copies by hand. Automated backup requires using certain libraries that are not present by default, and the DevOps team will most likely learn of this the hard way.

Thus said, we wanted to reach the following results while creating a Terraform module for automated MongoDB backup:

  • Automated management of the backup process (you only need access to your AWS account, installed Terraform and our solution)
  • Creating a structured and easily-accessible registry of backups (storing several latest versions of backups, ensuring they are available from multiple access points)


Screenshot 1: AWS CloudFormation interface with a list of periodic tasks

Working With the Automated MongoDB Backup Tool from IT Svit

We currently have a Terraform manifest in place, that installs all the necessary libraries and dependencies, enabling the automated backup to AWS S3 cloud storage, using the AWS CloudFormation and Data Pipeline tools. CloudFormation works as a scheduler, starting the Data Pipeline task that creates a MongoDB dump as a backup and stores it in the S3 bucket. The process logs can be accessed through Terraform or through the Data Pipeline web interface.

Screenshot 2: The list of backup tasks in AWS Data Pipeline

Screenshot 3: Database backups stored within an AWS S3 bucket

Screenshot 4: Each backup is versioned, meaning a specific version of any file can be restored if necessary

All in all, this is a neat little tool solving one of the major headaches of any DevOps team: automated database backuping, backup version monitoring and simple recovery upon request.


Backup MongoDB Terraform (software) AWS

Opinions expressed by DZone contributors are their own.

Trending

  • Execution Type Models in Node.js
  • Best Practices for Securing Infrastructure as Code (Iac) In the DevOps SDLC
  • Which Is Better for IoT: Azure RTOS or FreeRTOS?
  • Security Challenges for Microservice Applications in Multi-Cloud Environments

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: