M
M
Michael2018-04-30 16:27:52
Amazon Web Services
Michael, 2018-04-30 16:27:52

What is the correct way to backup EC2?

For copying, I use a working method, but not the most elegant: once a month I create a new image of an ec2 instance and call it project-1,2,3 ... I know that there is a snapshot and that the snapshots were just taken for backup. Only when I was playing with them, I discovered that the kernel id is lost during recovery. Yes, it can somehow be found and restored. But I do not like this way because there is no certainty that at the right time it will be possible to restore the copy.
Explain on your fingers how to make copies without great difficulties?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2019-04-13
@yellowmew

very, very strange that for a year no one answered this question, I don’t even know, I feel like a necromancer.
In general, if you do not take into account bestpractices - you are doing the only way available to you in the right way.
Snapshot is a disk backup, not a virtual machine.
Backing up the machine completely, including kernelid and other settings - this is image (AMI)
Bestpractice, however, not the same
Preparing code + configuration scripts -> preparing artifacts -> starting the machine
Preparing code + scripts and preparing artifacts
Here you either prepare artifacts (for example, a zip archive in S3) with code and its corresponding scripts that make this code work on the machine
AND, optionally, prepare an AMI
This is the recommended way in many cases. In fact, you are now doing almost the same thing, but creating an AMI after publishing and stabilizing the code and settings (correctly - before, and test what happened). In addition, your method may lead to surprises in the future, since you are rolling changes to an existing machine and some settings made now will prevent future versions from working.
Another alternative is not to cook the AMI at all. Fix the version of the code and settings (configuration scripts). Prepare artifacts from them (or just git clone from the version repository) and carry out all configuration steps right at the start of the machine. You will not have some AMI tied to your account - you will have scripts that can be run on any account without an intermediate step.
Tools:
AMI preparation: packer, cloudformation
instance launch: terraform, cloudformation
configuration scripts: everything you like, from banal bash scripts to ansible,chef,puppet, etc..
Setting up the machine at startup: cloud-init
CloudFormation is a built-in tool in AWS, but it is rather complicated compared to packer and terraform

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question