Skip to Content

Recently Virtual machines were made generally available in SAP HANA Cloud Platform (only in EU  Data center). You can use these virtual machines to install and maintain your own applications which are not otherwise available on HANA Cloud Platform.

Let’s take a close looks at what is provided as part of the virtual machine. Customers get access to virtualized hardware resources which include RAM, CPU, disk space along with SUSE Linux Enterprise Server. These virtual machines run in a private virtualized network and can be integrated with the HCP resources within the same account.They are available in different t-shirt sizes.

T-shirt sizes CPU RAM (GB) Disk (GB)
XS 1 2 20
S 2 4 40
M 4 8 80
L 8 16 160
XL 16 32 320

Once a virtual machines is provisioned to the customer, it’s the customer responsibility to patch the OS and also plan for the backup regularly.

The communication to the virtual machines is allowed only via a SSH tunnel using the console client. Once the tunnel is established, you can SSH and login as a root into the VM. In the above diagram, I have depicted a tighter integration of applications running in the VM with HANA DB or Apps running in the same HCP account.

Also, another important thing to note is that you can enable all outbound communication from Virtual Machine to outside world. However, an inbound call from the outside world has to be HTTPS and it would be directed to a software process running on your VM and listening on port 8041.

Myself and my colleague Darrell Lee began on a journey to install SAP HANA Express on top if these Virtual Machines. We were particularly interested to leverage nodejs and other XSA features which are not currently available in HCP HANA DB. We managed to install HANA Express only to find that we are restricted in accessing the HANA system from outside the VM. We neither could use HANA Studio nor even access XS engine via the browser.  We then focused on installing nodejs runtime on the VM and created an application which uses XSOData service exposed from the HANA DB available in the HCP account. In this blog, we will outline the steps performed to run a nodejs application on the HCP VMs.

Prerequisites:

Provision a VM for your HCP Account

To get started, you need to request a VM to be provisioned to your HCP account. Once it is provisioned, you can navigate to the Quota Management section of your HCP account to verify the quota. In our example, we have used extra large VM.

Create an instance of your VM

Once the VM is provisioned to your HCP account, you are now ready to create an instance of the VM.  I have put all the softwares – openSSL, HCP SDK, Putty in a folder called VM located in my C drive.

You would need to issue the below Neo command to create an instance of my Virtual Machine. Provide a pass phrase as it will be needed to generate the certificates.

neo create-vm --size x-large --name myhex1 --account a6de11574 --host hana.ondemand.com --user <myuser>

After a minute, you will be able to see a virtual machine created in your account and it should have the status as Started.

You will also find a new key generated in the SDK folder

Use openSSL to create a .pem certificate as shown below.

openssl.exe rsa -in "C:\VM\SDK\tools\hana.ondemand.com\a6de11574\myhana.key" -out myhana.pem

This would generate .pem file within the bin folder of openSSL.

Launch the Putty Generator tool.

Navigate to menu Conversions > Import key and import the .pem file generated in the previous step. Provide the pass phrase and click on “Save Private Key”.

This will generate a .ppk file which we will need always to access the VM.

In order to enable access of this VM from the internet, you would need to provide the below command.

List the VMs associated with your account using the list-vms command. Make a note of the floating IP and the access-point URL

neo list-vms --account a6de11574 --host hana.ondemand.com --user <myuser>

Finally, create an SSH Tunnel by using the open-ssh-tunnel command. This will give you a port which you will need to use when trying to login via SSH client.

neo open-ssh-tunnel --vm-id 75a31590-2f93-4901-9786-9098bcce6e4c --account a6de11574 --host hana.ondemand.com --user <myuser>

Launch Putty and from the left hand side menu, navigate to Connections > SSH > Auth and use the browse option to locate the .ppk file generated earlier.

Navigate back to session and under host name provide root@localhost and port with the value obtained earlier.

Provide the Pass phrase and you will be logged on to the VM.

Build you applications on top of the VM

We now have full access to install any software we wish to. As I mentioned earlier, we installed HANA Express and were able to start/stop the instance. But due to some restrictions, we were not able to connect via HANA Studio. Hence, we installed Nodejs following the standard documentation from nodejs website.

