-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added usage instructions for the yugabyte terraform AWS module.
- Loading branch information
1 parent
7cc65ad
commit 7e6d0ff
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,78 @@ | ||
# terraform-aws-yugabyte | ||
A Terraform module to deploy and run YugaByte on AWS. | ||
|
||
## Config | ||
|
||
``` | ||
module "yugabyte-db-cluster" { | ||
source = "./terraform-aws-yugabyte" | ||
# The name of the cluster to be created. | ||
cluster_name = "tf-test" | ||
# A custom security group to be passed so that we can connect to the nodes. | ||
custom_security_group_id="SECURITY_GROUP_HERE" | ||
# AWS key pair. | ||
ssh_keypair = "SSH_KEYPAIR_HERE" | ||
ssh_key_path = "SSH_KEY_PATH_HERE" | ||
# The vpc and subnet ids where the nodes should be spawned. | ||
vpc_id = "VPC_ID_HERE" | ||
subnet_ids = ["SUBNET_ID_HERE"] | ||
# Replication factor. | ||
replication_factor = "3" | ||
# The number of nodes in the cluster, this cannot be lower than the replication factor. | ||
num_instances = "3" | ||
} | ||
``` | ||
|
||
**NOTE:** If you do not have a custom security group, you would need to remove the `${var.custom_security_group_id}` variable in `main.tf`, so that the `aws_instance` looks as follows: | ||
|
||
``` | ||
resource "aws_instance" "yugabyte_nodes" { | ||
count = "${var.num_instances}" | ||
... | ||
vpc_security_group_ids = [ | ||
"${aws_security_group.yugabyte.id}", | ||
"${aws_security_group.yugabyte_intra.id}", | ||
"${var.custom_security_group_id}" | ||
] | ||
``` | ||
|
||
## Usage | ||
|
||
Init terraform first if you have not already done so. | ||
|
||
``` | ||
$ terraform init | ||
``` | ||
|
||
Now run the following to create the instances and bring up the cluster. | ||
|
||
``` | ||
$ terraform apply | ||
``` | ||
|
||
Once the cluster is created, you can go to the URL `http://<node ip or dns name>:7000` to view the UI. You can find the node's ip or dns by running the following: | ||
|
||
``` | ||
terraform state show aws_instance.yugabyte_nodes[0] | ||
``` | ||
|
||
You can access the cluster UI by going to any of the following URLs. | ||
|
||
You can check the state of the nodes at any point by running the following command. | ||
|
||
``` | ||
$ terraform show | ||
``` | ||
|
||
To destroy what we just created, you can run the following command. | ||
|
||
``` | ||
$ terraform destroy | ||
``` |