Hyperon in AWS

Hyperon Runtime

Recommended reading:

Launch the AMI

To get started, visit the Amazon Marketplace. In the search bar that appears, enter Hyperon Runtime and press Enter.

 

Click the "Hyperon Runtime" entry.

On the main page, you can read basic information about Hyperon Runtime. Click Continue to subscribe and read Terms and Conditions. After getting yourself familiar with the license, click Continue to configuration.

On this screen, you can choose the Hyperon Runtime version and region you want to launch your instance in. Next, click Continue to launch.

Select Launch through EC2 in the Choose Action section. This step is required to be able to specify the user-data script, which allows passing environment variables to the application without the need to log in to the instance.

 

Define required properties

By default Hyperon Runtime AMI uses AWS Systems Manager Parameter Store to fetch properties at the start of the application. You should specify AWS_ACCESS_KEY_ID and AWS_SECRET_KEY in the user-data script to connect AWS Systems Manager Parameter Store. If you do not define those properties, Hyperon Runtime will not launch.

Required properties with example values:

  • /config/hyperon-runtime-rest/hyperon.database.username

         value: admin

  • /config/hyperon-runtime-rest/hyperon.database.password

         value: admin

  • /config/hyperon-runtime-rest/hyperon.database.url

           value: jdbc:postgresql://hostname:port/postgres

Another option is to disable AWS Systems Manager Parameter Store with environment variable AWS_PARAM STORE_ENABLED=FALSE with the help of a user-data script and provide necessary properties directly in this script.

 

User-Data Script

Content-Type: multipart/mixed; boundary="//"
MIME-Version: 1.0

--//
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"

#cloud-config
cloud_final_modules:

[scripts-user, always]
--//
Content-Type: text/x-shellscript; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="userdata.txt"

#!/bin/bash
echo AWS_ACCESS_KEY_ID="KEY_HERE" > /home/ec2-user/environment.conf
echo AWS_SECRET_KEY="SECRET_HERE" >> /home/ec2-user/environment.conf
--//

This complex script is required to pass new environment variables on every EC2 reboot, as pointed out in this article

 

Instance Launch Options:

  • Version: The default should launch the latest version available on Amazon Marketplace. It's highly recommended that you always run the newest version of the software to ensure that stability fixes are in place.
  • Region: Select the region you would like to launch your instance in. The image is available in all of Amazon's publicly available regions.
  • EC2 Instance Type: Select the instance type you would like to use for your launched Hyperon Runtime.
  • Security Groups: Expose ports to access EC2 instance and Hyperon Runtime.

                1.     TCP 22 – SSH, used to administrate your instance remotely.

                2.     TCP 8081 – Hyperon Runtime, this is the port on which you can access Hyperon Runtime.

  • Key pair settings: Generate or use an existing one.Those will be needed later to access the EC2 instance.

Go to Security Groups in AWS Management Console and click Create security group.

This is the configuration of the security group used to access Hyperon Runtime. For simplicity, I choose source "Anywhere-IPv4" for the SSH port. However, it would be best if you restricted it to your public IP address by selecting "My IP" or to the company network while specifying the source.

Log in to the instance

After successfully deploying the AMI image, you can log in to the instance.

You need to use a PEM file with a public key downloaded while creating the EC2 instance. Type the ssh command in the terminal (Powershell on Windows or any other able to use ssh program):

ssh -i PATH_TO_PEM_FILE ec2-user@IP_HERE

The jar file present in the "ec2-user" home directory is deployed as a standalone java application. Systemd service is configured to manage this instance. Therefore, you can use systemctl commands to, e.g., start, stop, enable, disable or check status.

Properties customization

Hyperon Runtime allows you to define properties in several locations. The properties are processed in the order defined below;this implies that the last one overwrites other overlapping properties.

·        /home/ec2-user/conf/application.properties

·        /home/ec2-user/application.properties

·        from “HYPERON_CONFIG_PATH” environment variable (can be defined in user-datascript)

·        environment variables (from /home/ec2-user/environment.conf)

·        AWS Systems Manager Parameter Store

 

Updating the instance

Some updates are probably available from the time we build the AMI and the time you deploy it, potentially critical security updates. Therefore it is highly recommended to update the server with the command:

sudo yum update -y

 

Supported Databases

Hyperon supports various SQL databases,including PostgreSQL, Oracle, H2, and MsSQL. By default, we have built the AMI with PostgreSQL support. This means that the PostgreSQL JDBC driver is referenced in run_hyperon_runtime_rest.sh script with loader.path property:

-Dloader.path=/home/ec2-user/postgresql-42.2.5.jar

We only expect you to provide the URL and credentials for the database. If you want to connect to another database, replace this path with a new one pointing to the proper driver. After the driver is specified, update properties to point to the new database.

 

More tutorials

Hyperon in AWS