Home > Software design >  Is it possible to copy to/from EBS storage to Local Instance Storage on instance up/down?
Is it possible to copy to/from EBS storage to Local Instance Storage on instance up/down?

Time:10-21

We have a workload that benefits greatly from extremely fast IO as well as working from an existing cache. The IO workload is potentially up to 100GB in size. I am currently testing out EBS gp3 10k IOPS and it is acceptable but it could be better.

Does Amazon support some sort of instance config where I can request to boot my instance by first copying the OS and the data into the ephemeral Local Instance Storage from an EBS volume, as well as back out again when I request a shutdown?

CodePudding user response:

EC2 provides such feature as enter image description here

Now, there is a difference between an instance being stopped and being terminated. If you stop an instance, the content of the ephemeral instance store wont be lost (more info: instance lifetime). If you terminate an instance, obviously everything is gone. I'm clarifying this. because according to AWS, there is no guarantee to safely copy data in case of instance termination (source]:

If you run a script on instance termination, your instance might have an abnormal termination, because we have no way to ensure that shutdown scripts run. Amazon EC2 attempts to shut an instance down cleanly and run any system shutdown scripts; however, certain events (such as hardware failure) may prevent these system shutdown scripts from running.

In order to save data from instance store, a solution would be to regularly backup data: https://aws.amazon.com/premiumsupport/knowledge-center/accidental-termination/

CodePudding user response:

I think you may be approaching this from a more complicated angle than you need to.

I think you should just leave the OS in an EBS volume and just use an appropriately sized Instance Store Volume for your working data.

Maybe a c5d.xlarge would be a good choice.

Also, you still need to think of a solution to reliably copy the data back to persistent (EBS) storage on shutdown... maybe you could make a systemD service that runs on shutdown that just does a rsync; maybe this puts you in the right direction: https://medium.com/@benmorel/creating-a-linux-service-with-systemd-611b5c8b91d6

Also, if you want a start up script that runs every boot, here is more info on doing that: https://aws.amazon.com/premiumsupport/knowledge-center/execute-user-data-ec2/

Finally, to address your first question "Does Amazon support some sort of instance config where I can request to boot my instance by first copying the OS and the data into the ephemeral Local Instance Storage from an EBS volume, as well as back out again when I request a shutdown?" Short answer: No.

  • Related