# Deploy HStream on AWS with Terraform
This document describes how to deploy HStream on AWS with Terraform.
You can download related resources from hstreamdb/terraform:
git clone git@github.com:hstreamdb/terraform.git
# Pre-Require
We assume that you have a basic understanding of terraform. Here are some resources may help:
Also, you need to have an AWS account and create your own key-pair
so that you can use it to access AWS EC2 instance later.
# Install Terraform
Refer to terraform install doc (opens new window)
# Configuration
Let's take a look at the structure of the project first.
| - file
| - clusterCfg.json.tftpl // cluster configuration file
- logdevice.conf // hstore configuration file
- prometheus-cfg // prometheus related config files
...
- main.tf // terraform main program
- start.py // a script use to start HStream cluster
- terraform.tfvars // external variables used by terraform
...
2
3
4
5
6
7
8
9
Listed above are the key components and associated configuration files to start the cluster, which you need to configure very carefully.
# Configure cluster-related information
You should modify file/clusterCfg.json.tftpl
to configure your own HStream
cluster. You can refer to Create a Configuration File (opens new window) to complete the configuration file. Notice: There are two places that differ from the part described in the link:
You don't need to fill in the
hosts
filed, this part will be done by terraform.Refer to the corresponding server nodes according to the following rules:
- Nodes can be divided into two categories:
hs-s*
:This class of nodes uses AWS storage-optimized instances configured with NVMe SSDs and is mainly used to boot store related services.hs-c*
: This class of nodes are typically used to boot compute related services.
- The
*
can only be a number
- Nodes can be divided into two categories:
As an example, in our default configuration, we start 3
hs-s*
nodes and 1hs-c*
node:nodes Amazon EC2 Instance Types instance hs-s1
i3en.2xlarge
hstore
、hserver
、zookeeper
、node-exporter
、cadvisor
hs-s2
i3en.2xlarge
hstore
、hserver
、zookeeper
、node-exporter
、cadvisor
hs-s3
i3en.2xlarge
hstore
、hserver
、zookeeper
、node-exporter
、cadvisor
hs-c1
c5.4xlarge
prometheus
、hstore-admin
、node-exporter
、cadvisor
# Configure hstore
Refer to Create a configuration file (opens new window) to modifyfile/logdevice.conf
. Also, no need to modify the zookeeper_uri
field, the program will modify it automatically.
# Configure terraform
Modify terraform.tfvars
to config terraform
region
:The instance's regionimage_id
:The system image you want to use, we choose ubuntu 20.04 heredelete_block_on_termination
:Whether to delete block devices at the same time when deleting instancescidr_block
: Specific VPCprivate_key_path
:The private key's path to access AWS instancekey_pair_name
:The key-pair's name you created beforestore_config
andcal_config
: We divide all AWS instances into two categories: one that performs primarily storage tasks, which we call "storage nodes", and another that performs primarily compute tasks, which we call "compute nodes". Each node has the following attributes:node_count
:The count of node instancesinstance_type
: Amazon EC2 Instance Typesvolume_type
: The type of storage volumevolume_size
、iops
、throughput
are attributes of storage volume
# Set Up the Cluster
Now, we can set up our cluster.
First, you should export AWS_SECRET_ACCESS_KEY
export AWS_ACCESS_KEY_ID="<Your access key id>"
export AWS_SECRET_ACCESS_KEY="<Your secret access key>"
2
Then you can use ./start.py -k <your private key's path>
to set up the cluster.