How to make a daily backup of my ec2 instance?

I have an instance of the Linux EC2 AMI-based AMI community based on AMI AWS . Now I want to make a daily backup of my copy and upload this image to S3 .

Is this the right way to back up my EC2 instance? Can someone help me point out the correct method to return my EC2 instance?

+45
amazon-s3 amazon-web-services amazon-ec2 amazon-ebs
Jul 04 2018-12-12T00:
source share
1 answer

We hope your EBS instance is supported .

If so, you can back up your instance by taking an EBS snapshot. This can be done using aws.amazon.com (manually) using AWS command-line tools (which can be automated and scheduled in cron or the Windows Task Scheduler, if necessary) or through the AWS API.

You want the state of backup database files not to be changed during the snapshot. When I used this strategy for MySQL running on Ubuntu, I used a script to provide a consistent snapshot . This script uses the XFS file system function to lock the file system during snapshot. In this deployment, the snapshot took only 2-3 seconds and was taken during very idle hours. Any visitors to the site will experience a 2-3 second lag. For Windows, if the device cannot be rebooted for a snapshot (you do not have a service window at night), instead I will create a separate EBS device (for example, the S: \ device for snapshots), use the SQL Server backup tools to create the file. bak on this other device, and then take an EBS snapshot of this individual EBS device.

For more information on writing a backup, see this related question:

Amazon EBS snapshot automation someone has a good script or solution for this on Linux

If you have a separate repository, for example, for your database, be sure to return this too!

UPDATE

To take a picture manually

To create an AMI image from an instance and other instances similar to it (in cases with lots of resources or for load balancing, etc.):

+43
Jul 04 2018-12-12T00:
source share



All Articles