Search code examples
amazon-ec2amazon-web-servicesamazon-ebs

Will my EBS volume in my EBS backed EC2 instance persist?


So I have setup a server on Amazon Web Services EC2 with an EBS backed volume. It will act as an SVN server so I will certainly want the EBS volume to be persistent.

The scenario I have in mind is say the EC2 instance dies for whatever reason, I can just boot up another EC2 instance with that same EBS which will have all the data it had up until the previous EC2 instance crashed

I did some reading and it says when the server terminates, it will also delete the EBS volume attached to it. Does this mean if say it crashes, or the host machine goes down will I lose the EBS volume?

If yes, then what do I need to do to ensure my EBS volume remains even though the EC2 instance it was attached to as root device is no longer around?

FYI, all I've done at this point is created an instance from the Amazon Linux AMI with EBS, and set it up the instance as necessary


Solution

  • You can change the "Delete on Termination" setting for your instance to keep an EBS volume even if your instance gets terminated. If you are using the command line tool, you can use the ec2-modify-instance-attribute --block-device-mapping command. Here is a link to Amazon's documentation on this subject. http://docs.amazonwebservices.com/AWSEC2/latest/CommandLineReference/ApiReference-cmd-ModifyInstanceAttribute.html?r=4426