I need to take the snapshot of all the EC2 instances. I am confused how to take the snapshot of the volume that is mounted as root? Should I shut down the instance before taking the snapshot of root volume?
2 Answers
Assuming you have and EBS-backed instance, to create a snapshot for an EBS volume that serves as the root device, you should stop the instance before taking the snapshot.
-
2
-
I know its been 7 years, but even though its recommended to stop the instance, in my experience the process works just fine with the instance running. Maybe a tad slower.– ccov77Dec 15, 2022 at 11:52
If you shutdown all machines and after take snapshots thats the much better, if not affect your infrastructure.
use the that link for create snapshot http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-creating-snapshot.html
you can create a script.like this as you can better..
all_instance_ids=ec2-describe-instances | grep INSTANCE | grep running | sort -k10 | cut -f2
for i in ${all_instance_ids}
do
ec2-create-snapshot ${i}
done