Skip to Content
Author's profile photo Former Member

Reduce your HANA AWS cost by utilizing Spot Instances

I am sure many of you have been using the HANA Developer Edition on AWS for  openSAP’s Software Development on HANA course. As we are into week 6 of the course (trying to spend as much time to practice the examples shared by Thomas Jung), I will try to share a quick tip to save on AWS costs.

In Week 1 Thomas pointed out that by using Spot Requests we can bid for unused capacities for Amazon instances. While working on these spot instances I realised that there is a catch. Any work that you do on the spot instance would be lost as you need to TERMINATE the instance. Why? Because, there is no option to STOP a spot instance. Thankfully, there is a way around this to ensure you dont lose your long hours’ work.


  1. SAP HANA Developer Edition on AWS
  2. An Amazon Machine Image (referred to as base AMI subsequently) taken at a suitable point of time. This must include all your development artifacts that you would like to be available in your spot instance (to be requested in subsequent steps).


  1. Create a new Spot Request using your base AMI
  2. When you create the request ensure you mark all your EBS volumes as “Delete on Termination” = TRUE. This will ensure that after you are done with using your HANA instance, these volumes don’t lie in your AWS account adding to the costs
  3. After you HANA instance is up and running, associate your Elastic IP to the newly created instance. You can then complete your development tasks that you planned for. Please Save & Activate everything to ensure the HANA repository is up to date.
  4. After your tasks are complete and you no longer need the instance, create a new Amazon Machine Image for your “Spot Instance”. [Please note that you are not creating an image of your original instance which is probably not running at this point of time.]SpotInstances.jpg
  5. The status of your new AMI will change to “available” after successful completion.
  6. Remove the association between the Elastic IP and the Spot Instance.
  7. Now you can terminate your spot instance.

Whenever you want to resume your work for HANA, you can create a new Spot Request using the new AMI created in Step 4 and use it as the Base AMI. As you keep following these steps week after week, please ensure that you remove older AMIs & snapshots to keep your costs down.

If you do not want the hassle of creating a different AMI each time, Mani Sekaran Muthu has a good blog on an alternative approach.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Nilesh,

      Something else you can do to help manage cost is to create am Amazon CloudWatch alarm with action.  For example, you could create an alarm with an action to stop the instance when average CPU utilization drops below 10% for certain number or periods in a certain amount of time (see link below for details). This would be similar to a motion sensing light switch automatically turning off a light after you have left the room.



      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Bill,

      Thanks for the useful tip. I did not realise until now that alarms provide an option to stop the instance as well.



      Author's profile photo Mani Sekaran Muthu
      Mani Sekaran Muthu


      In your second paragraph, you say "there is a way around this to ensure you dont lose your long hours' work."  But the steps you outlined for saving work between sessions may work only for user-initiated termination of spot instances. Termination of spot instances could also be AWS-initiated because of price, capacity, or other reasons ( -- in this case your would lose all the work your have done in your session before the termination.

      The method I describe in my blog, which you referenced in this blog, would save the work you have done up until termination time in your session, regardless of whether the termination is AWS-initiated or user-initiated.


      Author's profile photo Wolfgang Röckelein
      Wolfgang Röckelein

      You can now request spot instances lasting for at least 1-6 hours. So can rely on that and as long you create the new AMI before the requested end you will be fine.

      Author's profile photo Former Member
      Former Member

      managing AWS costs becomes a critical task with all the Vora-driven multi-instance installations of Hadoop, Ambari, Zookeeper, Zeppelin, Coudera, etc.

      Author's profile photo Former Member
      Former Member

      Hi there,

      it's weird and i have never done it before, but let me give it a shot as it's Halloween, so who knows. i'm going to respond to a comment that hasn't made it yet or is not any longer here:

      i may not have all the facts and probably am missing something, but this blog needs updating to the latest "architecture" of #AWSHANA. this architecture is different from what it was during the last summer in one important aspect. what is different is that both server and client are now running as AWS instances.

      i have created AMI's for both twice and in both cases i was unable to connect from the client to the server. i think it's due to missing key pairs as they get wiped out when the original instance request is terminated and creating new ones is not accepted by the hana (linux) server. (windows) client seems ok as it only requires reentering the password, but for some reason the server cannot be connected to. until there are persisted AMI's that can have spot requests created for them and the connection is made successfully, i don't see a way of using spot pricing (which is but a fraction of the regular pricing).

      if the above can be corrected i will be more than happy to be wrong about this.

      everyone, enjoy your #awshana !