August 8, 2018 / Nirav S
Magento itself provides inbuilt backup facility for its entire backup of application and database. You can setup a cron job for interval so it takes regular backup.
This blog is about what if you want to take a backup of your EC2 instance which is responsible to run you Magento core, so when you want to upgrade your server or want to take entire Ec2 backup regular interval to make your environment safe, this step by step process is very much helpful.
Amazon has not yet presented managed automated backups in EC2 service. It is only available in RDS service. But using CloudWatch Events we can configure automated snapshots for our EC2 volumes using Lamda functions or by calling EC2 CreateSnapshot API on our behalf. If you have database server on RDS you do not have to worry about databse backup as RDS has its own setup for backup.
Amazon CloudWatch is a monitoring service for AWS cloud resources and the applications running on it. CloudWatch helps you to collect and track metrics for your AWS resources.
You can configure alarm to help you react when changes happen to your resources. For example, you can create a alarm when your Magento EC2 instance is utilizing more CPU than the normal usage limit.
You can do more than creating alarm by leveraging the CloudWatch Events feature. In this tutorial, we are going to see the one such use case of CloudWatch Events where you can automate the EBS (Elastic Block Storage) snapshots creation.
A topic is a communication channel to send messages and subscribe to notifications. It provides an access point for publishers and subscribers to communicate with each other. In this section you create a topic named MyTopic.
To create a topic
To receive messages published to a topic, you have to subscribe an endpoint to that topic. An endpoint is a mobile app, web server, email address, or an Amazon SQS queue that can receive notification messages from Amazon SNS. Once you subscribe an endpoint to a topic and the subscription is confirmed, the endpoint will receive all messages published to that topic.
To subscribe to a topic
Now you have created a SNS topic and confirmed email address of end point. You will need this SNS topic to get alerts on automated backup status. In next steps you will learn how to take automated backups for Magento EC2 volumes.
You have created an notification alert whenever any snapshot will be created. This will help us to know the status of the snapshot into subscriber’s email.
Now create new rule into events to create snapshots automatically in every fix rate of time (Example – Minute, Hours, Days)
Congratulations now you have successfully set up automated snapshots for your Magento EC2 EBS volumes with SNS Notifications using CloudWatch Events.
Have queries about your AWS project ideas and concepts? Please drop in your project details to discuss with our AWS experts, professionals and consultants.