Amidst the truckload of announcements from AWS around re:Invent this year, one that caught my attention was the ability to perform EC2 instance hibernation. This isn’t going to be directly applicable to all workloads or all businesses, but it provides a needed way to bridge the gap between On-Demand EC2 and Spot instances. By having this option, it should be easier to go between both compute choices to solve more business cases.

Spot Instances 101

One way AWS helps you save money is by letting you utilize spare compute resources as instances called Spot. There’s a whole economy around Spot Instances, as the price can go up or down based on free resources in AWS data centers. To purchase Spot Instances, you establish your bid price, and if the price of your desired instance goes under the bid, then you get the resources. The biggest catch is that once the price goes above your bid price, your gets stopped in the middle of what it was doing.

This behavior means that you need to have workloads that can be paused. One big consideration is that you don’t want to have time-sensitive workloads operating in this environment, as it may take longer to complete the overall task if the processes keep getting interrupted. This also means that you’ll want to build your subtasks and processes in a way that they can be interrupted without breaking horribly.

Interruptible Workloads On-Demand

Now, with the ability to perform EC2 instance hibernation, the processes that you’ve already made interruptible can run on demand, with you choosing when to pause those workloads. By having this flexibility, you can eliminate the concern of not finishing a task before a desired date that comes with Spot instances, but still have the ability to switch to Spot (or out of Spot) if desired. This combines some of the best aspects of Spot and On-Demand Instances.

In addition to the benefit of workloads completing on your timetable, you can also utilize hibernation to pre-warm EC2 instances that have apps that might take a while to spin up. This can be especially true for memory-intensive applications, as any data that was in memory prior to hibernation will be immediately available upon restart. You could even use this as a workaround to long warm-up times for AWS Lambda functions, as instead of waiting for the Lambda to spin up, your instance could be running your function locally with everything pre-loaded.

EC2 Instance Hibernation: Supercharging Spot

Last year, AWS added the ability to hibernate Spot instances, which changed the game on how you plan your Spot workloads. Now, with EC2 Instance hibernation, you can take your workload management to the next level by having a wider array of options available to you.

This kind of hibernation seems like a great fit for image processing, video encoding, or after-hours high performance computing. Got any other good ideas or use-cases for EC2 instance hibernation? Let us know what you think!