0 votes
1 view
in AWS by (19.2k points)

I have a community AMI based Linux EC2 instance in AWS. Now I want to take a daily back up of my instance, and upload that image into S3.

Is that the correct way of doing the back up of my EC2 instance? Can anybody help me to point out the correct method for taking back up of my EC2 instance?

1 Answer

0 votes
by (44.6k points)

Hopefully, your instance is EBS backed.

If so, you'll be able to back up your instance by taking an EBS snapshot. That can be done through aws.amazon.com (manually), using AWS CLI Tools (which are often automated and scheduled in cron or Windows Task scheduler as appropriate) or through the AWS API.

You want to make sure that no changes are made to the state of the Database backup files throughout the snapshot process. While I used this strategy for MySQL running on Ubuntu, I used a script to ensure a consistent snapshot. That script uses a feature of the XFS file system to freeze the filesystem during the snapshot. In that deployment, the snapshot only took 2-3 seconds and was performed at a very off-peak time. Any website viewers would experience a 2-3 second lag. For Windows, if the device cannot be rebooted for the snapshot (you have no maintenance window at night), I would instead create a separate EBS device (e.g. a "S:\" device for snapshots), use SQL Server backup tools to create a .bak file on that other device, then create an EBS snapshot of that separate EBS device.

To create a snapshot manually,

To create an AMI image from the instance and launch other instances just like it (in instances with more resources or to balance load, etc.):

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !