What’s that I hear, aren’t EBS volumes supposed to be persistent and not depend on whether an EC2 instance has been stopped or terminated? EBS Volumes are supposed to be persistent. However, on the Amazon website it clearly states that EBS root device volumes are automatically deleted when the instance terminates:
Instance Termination… By default, Amazon EBS root device volumes are automatically deleted when the instance terminates. However, by default, any additional EBS volumes that you attach at launch, or any EBS volumes that you attach to an existing instance persist even after the instance terminates.
This last part, however, seems to contradict elsewhere on the website
Data Persistence… By default, EBS volumes that are created and attached to an instance at launch are deleted when that instance is terminated.
In any case, this default behaviour can be changed. If the instance is not yet running, this can be done via the web console. If the instance is already running, the process is a bit more involved; here is a guide on how to modify the ‘deletion on termination’ flag for an EBS volume on a running EC2 instance.
As the guide above mentions, usage of the Amazon Command Line Interface (CLI) is required. This comes preinstalled on an instance. To check it is working,
The next step is to do a quick configuration of the CLI before using it to get the root device volume of a running instance to persist [Save the JSON file in the working directory. You might also get an error about user permissions].