Run HANA Express on AWS

  • created ec2 instance of suse enterprise 12
  • chose m3.xlarge, a memory optimized instance.
  • launched and created.
  • downloaded .pem file and added to .ssh folder
  • testing connection: ssh -i ~/.ssh/sap-encollab-hana-express.pem ec2-user@ec2-54-253-245-47.ap-southeast-2.compute.amazonaws.com
  • used cyberduck to do FTP’ing because easier. Just point “use public key authentication” to the .pem file.
  • uploading hxexsa.tgz

—- this did not work. !failed!

HANA Express

One of the more interesting announcements from SAP Tech Ed Vegas 2016 was the reveal of HANA Express a full, free version of HANA for everyone. HANA Express is free up to 32G of memory use. Unlike the old SAP Development Edition, there seems to be no specification that you cannot use HXE in a production environment.

Our goal today is to create our very own cloud hosted instance of HANA Express, and this guide will tell you:

  • what you’ll need to get HANA Express
  • what you’ll need to run upload Virtual Machines to AWS
  • what you need to do to upload a Virtual Machine and convert it to an EC2 instance
  • How you can connect to your cloud hosted HANA Express box

Be aware that there will be cost involved in running an EC2 instance. Be sure to check it out and see if that is acceptable to you.

First steps

We’ll need several things before we can go forth and start using AWS tools.

Getting HANA Express

First, we’ll need HANA Express from the HANA Express website, where you’ll find the download manager. You’ll have to sign up ofcourse, but it’s a quick process and you’ll have it on your computer in no time.

For people who do not have java installed, this is unfortunately a prerequisite for running the download manager, so if you haven’t done so, please install Java first. Since this is a command-line heavy guide, the quickest check is opening a terminal or cmd window and giving it a java -version. If you get results, you’re ok. If not, you can get Java from Oracle.

Punch java --jar path/to/HXEdownloadmanager.jar into your terminal to start the download manager.

In a flash of mental clarity, SAP have provided two different types of download for us: Binary, or Virtual Machine. You could do this whole thing from scratch by downloading the binaries, downloading openSUSE Enterprise 12 and going bananas. The easiest option though is to download the Virtual Machine. I just download the one that had the example applications, but it’s your choice.

Setting up the AWS environment

Once all the .ova files are in, we can get started on AWS. The first thing to do is to check if the AWS CLI tools are installed. Typing aws --version will be enough to check. If you get a command not found or similar message, please install it from the website. It’s available for most OS’ses .

Creating a bucket

The first thing on AWS we’ll do is create an S3 bucket and set up the necessary roles.

Next, think of a name for your bucket. Bucket names have to be unique, so you’ll need to come up with something specific to you. Make not of it. In the rest of this guide, I’ll be using bucket-name, this means you’ll have to replace those bits with your actual bucket name.

Creation is straight forward:

aws s3 mb s3://bucket-name

Creating the policies

Next, we’ll need a role called vmimport, so we’ll create a file called trust-policy.json and add:

json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "Service": "vmie.amazonaws.com" },
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals":{
"sts:ExternalId": "vmimport"
}
}
}
]
}

Use command:

--role-name vmimport --assume-role-policy-document file://trust-policy.json

Then created file role-policy.json with the following content. Don’t forget to replace the bucket-name with your actual bucket name:

json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetBucketLocation"
],
"Resource": [
"arn:aws:s3:::bucket-name"
]
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::bucket-name/*"
]
},
{
"Effect": "Allow",
"Action":[
"ec2:ModifySnapshotAttribute",
"ec2:CopySnapshot",
"ec2:RegisterImage",
"ec2:Describe*"
],
"Resource": "*"
}
]
}
aws iam put-role-policy --role-name vmimport --policy-name vmimport --policy-document file://role-policy.json

Upload the image

Now it’s time to upload the image to the S3 bucket created earlier.

aws s3 cp hxexsa.ova s3://bucket-name/ --region my-region

AWS uses it’s ‘multi-part upload’ for larger files, which means it’s going to break up your image into smaller chunks, upload them in parallel and assemble them at the end. It makes the upload itself faster, and it means you can recover from connection failure faster.

In case of the HANA virtual machine, it got chunked into 1061 parts! Progress will be reported straight into your terminal.

Convert the image

Once it’s done, the image needs to be converted into an EC2 instance. The command to do this takes a JSON file containing the details. So, create a file called containers.json and add:

json
[
{
"Description": "HANA Express",
"Format": "ova",
"UserBucket": {
"S3Bucket": "bucket-name",
"S3Key": "location/of/hxexsa.ova"
}
}]

Finally, the command to start the conversion is:

aws ec2 import-image --description "HANA Express" --region my-region --disk-containers file://containers.json

This will bring up a message telling you that the import is “Pending”, along the lines of

json
{
"Status": "active",
"Description": "HANA Express",
"Progress": "2",
"SnapshotDetails": [
{
"UserBucket": {
"S3Bucket": "my-bucket",
"S3Key": "hxexsa.ova"
},
"DiskImageSize": 0.0,
"Format": "OVA"
}
],
"StatusMessage": "pending",
"ImportTaskId": "import-ami-fhb6stp1"
}

Note the ImportTaskId. You can use this to check the status of the import, like so:

aws ec2 describe-import-image-tasks --import-task-ids import-ami-fhb6stp1 --region ap-southeast-2

AWS will tell you in another JSON based response:

json
{
"ImportImageTasks": [
{
"Status": "active",
"Description": "HANA Express",
"Progress": "28",
"SnapshotDetails": [
{
"UserBucket": {
"S3Bucket": "sap.encollab.hana.express",
"S3Key": "hxexsa.ova"
},
"DiskImageSize": 8897045355.0,
"Format": "RAW"
}
],
"StatusMessage": "converting",
"ImportTaskId": "import-ami-fhb6stp1"
}
]
}