There are three different ways to setup a working Kill Bill system on AWS, using software preconfigured by Kill Bill. Two options are based on a single Amazon Machine Image (AMI) containing the complete Kill Bill stack, that is both the Kill Bill server and the administrative UI (KAUI). These options are single-tier and multi-tier. The single-tier option is designed to deploy a limited version of Kill Bill quickly for trial and experimentation. For production deployments, we offer the multi-tier option. A third alternative available for deploying a production system is CloudFormation templates. The multi-tier option requires more setup than CloudFormation, but provides more control over the deployment.
This document describes the multi-tier option. This configuration uses two or more EC2 instances and a separate database provided by the AWS Relational Database Service (RDS). It also includes an AWS Elastic Load Balancer (ELB) to correctly spread the traffic among the various nodes, and to route traffic to either the Kill Bill Server or KAUI based on the incoming port.
The diagram below shows the principal components of the multi-tier system: The ELB, the RDS, and two or more EC2 instances. Each EC2 is an instance of Ubuntu Linux, running both Kill Bill and KAUI within a
tomcat server. Clients interact only with the ELB, which routes requests to the rest of the system.
Login to AWS
To begin, log in to Amazon Web Services at https://aws.amazon.com. If you are new to AWS, you will be asked to create an account and provide billing information. You will need to sign in as a Root User. This should take you to the AWS Management Console, which provides links to all available services.
Check the upper right corner of your screen to be sure you are in the appropriate region. All resources you create will be placed in this region, and may not be accessible from other regions.
In addition, AWS places all resources within a Virtual Private Cloud (VPC). A default VPC will be created and used automatically in the following steps. However, if you have access to other VPCs, you will need to ensure that all Kill Bill resources are deployed in the same one.
Setup the Database Manager
Once you are logged in, the first step is to setup the RDS instance. This process begins with the RDS dashboard, which should be available from the Services menu. When the dashboard appears, select Databases from the left menu, and click the red button at the top right that reads Create Database:
1. Set the Configuration
You will be taken to the Create Database page. The first choice you will have is between Standard Create, which allows you to set a full range of configuration parameters, or Easy Create, which sets most of these parameters to defaults. We recommend Easy Create in most cases.
The next section offers you a choice of several database types. Kill Bill can work with any database type that is
postgres compatible. For robust production use, Amazon Aurora is probably a good choice. Here we will illustrate the simpler steps setting up a MariaDB database.
The next choice determines the instance size. We suggest the Production option as this will provide the most robust configuration.
The last section asks you to:
Specify a name for your database
Give a username for the administrative account (we suggest that you do not use the default name)
Provide a password for the administrative acount (we suggest you let AWS generate one for you)
2. Create the DBM
When the password is setup and confirmed, click Create Database in the lower right corner. You will return to the main Databases screen, which should now look like this:
This display shows that your database is starting. After a few minutes, the status will change to Available (You may need to reload the page to see this). At this time you can click on the database name to get more information, including the full name of the instance.
On the page that appears you should see a panel named Connectivity and Security. The left side of this panel shows the full name of the endpoint, which you will need shortly, and the port number, which is normally 3306.
3. Setup the Security Rules
Lastly, on the Connectivity and Security panel, locate and click on the link for the default VPC security group. You will need to add an inbound security rule, because the database by default does not allow external access. In the panel for this group, click on Inbound Rules and select Edit Inbound Rules. Next click on Add rule. In the Type column select
MYSQL/Aurora. The port will be set to 3306 automatically. In the Source column, click on the search icon and select
0.0.0.0/0. Finally, click on Save Rules in the bottom right. Your database is ready to go.
Edit the Configuration Script
To set up the EC2 instances you will need to provide them with information needed to connect to the databases. We provide a brief configuration script to simplify this process. The template for this script is as follows:
#!/bin/bash DB_PROPS="/var/tmp/db.props.$$" KB_PROPS="/var/tmp/kb.props.$$" cat <<_EOF > $DB_PROPS # # EDIT THE FOLLOWING DB PROPERTIES AS NEEDED: # DB_SERVER=DB-INSTANCE-NAME:3306 DB_USER=ADMIN-NAME DB_PASSWORD=PASSWORD KILLBILL_DB_NAME=killbill KAUI_DB_NAME=kaui _EOF cat <<_EOF > $KB_PROPS # # EDIT THE FOLLOWING KB PROPERTIES AS NEEDED: # org.killbill.dontexist=foo _EOF su -l -c "cd /var/lib/tomcat/bin && /var/lib/tomcat/bin/updateProperties.sh $DB_PROPS $KB_PROPS" tomcat
First, you need to edit the database properties. DB_SERVER should be set to the full name of the DB instance, as given in the Connectivity and Security panel (see above). The port number 3306 is required. DB_USER and DB_PASSWORD should be set to the administrator credentials you have chosen for the RDS instance.
Second, you may optionally edit any Kill Bill properties that you need to change from the standard defaults. For more information see the Kill Bill Configuration Guide.
Save this script in a text file. You will need it in the next step.
Launch EC2 Instances
The next step is to launch the number of EC2 instances you want, all based on the Kill Bill single AMI.
1. Subscribe to the AMI
To start the installation process, point your browser to the Kill Bill AMI at AWS Marketplace .
You should see the following image at the top of your screen:
Click Continue to Subscribe. The next page will give the AWS Terms and Conditions:
Accept the terms if asked. You will then see a new message confirming that you have subscribed. Next, click Continue to Configuration.
2. Configure the Instances
The next page will give several configuration options:
Be sure to select the region you plan to operate in. In most cases you should accept the other defaults. Then click Continue to Launch.
The next page will give you several options for the launch method. We recommend that you choose Launch through EC2.
All other options will disappear. Click Launch.
The next page is headed Launch an Instance. There ar several things you will need to do here.
First, at the top right, select the number of instances you will use. We recommend 2. You can add more later.
Next, scroll down to the middle of this page, to the box titled Key Pair (login) Here you are asked to choose or create a key pair.