Use the Amazon AWS API to Automatically Backup an Odoo Database to S3
Backup Odoo to the cloud via Amazon Web Services
One of the advantages of Amazon's AWS platform is their robust API that let you automate many tasks. In this video we learn how to use both the Odoo API with XML-RPC and Amazon's AWS API to backup an Odoo database to an S3 bucket.
Using the Odoo API and Amazon API to backup an Odoo Database
Learn how you can automate operations with buckets on Amazon S3
In this video we look at the foundations of automating Odoo backups using some simple python commands. Even better, you can use these techniques to accomplish many other automation tasks in Odoo. A few examples might be a document management system that stores the documents on Amazon S3 for access to important scaleability features like Amazon Cloud Front. Using the Amazon API you could create signed URL's.
Having a backup strategy for your Odoo Database: It is extremely critical that for any Odoo system that is being used in a live production environment that you have a solid, reliable backup procedure in place. One important part of this strategy is to automate your Odoo backups so you do not leave the process up to human error. In addition, do not under-estimate the need to backup your databases for Odoo development, testing, and staging servers. Many hours can be put into these configurations and losing progress can be a big setback for your team. Finally... TEST YOUR BACKUPS!!! All too often people backup databases but they never take the time to make sure they can successfully recover them. Don't assume everything will go smooth when there is a crisis. Test your backups so you know there is no surprises when go to restore them.
Setting up your Amazon AWS Account: If you wish to follow along with this video and test it out yourself you will need to have an Amazon AWS account.
Create a bucket on S3: You will need to setup a bucket on Amazon S3 to store your backups. The script that we go over in detail in the video then will backup your Odoo database to that S3 bucket.
Using XML-RPC to backup the Odoo database: Odoo has a powerful API that can be accessed programatically through XML-RPC and simple Python commands.
Copying your Odoo database to the Amazon S3 bucket: This is the final step in copying the data over into an Amazon S3 bucket. Using the put_object method in the Amazon AWS API the Odoo database is copied over to the S3 bucket.
Extending the example with additional options: Once you have your database backing up using the script you have the flexibility to automate it using a variety of techniques. You could create a cron job in Ubuntu that would execute the script at anytime you choose. You could also create a server action in Odoo to backup the database. Or you could incorporate the script into a more comprehensive backup strategy that backups up the database to multiple S3 instances in different regions on a more complex archival time solution.
Using Odoo for content and document management: Systems continue to get more complex and evolve beyond simple data collection. Odoo provides a great opportunity to be the center of business applications that incorporate content and document management. One example is a large legal practice that uses Odoo to manage countless documents taken during discovery and legal depositions. Integration with S3 allows Odoo to leverage the power of redundant scalable architectures. Another example would be using Odoo to manage human resource documents, files and pictures.
Creating a foolproof backup strategy for your Odoo Database
Tips & Tricks to putting in place a solid business continuity plan for your company
This video course is designed to give you an additional tool in your toolbelt for the purposes of backing up Odoo databases to an Amazon S3 server. But having that technical knowledge is just part of a total backup strategy that you should have in place. Below are some professional backup tips I've compiled from over 30 years of business/IT consulting. Nearly all of these strategies and tips relate to any business IT platform, not just Odoo.
Consider backups as part of business continuity. Too often backups are the domain of technology professionals. I would bet if you ask the executives at most mid-sized companies few have a real understanding of the steps that would be required to maintain business continuity following a severe IT data loss or security breach. Every company should have a business continuity plan that includes system backups, hardware acquisition, and even alternative locations to conduct business should the facility itself be unavailable. An earthquake, fire, or other natural disaster can strain the best of plans. Take the time to have a great plan of your own.
Have an archive of multiple backups. Often times data loss and/or corruption is not discovered until long after the fact. Perhaps a rogue process erased critical history in the system. Maybe an employee deleted an entire folder of files thinking they were no longer needed. Yet six months later you find out that they are critical to an important lawsuit. Don't just make a backup of your last copy of the database. Consider a database plan includes daily, weekly,monthly and annual backups. While this may seem like overkill, you rarely want to risk losing a days worth of data and it is too much risk to write over data that was backed up the week before. Put a system in place that automatically makes the backups and sleep better knowing your data will be safe years into the future.
Keep offsite backups. While many people are now keeping their servers in the cloud and simultaneously backing up to the cloud which helps offset this common problem, it is very important if you have physical servers on location that you don't just keep your primary backups of data in the same physical location as the servers themselves. A fire or theft could quickly render your meticulously performed backups worthless.
Test backup recovery. Don't just backup your databases and assume that they are going to restore without any errors. Regularly test your backups by recovering them into a new database instance. Then take a few minutes to test critical business processes and make sure there are no surprises. This is becomes even more critical when you consider full recoveries that may require re-installation of your server OS and dependencies. Consider these procedures like insurance and taxes. You must spend the time and money now to make sure you are protected as disaster can often strike when you least expect it.
Consider a 3rd party business continuity audit. Despite best intentions and work ethic it is hard for someone who runs a system and deals with it every single day to be objective. Worse, leaving business continuity up to any one employee or even team of employees carries its own risks. It takes a lot of effort and time to maintain and test backup systems so there is a tendency to put it off. Because nobody knows the backups are done or not done, tested or not tested until something goes wrong it is easy for an IT department to neglect a backup system and have it go unnoticed by stakeholders in the company. The best solution is a semi-annual business continuity audit in which a 3rd party is provided access to backup logs and then performs test recoveries on random backup archives. In addition the consultants should review business continuity plans and security access controls as part as an overall business security / continuity audit. An additional advantage of this strategy is that valuable employee time is not utilized to test the backup system allowing them to focus on more important business related projects.
If you are are interested in a business continuity audit or assistance in implementing an Odoo backup strategy please contact us. We will be glad to help.
Greg Moss started working with personal computers at 12 years old. At age 15, he wrote his first paid business application, a loan management application for First American Acceptance Corporation. A few months later Greg developed a statistical application to process surveys for John A Logan College. Now more than 30 years later, Greg has produced hundreds of commercial applications and training courses, and has been involved in numerous enterprise application projects.
In addition to completing degrees in Business Administration and Information Systems Design, Greg is a Certified Information Systems Auditor, a Six Sigma Black Belt, and holds an Information Assurance Certification from Carnegie Mellon University. In addition to his successful consulting practice, Greg has worked in positions as a Chief Information Officer (CIO), Chief Executive Officer (CEO), and excels in delivering technology-enabled growth to companies. He is an experienced digital marketer and focuses on real-world results and solutions.
Greg is the founder of First Class Ventures, LLC and OdooClass.com. Over the past 8 years Greg has produced over 200 video courses covering business application development and game design.
Greg is the author of Working with Odoo, Working with Odoo 10, Working with Odoo 11, Working with Odoo 12, and Learn Odoo.