We put up an application which creates a HTTPS server renders a web page. We enhanced this further by making the appliction to query an HANA XSOData service to obtain top sales orders. The XSOData service is based on the standard SHINE contents which have been installed on the HCP HANA DB. This web applications has to be accessed over HTTPS.

Below is the snapshot of the js file. Notice that we have made the server to listen on port 8041. This programs needs to be executed for anyone to access the Webpage externally.

Here is the sample XSOData service from the SHINE contents which are installed on HCP HANA DB

Below is the code snippet to make a call to the XSOData service and obtain the results.

var http = require('https');
var extServerOptions = {
    host: '<host>.hana.ondemand.com',
    port: '443',
    path: '/sap/hana/democontent/epm/services/salesOrders.xsodata/SalesOrderHeader?$top=1&$format=json',
    method: 'GET',
	auth : 'userID:MyPassword'
};

function get() {
    http.request(extServerOptions, function (res) {
        res.setEncoding('utf8');
        res.on('data', function (data) {
            salesOrder = JSON.parse(data);
        });
 
    }).end();
};

get();

Once the nodejs application is executed, anyone on the internet can access the application using the access point URL https://myhex1a6de11574.hana.ondemand.com/

Below is how the web application would look like. Notice that I am accessing it via HTTPS and the application displays Sales Order details which are available in a HCP HANA DB.

I think these Virtual Machines will open more opportunities for customers to would be able to implement more scenarios which they couldn’t achieve earlier. Hope you found this useful.

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

  1. Parag Jain

    Timely Blog Murali. Great stuff. I was planning to use a VM for a very different use case – a SFTP server for some HCI scenario. But your following findings would make me looks elsewhere 🙁

    1 – The communication to the virtual machines is allowed only via a SSH tunnel using the console client.

    2 – However, an inbound call from the outside world has to be HTTPS and it would be directed to a software process running on your VM and listening on port 8041.

    (0) 
  2. Benjamin Reuter

    “To get started, you need to request a VM to be provisioned to your HCP account. Once it is provisioned, you can navigate to the Quota Management section of your HCP account to verify the quota.”

    This is as far as I get. How do I request a VM to be provisioned to my HCP account?
    Are there any tutorials for people who are not already SAP experts?
    I’ve worked through several SAP HANA Tutorials within the last few days, but almost none of them work as described. The Java stuff for example seems to be two versions behind the current Java release and apparently need totally different procedures to get running. Most times I get a 404 page without any more information.

    Sorry for letting some steam of here, but I can’t comment on the mentioned tutorials (like this one)

    btw: I tried to use the “quote” function here, but it always marks the whole comment as quote, not just what I’ve selected.
    This does fit perfectly into my recent SAP experiences.

    (0) 
  3. Peter Peshev

    Hello Benjamin

    For the free Development accounts such feature is not available. For the others you can obtain it as an additional resource. More info on the type of accounts and how additional resources can be ordered is available Getting an accountl

    HTH
    Peter

    (0) 
  4. Coulson Zhu

    Hello Murali Shanmugham,

    I created a VM in SAP-Internal (Canary) following your tutorial step one by one. But when I opened the url to access it, it didn’t response. I guess the request doesn’t arrive my server at all since there are no request logs.

     

    Do I have to do some other settings not mentioned in your post to make it work?

    (0) 
    1. Murali Shanmugham Post author

      Hi Coulson, I am not sure if the process is different if you are on an internal landscape. There could have been changes to the way VMs are accessed in the last few months.

      (0) 
  5. Vignesh Jeyabalan

    Hi Murali,

    I have a scenario where I have installed python server on HCP VM and trying to execute a python code which uses the PYHDB library to connect with Hana DB.

    When i executed it from my local machine  i used NEO SDK to open DB tunnel and i was able to successfully connect to HANA DB in HCP from Python.

    But for this to work in VM what are the configuration i need to do ??

    Thanks

    Vignesh J

     

    (0) 

Leave a Reply