In the first article about using AWS tags, we learned about best practices associated with tags. For an organization working in the cloud with a number of servers, the backup strategy is very important. If the resources are in the AWS cloud, you must take advantage of Auto Scaling and Elastic Load balancing to achieve scalability along with cost optimization.
In this case, automation will play a key role for the backup since AutoScaling may launch new EC2 resources as well terminate resources based on defined conditions. In this second article we will talk about how do we use N2WS to achieve automated backup using the AWS tags. We will take a use case where we will setup a WordPress Site on two separate EC2 instances and load balance them using ELB. The MySQL database will also be hosted on a separate EC2 instance.
When you are setting up production WordPress site, it is very important that you use AutoScaling with ELB. All WordPress servers should connect with the single database (RDS or MySQL hosted on EC2) source. Do remember to launch web server EC2 instances in separate zones to achieve HA. If you are using AutoScaling, it would manage this functionality automatically as well register new launched instance with ELB.
In our next article we show you how to implement automatic cross-account and cross-region recovery for your WordPress site.
Introducing N2WS Backup & Recovery
N2WS Backup & Recovery is an enterprise backup, recovery and disaster recovery solution for EC2. It allows you to automate and maintain backups of your entire EC2 environment as well as achieve application-consistent backups. This is done by providing a mechanism to perform certain tasks before and after snapshots are taken, informing your OS of the backup. N2WS does help to achieve regular, application-consistent backups using the scheduler and policy as defined in backup solutions. In addition to this N2WS offers automated backup scheduling using AWS tags.
N2WS does have capability to scan the AWS resources (EC2, RDS) automatically and schedule them for backup. To enable this, you must have added tag with key as “cpm backup” and value as your cpm backup policy name. If a policy with the defined name does not exist, N2WS will create the policy. For this article, we have set up a WordPress site and launched two instances for this. We have configured ELB & AutoScaling on AWS as production website. We are using AWS Application based load balancer.
We have configured a blog on the WordPress site and want to plan backup of both WordPress as well DB. The WordPress is accessed through ELB. We want to automate the backup of EC2 instances on which WordPress site is hosted as well MySQL database hosted on separate EC2 machines. To automate the tag based backup with N2WS, it is required that each resource (EC2, RDS) should have the tag with key as “cpm backup” and value as the name of the policy. Tags for the WordPress EC2 Instance are shown below. Tags for the MySQL EC2 Instance is as below. It is important to note that wordpress_cpm_backup is name of backup policy defined in N2WS. If above policy is not defined N2WS will create new policy with the same name. To achieve this as well to scan resource for automated backup, you should enable Scanning in General settings of N2WS. When this setting is enabled, it will automatically scan resources from AWS account, find all the resources with tag “cpm backup” and schedule them for backup with N2WS policy defined above. You can verify the resources scheduled for backup from policy. It shows both EC2 WordPress Instances as well MySQL DB. N2WS will schedule the backup and create the snapshots automatically based on schedule configured with policy. We can verify the backup snapshots from backup monitor.
In this article, we showed how N2WS can help you achieve tag based automated backup of your web application. It is also important to note that when you setup AutoScaling with your WordPress instance, you should configure it such a way that it should also have tags with key “cpm backup” and key as policy name. This will ensure that any new instance that was spun up by Auto Scaling will be automatically scheduled for backup.
Generally, users plan backup of database for recovery but it is also important that you configure backup of your web server instance because it may have some log or configure data which might be useful for future recovery. N2WS will help. N2WS is an enterprise-class backup, recovery, and disaster recovery solution for EC2. It uses existing EBS volume and RDS database snapshot abilities to automatically take snapshots at regular intervals.
Additionally, you can set up policies and schedule backups for various targets. N2WS helps manage snapshots with policies. For example, if you have multiple snapshots, the older ones may be irrelevant. With N2WS, you can configure a policy to delete the snapshots after a certain period. This also helps in cost savings and effective backup management.
Be sure to check out our next article where we show you how easy it is to set up automatic cross-account and cross-region recovery for your WordPress site.