Accessing volume/snapshot data without starting instance Amazon EC2

2.3k views Asked by At

Is it possible to access the data stored on a volume or snapshot in Amazon EC2 without starting the instance that the volume is attached to? I have simulations that run overnight, followed by an alarm that stops the instance once the CPU drops below 15%. I'd like to be able to access the simulation output without restarting up the instance (avoiding excess costs and saving time). Is it possible? If so, how would I go about doing it?

Amazon has documentation describing the access of snapshots through Amazon Gateway:

Q: When I look in Amazon S3 why can’t I see my volume data? Your volumes are stored in Amazon S3 and accessible through AWS Storage Gateway. You cannot directly access them by using Amazon S3 API actions. You can take point-in-time snapshots of gateway volumes that are made available in the form of Amazon EBS snapshots. Use the file interface to work with your data natively in S3.

But I am unsure if this is referring to the same volumes that I am attaching to instances on EC2. Amazon does not go into further detail so I am hoping someone might have some insight.

2

There are 2 answers

1
Nath On BEST ANSWER

No, to get at the data in an EBS volume you need to attach it to a running ec2 instance of some kind. Also Storage gateway volumes != ec2/EBS volumes. So nothing about them applies to your situation

You could take a snapshot of the volume and attach a copy of the new volume to a different (cheaper) instance but I think your barking up the wrong tree.

I think a better solution is the one in the comments. Have your instance dump the output to s3 then shut itself down. This will be way more convenient and s3 storage is considerably cheaper than EBS volumes and also unbounded. You could also use s3 lifecycle policies to push old data to glacier for even cheaper storage( slow access)

You could also then probably then just use an EBS volume for your root volume and use the instances free instance (fast temp local host storage lost when instance is stopped ) storage during the simulation saving you the cost of large expensive EBS volumes that are now only going to be storing temp data.

3
Michael - sqlbot On

At the risk of potentially stating the obvious... detach the volumes from the stopped instance and attach them to a different (presumably much cheaper) instance in the same availability zone.

When you're done getting the data, stop the second instance, detach the volumes, and put them back on the original instance. This perhaps sounds like a hack, but attaching EBS volumes to an instance is a logical (not physical) operation and this is quite safe if the volumes are not mounted by the instance OS when you detach them.

Note that Storage Gateway is not related to what you are doing.

Note also that the data in EBS snapshots is not directly accessible. EBS snapshots can only be "read" by creating a new EBS volume from the snapshot.


Plan B: use Elastic File System (EFS). This is the most expensive storage option available in EC2 but it is also the most flexible because you can mount the volumes on multiple instances across multiple availability zones within a region, simultaneously.