Amazon DocumentDB (with MongoDB compatibility) cluster backups are now supported by AWS Backup, expanding the list of AWS features that are supported across compute, storage, and database. With this release, you’ll be able to maintain and restore backups for the Amazon DocumentDB database clusters via the AWS Backup service all at one place.
You can use AWS Backup to centralize and automate data backup across all of your AWS services. AWS Backup is a low-cost, fully managed, policy-based service that makes data protection at scale even easier. AWS Backup also assists in meeting your regulatory compliance duties and business continuity objectives. Exploring the console and configuring the setup for the backup of the cluster, we will see how we can create an on-demand backup job of an Amazon DocumentDB cluster, how to use a backup plan to backup the data, and how to add resources to an existing backup plan. In this blog, we will see how we can configure the AWS Backup console to create a backup for the Amazon DocumentDB cluster and restore the same onto a new cluster.
Hands-on
In this hands-on, we will see how we can make use of the AWS Backup service to create automated backups with the help of a backup plan, create an on-demand backup job for creating a backup for the DocumentDB cluster and finally restore the backup to a new Amazon DocumentDB cluster.
We will go through a process of creating a backup for an existing or a new Amazon DocumentDB cluster followed by restoring the backup onto a new cluster on the Amazon DocumentDB clusters page. With AWS Backup, we can create backup policies called backup plans.
These plans can then be used to define the backup requirements, such as how frequently you wish to back up the data and how long to retain those backups. We will first create a new Amazon DocumentDB cluster that we will be backing up and restoring it onto a new cluster. Once the cluster is configured, we will create a new backup plan using an existing template.
Then we will create an on-demand backup job assigning the Amazon DocumentDB cluster to it. Once the backup job is created, we will navigate to the default Backup Vault and restore the backup job that we created.
Finally, we will navigate to the Amazon DocumentDB cluster to check if the cluster was restored successfully and then have a look at how we can modify the settings for the newly restored cluster.
For the entire process, we will need access to the AWS Backup service to create backups followed by an Amazon DocumentDB cluster and we will have to configure the settings of Amazon Backup service to manage the Amazon DocumentDB resource type to be able to schedule backups.
To implement this, we will do the following:
- Login to your AWS Account and navigate to the Amazon Services Dashboard.
- Search for the Amazon DocumentDB service and navigate the service console.
- Create a DocumentDB cluster for which you wish to create a backup.
- Make the required configurations for the cluster as well as configure the advanced settings like VPC, encryption, etc.
- Navigate to the AWS Backup service dashboard.
- Create a new backup plan by navigating to the backup plan tab and starting with an existing template.
- Navigate to the Settings dashboard and enable the DocumentDB resource.
- Traverse to the newly created backup plan and assign the DocumentDB resource to it.
- Configure an on-demand AWS Backup job of an Amazon DocumentDB cluster navigating to the Protected resources dashboard.
- For the backup job, you can create a new role, choose an existing role, or use the default role.
- Keep an eye on the Jobs tab under the backup jobs section to check the status.
- Use the default one or create a new backup vault for your backup process.
- Go to the backup faults section and open the most recently generated backup.
- Restore the backup of the Amazon DocumentDB cluster.
- Navigate back to the Amazon DocumentDB clusters dashboard and cross-verify if the backup cluster was restored.
- Modify the settings for the newly created cluster as per your need.
Log in to the AWS account and navigate to the dashboard.
Search and select the Amazon DocumentDB Service.
On the dashboard, click on Create to create a new cluster.
An identifier will be pre-populated for the same cluster. Change the Instance class as per your requirements.
For the number of instances, select the count as per your requirements.
Enter a master username and a password for your cluster. Toggle the Advanced settings.
Under Network settings, you can select the VPC based on your requirements.
Under the below section, you can enable encryption if needed.
For the below section, how frequently you wish to backup your data is what you can configure.
You can add tags if needed and enable the deletion protection for your cluster. Click on Create cluster.
On success, you will see the message as shown in the image below.
After some time, you will see the cluster status changed to Available.
Now, search for the AWS Backup service and navigate to its dashboard.
Click on Create Backup Plan on the dashboard.
Select the Start with a template option from the available options.
Choose the template as per your choice from the dropdown.
Enter a name for your backup plan.
Leave the other settings as default and click on Create plan.
On success, you will see the message as shown in the image below.
Navigate to the Settings tab in the left navigation pane. Check if DocumentDB is enabled. If not, click on Configure resources.
Toggle the switch and enable the DocumentDB option. Once done, click on Confirm.
Navigate back to the Backup plans tab. Click on the plan that we created above.
Scroll down to the Resource assignments and click on Assign resources.
Enter a name for the resource. Leave the other settings as default.
Under Assign resources, select the Include specific resource types option. Under specific resource types, select the resource type as DocumentDB and select the cluster id of the cluster we created above.
Scroll down to the bottom and click on Assign resources.
On success, you will see the message as shown below.
Navigate to the Protected resources tab and click on Create on-demand backup.
Select the resource type as DocumentDB and the cluster id of the above cluster.
Scroll to the bottom and click on Create on-demand backup.
The backup process might take some time based on the amount of data you have in your cluster.
On successful backup, you will see the status of your backup changed to Completed.
Navigate to the Backup vaults page and click on the default vault.
Select the backup under the Backups section and click on Actions. Click on restore.
Enter a name for the DB cluster identifier. Scroll to the bottom and click on Restore backup.
The restoring process might take a few hours to complete.
On success, you will see the status to be changed to Completed.
If you navigate back to the DocumentDB dashboard, you will see the new restored cluster created.
You can then go ahead and modify the cluster configurations based on your requirements.
Amazon DocumentDB cluster
Conclusion
In this blog, we saw how we can make use of the AWS Backup service to create automated backups with the help of a backup plan, create an on-demand backup job for creating a backup for the DocumentDB cluster and finally restore the backup to a new Amazon DocumentDB cluster.
Amazon DocumentDB clusterWe went through a process of creating a backup for an existing or a new Amazon DocumentDB cluster followed by restoring the backup onto a new cluster in the Amazon DocumentDB clusters page. We first created a new Amazon DocumentDB cluster that we were to back up. Once the cluster was configured, we created a new backup plan using an existing template. Then we created an on-demand backup job assigning the Amazon DocumentDB cluster to it.
Once the backup job was created, we navigated to the default Backup Vault and restored the backup job that we created. Finally, navigating to the Amazon DocumentDB cluster, we checked if the cluster was restored successfully and then had a look at how we could modify the settings for the newly restored cluster. We’ll go over some more use cases of AWS Backup in our upcoming blogs. Stay tuned to keep getting all updates about our upcoming new blogs on AWS and relevant technologies.
Meanwhile …
Keep Exploring -> Keep Learning -> Keep Mastering
This blog is part of our effort towards building a knowledgeable and kick-ass tech community. At Workfall, we strive to provide the best tech and pay opportunities to AWS-certified talents. If you’re looking to work with global clients, build kick-ass products while making big bucks doing so, give it a shot at workfall.com/partner today.