Apama and Amazon Marketplace

Introduction

apama_amazon_marketplace_1

Amazon marketplace is a new offering that they describe as follows

AWS Marketplace is a curated digital catalog that makes it easy for customers to find, buy, deploy, and manage third-party software and services that customers need to build solutions and run their businesses. AWS Marketplace includes thousands of software listings from popular categories such as security, networking, storage, machine learning, business intelligence, database, and devOps and simplifies software licensing and procurement with flexible pricing options and multiple deployment methods.

At the time of writing Software AG products have been published on AWS Marketplace and are available for use. You can find them by searching for Software AG on the main marketplace page here. There will be a listing for Apama alongside the other Software AG products and this will take you to a product overview page that should look similar to the picture below.

apama_amazon_marketplace_2

Whilst you can browse the offering without an Amazon account, you will need to have an AWS account to make use of them.

Useful links

AWS is a complex ecosystem of components, and it is well beyond the scope of this blog post to describe exactly how you can get a working environment. For people that are new to AWS I will highlight a few resources that can ease the process of provisioning the correct resources once you have signed up.

  • virtualenv – generate a personal Python install that can be used to install useful tools
  • aws CLI – Python CLI tool specifically for the setup of Kubernetes environment and interacting with AWS
  • eksctl – this is a one stop tool for creating an EKS cluster
  • kubectl – the required version must be >= 1.10 to work with AWS
  • AWS IAM authenticator for Kubernetes – used by aws CLI to manage credentials

There is a bias toward Linux and command line within this blog post but everything here can also be achieved in a Windows environment and by using the AWS console. See the Amazon AWS website for specific details and tutorials on how to use the console and what everything means.

Getting Started

I am going to take you through from subscription to running the Apama AWS Marketplace images. I will show below how to get Apama from the marketplace, and to deploy a container in a pod running in an EKS cluster. The process will be similar for EC2 but is not explicitly covered here. To keep this blog lean I am assuming that you have:

  • an AWS account and aws CLI installed (see here for further details on the aws CLI)
  • A configured EKS cluster to run the container on.
  • See here for those not using eksctl listed above
  • otherwise you can run eksctl create cluster apama-eks-cluster
  • kubectl configured ( Note eksctl sets this up for you)

The first thing to do is subscribe to the Apama offering in the AWS Marketplace, you do this by clicking the ‘ continue to subscribe ‘ button on the top of the page (See image above). This takes you to a page where you accept terms and the process of subscription continues. The sign-up is complete when you receive a mail confirming that you are subscribed similar to below, and the ‘ Continue to Configuration ‘ button becomes usable.

Dear AWS Marketplace Customer,
You have subscribed to the following product in AWS Marketplace:

  • Apama sold by Software AG USA Inc.

You are now able to use this software with AWS.
Amazon Machine Image (AMI)-based products can be launched directly
from AWS Marketplace, via the AWS Console, or through EC2 APIs. If you
have subscribed to a Software as a Service (SaaS) product, you can
access it directly from the seller’s website or from the Your Software
page in AWS Marketplace.

The mail refers to AMI, but we do not have an AMI definition and so launching from marketplace is not currently an option for our images. The reason for this is because Apama correlator will form the basis of an application and the images provided will usually be used to create new images containing user created code and configuration.

apama_amazon_marketplace_3

Next we continue to the configuration page which allows the selection of the version but only has one option for fulfillment currently. Whilst the supported Amazon Services say that it can only be used in EKS it can in fact be used in ECS in a similar way as outlined below.Click ‘Continue to Launch ‘ and you will see a page similar to this:

apama_amazon_marketplace_4

Click on ‘View container details‘ link and you will see details of the containers in a pop-up window including the image registry names and how to authenticate to pull the images.

apama_amazon_marketplace_5

Running the images

Now we are subscribed we can use the container by referring to the images in our Kubernetes configuration or on the command line. Using the command line we log in so that Docker can access the images. The login command uses aws CLI and indirectly calls docker login to the Apama marketplace registry.

$(aws ecr get-login --no-include-email --region us-east-1 --registry-ids 217273820646)

The pull is a more familiar command that gets the image from the marketplace registry and stores it locally so it is accessible when we come to create resources that will access it.

docker pull 217273820646.dkr.ecr.us-east-1.amazonaws.com/8496183b-fe06-4e81-b06d-be41382ffe62/cg-1440612375/apama-correlator:10.3-latest

The image can be run by using kubectl, see Kubernetes documentation for full details.

kubectl run --image=217273820646.dkr.ecr.us-east-1.amazonaws.com/8496183b-fe06-4e81-b06d-be41382ffe62/cg-1440612375/apama-correlator:10.3-latest  apama-correlator --port=15903

Lastly the image can be referenced in a configuration file. Apama has several samples that can be used to test the images but here I have chosen the simple-sample. I edited the kubernetes.yml file so that it refers to the correct image.

kind: Pod
metadata:                                                                                                                              
name: simple-sample
spec:                                                                                                                                  
  containers:
    - name: simple-sample                                                                                                                  
      image: 217273820646.dkr.ecr.us-east-1.amazonaws.com/8496183b-fe06-4e81-b06d-be41382ffe62/cg-1440612375/apama-correlator:10.3-latest                                                                                                                                          
      ports:
        - containerPort: 15903

Then I used kubectl to deploy a pod running the container.

kubectl create -f kubernetes.yml
pod/simple-sample created

The status of the pod can be obtained by using

kubectl get pods

NAME                READY   STATUS    RESTARTS   AGE
pod/simple-sample   1/1     Running   0          51s

Further detailed information, including what the current state of the pod is, can be obtained using:


kubectl describe pods simple-sample

...
Events:
  Type    Reason                 Age    From                    Message
  ----    ------                 ----   ----                    -------
  Normal  Scheduled              8m23s  default-scheduler       Successfully assigned simple-sample to XX.eu-west-1.compute.internal
  Normal  SuccessfulMountVolume  8m23s  kubelet,                MountVolume.SetUp succeeded for volume "default-token-xxxx"
  Normal  Pulling                8m23s  kubelet,                pulling image "217273820646.dkr.ecr.us-east-1.amazonaws.com/8496183b-fe06-4e81-b06d-be41382ffe62/cg-1440612375/apama-correlator:10.3-latest"
  Normal  Pulled                 7m57s  kubelet,                Successfully pulled image "217273820646.dkr.ecr.us-east-1.amazonaws.com/8496183b-fe06-4e81-b06d-be41382ffe62/cg-1440612375/apama-correlator:10.3-latest"
  Normal  Created                7m56s  kubelet,                Created container
  Normal  Started                7m56s  kubelet,                Started container

By using describe pods we can see that the create pulled the image correctly and then started the container. to see the output of the correlator logs you can use the following:

kubectl logs pod/simple-sample

Finally to stop the sample and remove the deployed pod use kubectl delete and if If you used eksctl to create a temporary cluster to test on you can now delete it using:

kubectl delete -f kubernetes.yml
pod "simple-sample" deleted

eksctl delete cluster apama-eks-cluster
2018-11-29T15:37:08Z [ℹ]  using region eu-west-1
2018-11-29T15:37:09Z [ℹ]  deleting EKS cluster "apama-eks-cluster"
2018-11-29T15:37:09Z [ℹ]  will delete stack "eksctl-apama-eks-cluster-nodegroup-0"
2018-11-29T15:37:09Z [ℹ]  waiting for stack "eksctl-apama-eks-cluster-nodegroup-0" to get deleted
...

This should get you started with Apama in AWS but the power and flexibility of Amazon and Apama will allow you to take your application to new heights!