You can use the SAP HANA Cloud Platform Virtual Machines to install R and use it with the SAP HANA server running in your HCP account. This is a demo scenario that illustrates one use case of the HCP Virtual Machines.
This scenario is described over 4 blogs:
- For this blog, we will use a 64 bit Windows machine
- You have Java 8 installed and the environment variable JAVA_HOME is set to the Java installation folder.
- You have the HCP Java Web Tomcat 8 HCP SDK downloaded and extracted to folder C:\Work\SDK.
- You have an HCP account configured with a quota for Virtual Machines
View the VM quota in HCP cockpit
Before we begin, here is what you see in the HCP cockpit once you have the VM quota enabled for your account.
|1. Launch the HCP account cockpit and go to the organization overview page.
|2. Choose Quota management from the left navigation area.
https://<<landscape_host>>/cockpit#/organization/<<org_name>>/quotaYou can distribute the the quota across different HCP accounts within the organization.
3. You will find the Virtual Machines tab in the Navigation area of the account to which the VM was assigned.
Create a Virtual Machine
In this exercise we will be creating a Virtual Machine on the SAP HANA Cloud Platform and opening an SSH tunnel to the virtual machine.
1. Launch the Windows command prompt and navigate to the SDK\tools folder.
Execute cd C:\Work\SDK\tools.
Note: Before you begin, please keep in mind that if you are behind a proxy, you would need to use the HCP neo commands for setting the HTTPS proxy host and port.
|2. Create an HCP VM by executing the command:
neo create-vm –size x-small –name testvm –account <<account_id>> –host <<landscape_host>> –user <<user_id>>Note: user_id is user ID or Email ID by which you have registered with HCP.
|3 Enter your password when prompted.|
4. Press ‘y’ for saving the generated key pair.
In this step, the key pair is generated which will be used to log in to the virtual machine. When generating the key pair, the file name is auto-generated and the file is saved in the directory where the command is executed.
5. Enter a passphrase by which you want to encrypt the key. Enter passphrase again to confirm.
For security reasons, the private key in the generated key pair can be encrypted with a passphrase. Remember this passphrase as you will need it when you connect to the virtual machine using an SSH client.
At this point the VM is created.
6. Run this command to see the created VM.
neo list-vms –account <<account_id>>–host <<landscape_host>> –user <<user_id>>
Once the VM has started, you can see the status of the VM as started.
|7. Click on Virtual Machines (Beta) tab in the HCP cockpit.|
|8. Click on the newly created testvm. You will see more details about the VM that you have created such as the VM ID and the IP address.||
Open an SSH tunnel to the Virtual Machine
In the next step, we will establish a secure communication channel to the Virtual Machine over Secure Shell (SSH) protocol. We will open an SSH tunnel and get all the communication details needed to log in to the virtual machine.
1. Execute:neo open-ssh-tunnel –vm-id <<VM_ID>> –account <<account_id>> –host <<landscape_host>> –user <<user_id>>
|2. To check if the tunnel was opened successfully, we will execute the neo command to list the currently opened SSH tunnels.
neo list-ssh-tunnelsWe see the newly opened SSH tunnel is listed here.
Now that the tunnel is open, you can use the SSH client of your choice to connect to the Virtual Machine using the public key and the connection details you got when executing the open-ssh-tunnel command.
You are the owner of this virtual machine and can install your software on it.