From 1585ffbef056c4df3c3abd7c04cd6e8813aa1a25 Mon Sep 17 00:00:00 2001 From: filipe oliveira Date: Sun, 19 Nov 2023 18:00:59 +0000 Subject: [PATCH] Included SPOT instance deployments for json and timeseries (#88) * Added data-tiering r6gd 2xlarge setup (~=200GB) * Included SPOT instance deployments for json and timeseries --- .../bench-client-resources.tf | 22 --- .../db-resources.tf | 10 -- .../oss-redisbloom-m5-spot-instances/tags.tf | 41 +++++ .../variables.tf | 2 +- .../oss-redisjson-m5-spot-instances/README.md | 9 + .../bench-client-resources.tf | 41 +++++ .../oss-redisjson-m5-spot-instances/common.tf | 11 ++ .../db-resources.tf | 53 ++++++ .../oss-redisjson-m5-spot-instances/output.tf | 15 ++ .../shared_resources.tf | 17 ++ .../oss-redisjson-m5-spot-instances/tags.tf | 41 +++++ .../variables.tf | 161 ++++++++++++++++++ .../README.md | 9 + .../bench-client-resources.tf | 41 +++++ .../common.tf | 11 ++ .../db-resources.tf | 53 ++++++ .../output.tf | 15 ++ .../shared_resources.tf | 17 ++ .../tags.tf | 41 +++++ .../variables.tf | 161 ++++++++++++++++++ 20 files changed, 738 insertions(+), 33 deletions(-) create mode 100644 terraform/oss-redisbloom-m5-spot-instances/tags.tf create mode 100644 terraform/oss-redisjson-m5-spot-instances/README.md create mode 100644 terraform/oss-redisjson-m5-spot-instances/bench-client-resources.tf create mode 100644 terraform/oss-redisjson-m5-spot-instances/common.tf create mode 100644 terraform/oss-redisjson-m5-spot-instances/db-resources.tf create mode 100644 terraform/oss-redisjson-m5-spot-instances/output.tf create mode 100644 terraform/oss-redisjson-m5-spot-instances/shared_resources.tf create mode 100644 terraform/oss-redisjson-m5-spot-instances/tags.tf create mode 100644 terraform/oss-redisjson-m5-spot-instances/variables.tf create mode 100644 terraform/oss-redistimeseries-m5-spot-instances/README.md create mode 100644 terraform/oss-redistimeseries-m5-spot-instances/bench-client-resources.tf create mode 100644 terraform/oss-redistimeseries-m5-spot-instances/common.tf create mode 100644 terraform/oss-redistimeseries-m5-spot-instances/db-resources.tf create mode 100644 terraform/oss-redistimeseries-m5-spot-instances/output.tf create mode 100644 terraform/oss-redistimeseries-m5-spot-instances/shared_resources.tf create mode 100644 terraform/oss-redistimeseries-m5-spot-instances/tags.tf create mode 100644 terraform/oss-redistimeseries-m5-spot-instances/variables.tf diff --git a/terraform/oss-redisbloom-m5-spot-instances/bench-client-resources.tf b/terraform/oss-redisbloom-m5-spot-instances/bench-client-resources.tf index 67868c4..b67ad88 100644 --- a/terraform/oss-redisbloom-m5-spot-instances/bench-client-resources.tf +++ b/terraform/oss-redisbloom-m5-spot-instances/bench-client-resources.tf @@ -19,28 +19,6 @@ resource "aws_spot_instance_request" "client" { delete_on_termination = true } - volume_tags = { - Name = "ebs_block_device-${var.setup_name}-CLIENT-${count.index + 1}" - setup = "${var.setup_name}" - triggering_env = "${var.triggering_env}" - github_actor = "${var.github_actor}" - github_org = "${var.github_org}" - github_repo = "${var.github_repo}" - github_sha = "${var.github_sha}" - timeout_secs = "${var.timeout_secs}" - } - - tags = { - Name = "${var.setup_name}-CLIENT-${count.index + 1}" - setup = "${var.setup_name}" - triggering_env = "${var.triggering_env}" - github_actor = "${var.github_actor}" - github_org = "${var.github_org}" - github_repo = "${var.github_repo}" - github_sha = "${var.github_sha}" - timeout_secs = "${var.timeout_secs}" - } - ################################################################################ # This will ensure we wait here until the instance is ready to receive the ssh connection ################################################################################ diff --git a/terraform/oss-redisbloom-m5-spot-instances/db-resources.tf b/terraform/oss-redisbloom-m5-spot-instances/db-resources.tf index 042164a..876ed95 100644 --- a/terraform/oss-redisbloom-m5-spot-instances/db-resources.tf +++ b/terraform/oss-redisbloom-m5-spot-instances/db-resources.tf @@ -30,16 +30,6 @@ resource "aws_spot_instance_request" "server" { timeout_secs = "${var.timeout_secs}" } - tags = { - Name = "${var.setup_name}-DB-${count.index + 1}" - setup = "${var.setup_name}" - triggering_env = "${var.triggering_env}" - github_actor = "${var.github_actor}" - github_org = "${var.github_org}" - github_repo = "${var.github_repo}" - github_sha = "${var.github_sha}" - timeout_secs = "${var.timeout_secs}" - } ################################################################################ # This will ensure we wait here until the instance is ready to receive the ssh connection diff --git a/terraform/oss-redisbloom-m5-spot-instances/tags.tf b/terraform/oss-redisbloom-m5-spot-instances/tags.tf new file mode 100644 index 0000000..a108572 --- /dev/null +++ b/terraform/oss-redisbloom-m5-spot-instances/tags.tf @@ -0,0 +1,41 @@ + + +locals { + + tags_db = { + Name = "${var.setup_name}-DB-1" + setup = "${var.setup_name}" + triggering_env = "${var.triggering_env}" + github_actor = "${var.github_actor}" + github_org = "${var.github_org}" + github_repo = "${var.github_repo}" + github_sha = "${var.github_sha}" + timeout_secs = "${var.timeout_secs}" + } + + tags_client = { + Name = "${var.setup_name}-CLIENT-1" + setup = "${var.setup_name}" + triggering_env = "${var.triggering_env}" + github_actor = "${var.github_actor}" + github_org = "${var.github_org}" + github_repo = "${var.github_repo}" + github_sha = "${var.github_sha}" + timeout_secs = "${var.timeout_secs}" + } +} + +resource "aws_ec2_tag" "server" { + resource_id = aws_spot_instance_request.server[0].spot_instance_id + for_each = local.tags_db + key = each.key + value = each.value +} + + +resource "aws_ec2_tag" "client" { + resource_id = aws_spot_instance_request.client[0].spot_instance_id + for_each = local.tags_client + key = each.key + value = each.value +} diff --git a/terraform/oss-redisbloom-m5-spot-instances/variables.tf b/terraform/oss-redisbloom-m5-spot-instances/variables.tf index 4fcf637..544cde0 100644 --- a/terraform/oss-redisbloom-m5-spot-instances/variables.tf +++ b/terraform/oss-redisbloom-m5-spot-instances/variables.tf @@ -4,7 +4,7 @@ variable "setup_name" { description = "setup name" - default = "oss-standalone-redisbloom-m5" + default = "oss-redisbloom-m5-spot-instances" } variable "github_actor" { description = "The name of the person or app that initiated the deployment." diff --git a/terraform/oss-redisjson-m5-spot-instances/README.md b/terraform/oss-redisjson-m5-spot-instances/README.md new file mode 100644 index 0000000..3acfdd1 --- /dev/null +++ b/terraform/oss-redisjson-m5-spot-instances/README.md @@ -0,0 +1,9 @@ +# oss-standalone-redisbloom-m5 + +Deploy Multi-VM benchmark scenario, including 1 client and 1 DB machine. +- Cloud provider: AWS +- OS: Ubuntu 20.04 +- Client machine: c5.4xlarge +- Benchmark machine: m5.8xlarge + +------- diff --git a/terraform/oss-redisjson-m5-spot-instances/bench-client-resources.tf b/terraform/oss-redisjson-m5-spot-instances/bench-client-resources.tf new file mode 100644 index 0000000..b67ad88 --- /dev/null +++ b/terraform/oss-redisjson-m5-spot-instances/bench-client-resources.tf @@ -0,0 +1,41 @@ + +resource "aws_spot_instance_request" "client" { + wait_for_fulfillment = true + spot_type = "one-time" + count = var.client_instance_count + ami = var.instance_ami + instance_type = var.client_instance_type + subnet_id = data.terraform_remote_state.shared_resources.outputs.subnet_public_id + vpc_security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"] + key_name = var.key_name + associate_public_ip_address = "true" + placement_group = data.terraform_remote_state.shared_resources.outputs.perf_cto_pg_name + availability_zone = "us-east-2a" + + root_block_device { + volume_size = var.instance_volume_size + volume_type = var.instance_volume_type + encrypted = var.instance_volume_encrypted + delete_on_termination = true + } + + ################################################################################ + # This will ensure we wait here until the instance is ready to receive the ssh connection + ################################################################################ + provisioner "remote-exec" { + script = "./../scripts/wait_for_instance.sh" + connection { + host = self.public_ip # The `self` variable is like `this` in many programming languages + type = "ssh" # in this case, `self` is the resource (the server). + user = var.ssh_user + private_key = file(var.private_key) + #need to increase timeout to larger then 5m for metal instances + timeout = "15m" + agent = "false" + } + } + + ################################################################################ + # Deployment related + ################################################################################ +} diff --git a/terraform/oss-redisjson-m5-spot-instances/common.tf b/terraform/oss-redisjson-m5-spot-instances/common.tf new file mode 100644 index 0000000..10568c1 --- /dev/null +++ b/terraform/oss-redisjson-m5-spot-instances/common.tf @@ -0,0 +1,11 @@ + +################################################################################ +# This is the bucket holding this specific setup tfstate +################################################################################ +terraform { + backend "s3" { + bucket = "performance-cto-group" + region = "us-east-1" + } +} + diff --git a/terraform/oss-redisjson-m5-spot-instances/db-resources.tf b/terraform/oss-redisjson-m5-spot-instances/db-resources.tf new file mode 100644 index 0000000..876ed95 --- /dev/null +++ b/terraform/oss-redisjson-m5-spot-instances/db-resources.tf @@ -0,0 +1,53 @@ + +resource "aws_spot_instance_request" "server" { + wait_for_fulfillment = true + spot_type = "one-time" + count = var.server_instance_count + ami = var.instance_ami + instance_type = var.server_instance_type + subnet_id = data.terraform_remote_state.shared_resources.outputs.subnet_public_id + vpc_security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"] + key_name = var.key_name + associate_public_ip_address = "true" + placement_group = data.terraform_remote_state.shared_resources.outputs.perf_cto_pg_name + availability_zone = "us-east-2a" + + root_block_device { + volume_size = var.instance_volume_size + volume_type = var.instance_volume_type + encrypted = var.instance_volume_encrypted + delete_on_termination = true + } + + volume_tags = { + Name = "ebs_block_device-${var.setup_name}-DB-${count.index + 1}" + setup = "${var.setup_name}" + triggering_env = "${var.triggering_env}" + github_actor = "${var.github_actor}" + github_org = "${var.github_org}" + github_repo = "${var.github_repo}" + github_sha = "${var.github_sha}" + timeout_secs = "${var.timeout_secs}" + } + + + ################################################################################ + # This will ensure we wait here until the instance is ready to receive the ssh connection + ################################################################################ + provisioner "remote-exec" { + script = "./../scripts/wait_for_instance.sh" + connection { + host = self.public_ip # The `self` variable is like `this` in many programming languages + type = "ssh" # in this case, `self` is the resource (the server). + user = var.ssh_user + private_key = file(var.private_key) + #need to increase timeout to larger then 5m for metal instances + timeout = "15m" + agent = "false" + } + } + + ################################################################################ + # Deployment related + ################################################################################ +} diff --git a/terraform/oss-redisjson-m5-spot-instances/output.tf b/terraform/oss-redisjson-m5-spot-instances/output.tf new file mode 100644 index 0000000..88b5744 --- /dev/null +++ b/terraform/oss-redisjson-m5-spot-instances/output.tf @@ -0,0 +1,15 @@ +output "server_public_ip" { + value = ["${aws_spot_instance_request.server[0].public_ip}"] +} + +output "server_private_ip" { + value = ["${aws_spot_instance_request.server[0].private_ip}"] +} + +output "client_public_ip" { + value = ["${aws_spot_instance_request.client[0].public_ip}"] +} + +output "client_private_ip" { + value = ["${aws_spot_instance_request.client[0].private_ip}"] +} diff --git a/terraform/oss-redisjson-m5-spot-instances/shared_resources.tf b/terraform/oss-redisjson-m5-spot-instances/shared_resources.tf new file mode 100644 index 0000000..824e6b9 --- /dev/null +++ b/terraform/oss-redisjson-m5-spot-instances/shared_resources.tf @@ -0,0 +1,17 @@ +# provider +provider "aws" { + region = var.region +} + +################################################################################ +# This is the shared resources bucket key -- you will need it across environments like security rules,etc... +# !! do not change this !! +################################################################################ +data "terraform_remote_state" "shared_resources" { + backend = "s3" + config = { + bucket = "performance-cto-group" + key = "benchmarks/infrastructure/shared_resources.tfstate" + region = "us-east-1" + } +} diff --git a/terraform/oss-redisjson-m5-spot-instances/tags.tf b/terraform/oss-redisjson-m5-spot-instances/tags.tf new file mode 100644 index 0000000..a108572 --- /dev/null +++ b/terraform/oss-redisjson-m5-spot-instances/tags.tf @@ -0,0 +1,41 @@ + + +locals { + + tags_db = { + Name = "${var.setup_name}-DB-1" + setup = "${var.setup_name}" + triggering_env = "${var.triggering_env}" + github_actor = "${var.github_actor}" + github_org = "${var.github_org}" + github_repo = "${var.github_repo}" + github_sha = "${var.github_sha}" + timeout_secs = "${var.timeout_secs}" + } + + tags_client = { + Name = "${var.setup_name}-CLIENT-1" + setup = "${var.setup_name}" + triggering_env = "${var.triggering_env}" + github_actor = "${var.github_actor}" + github_org = "${var.github_org}" + github_repo = "${var.github_repo}" + github_sha = "${var.github_sha}" + timeout_secs = "${var.timeout_secs}" + } +} + +resource "aws_ec2_tag" "server" { + resource_id = aws_spot_instance_request.server[0].spot_instance_id + for_each = local.tags_db + key = each.key + value = each.value +} + + +resource "aws_ec2_tag" "client" { + resource_id = aws_spot_instance_request.client[0].spot_instance_id + for_each = local.tags_client + key = each.key + value = each.value +} diff --git a/terraform/oss-redisjson-m5-spot-instances/variables.tf b/terraform/oss-redisjson-m5-spot-instances/variables.tf new file mode 100644 index 0000000..88d2113 --- /dev/null +++ b/terraform/oss-redisjson-m5-spot-instances/variables.tf @@ -0,0 +1,161 @@ +################################################################################ +# Variables used for deployment tag +################################################################################ + +variable "setup_name" { + description = "setup name" + default = "oss-redisjson-m5-spot-instances" +} +variable "github_actor" { + description = "The name of the person or app that initiated the deployment." + default = "N/A" +} + +variable "github_repo" { + description = " The owner and repository name. For example, testing-infrastructure." + default = "N/A" +} + +variable "triggering_env" { + description = " The triggering environment. For example circleci." + default = "N/A" +} + +variable "github_org" { + description = " The owner name. For example, RedisModules." + default = "N/A" +} + +variable "github_sha" { + description = "The commit SHA that triggered the deployment." + default = "N/A" +} + +variable "timeout_secs" { + description = "The maximum time to wait prior destroying the VM via the watchdog." + default = "3600" +} + + + +################################################################################ +# Access keys +################################################################################ +variable "private_key" { + description = "private key" + default = "/tmp/benchmarks.redislabs.pem" +} + +variable "public_key" { + description = "public key" + default = "~/.ssh/perf-ci.pub" +} + +variable "key_name" { + description = "key name" + default = "perf-ci" +} + +variable "region" { + default = "us-east-2" +} + +# (Ubuntu 20.04) +# ubuntu-bionic-20.04-amd64-server +variable "instance_ami" { + description = "AMI for aws EC2 instance - us-east-2 Ubuntu 20.04 - perf-cto-base-image-ubuntu20.04-redis-7.1.241" + default = "ami-078c8a93768628849" +} + +variable "instance_device_name" { + description = "EC2 instance device name" + default = "/dev/sda1" +} + +variable "redis_module" { + description = "redis_module" + default = "N/A" +} + +variable "instance_volume_size" { + description = "EC2 instance volume_size" + default = "256" +} + +variable "instance_volume_type" { + description = "EC2 instance volume_type" + default = "gp3" +} + +variable "instance_volume_iops" { + description = "EC2 instance volume_iops" + default = "100" +} + +variable "instance_volume_encrypted" { + description = "EC2 instance instance_volume_encrypted" + default = "false" +} + +variable "instance_root_block_device_encrypted" { + description = "EC2 instance instance_root_block_device_encrypted" + default = "false" +} + +variable "instance_cpu_threads_per_core" { + description = "CPU threads per core for aws EC2 instance" + default = 1 +} + +variable "instance_cpu_threads_per_core_hyperthreading" { + description = "CPU threads per core when hyperthreading is enabled for aws EC2 instance" + default = 2 +} + +variable "instance_network_interface_plus_count" { + description = "number of additional network interfaces to add to aws EC2 instance" + default = 0 +} + +variable "os" { + description = "os" + default = "ubuntu18.04" +} + +variable "ssh_user" { + description = "ssh_user" + default = "ubuntu" +} + +################################################################################ +# Specific DB machine variables +################################################################################ +# m5.8xlarge 32 VCPUs 128 GB MEM +variable "server_instance_type" { + description = "type for aws EC2 instance" + default = "m5.8xlarge" +} + +variable "server_instance_count" { + default = "1" +} + +variable "server_instance_cpu_core_count" { + description = "CPU core count for aws EC2 instance" + default = 16 +} + + +################################################################################ +# Specific Client machine variables +################################################################################ +# c5.4xlarge 16 VCPUs + +variable "client_instance_type" { + description = "type for aws EC2 instance" + default = "c5.4xlarge" +} + +variable "client_instance_count" { + default = "1" +} \ No newline at end of file diff --git a/terraform/oss-redistimeseries-m5-spot-instances/README.md b/terraform/oss-redistimeseries-m5-spot-instances/README.md new file mode 100644 index 0000000..3acfdd1 --- /dev/null +++ b/terraform/oss-redistimeseries-m5-spot-instances/README.md @@ -0,0 +1,9 @@ +# oss-standalone-redisbloom-m5 + +Deploy Multi-VM benchmark scenario, including 1 client and 1 DB machine. +- Cloud provider: AWS +- OS: Ubuntu 20.04 +- Client machine: c5.4xlarge +- Benchmark machine: m5.8xlarge + +------- diff --git a/terraform/oss-redistimeseries-m5-spot-instances/bench-client-resources.tf b/terraform/oss-redistimeseries-m5-spot-instances/bench-client-resources.tf new file mode 100644 index 0000000..b67ad88 --- /dev/null +++ b/terraform/oss-redistimeseries-m5-spot-instances/bench-client-resources.tf @@ -0,0 +1,41 @@ + +resource "aws_spot_instance_request" "client" { + wait_for_fulfillment = true + spot_type = "one-time" + count = var.client_instance_count + ami = var.instance_ami + instance_type = var.client_instance_type + subnet_id = data.terraform_remote_state.shared_resources.outputs.subnet_public_id + vpc_security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"] + key_name = var.key_name + associate_public_ip_address = "true" + placement_group = data.terraform_remote_state.shared_resources.outputs.perf_cto_pg_name + availability_zone = "us-east-2a" + + root_block_device { + volume_size = var.instance_volume_size + volume_type = var.instance_volume_type + encrypted = var.instance_volume_encrypted + delete_on_termination = true + } + + ################################################################################ + # This will ensure we wait here until the instance is ready to receive the ssh connection + ################################################################################ + provisioner "remote-exec" { + script = "./../scripts/wait_for_instance.sh" + connection { + host = self.public_ip # The `self` variable is like `this` in many programming languages + type = "ssh" # in this case, `self` is the resource (the server). + user = var.ssh_user + private_key = file(var.private_key) + #need to increase timeout to larger then 5m for metal instances + timeout = "15m" + agent = "false" + } + } + + ################################################################################ + # Deployment related + ################################################################################ +} diff --git a/terraform/oss-redistimeseries-m5-spot-instances/common.tf b/terraform/oss-redistimeseries-m5-spot-instances/common.tf new file mode 100644 index 0000000..10568c1 --- /dev/null +++ b/terraform/oss-redistimeseries-m5-spot-instances/common.tf @@ -0,0 +1,11 @@ + +################################################################################ +# This is the bucket holding this specific setup tfstate +################################################################################ +terraform { + backend "s3" { + bucket = "performance-cto-group" + region = "us-east-1" + } +} + diff --git a/terraform/oss-redistimeseries-m5-spot-instances/db-resources.tf b/terraform/oss-redistimeseries-m5-spot-instances/db-resources.tf new file mode 100644 index 0000000..876ed95 --- /dev/null +++ b/terraform/oss-redistimeseries-m5-spot-instances/db-resources.tf @@ -0,0 +1,53 @@ + +resource "aws_spot_instance_request" "server" { + wait_for_fulfillment = true + spot_type = "one-time" + count = var.server_instance_count + ami = var.instance_ami + instance_type = var.server_instance_type + subnet_id = data.terraform_remote_state.shared_resources.outputs.subnet_public_id + vpc_security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"] + key_name = var.key_name + associate_public_ip_address = "true" + placement_group = data.terraform_remote_state.shared_resources.outputs.perf_cto_pg_name + availability_zone = "us-east-2a" + + root_block_device { + volume_size = var.instance_volume_size + volume_type = var.instance_volume_type + encrypted = var.instance_volume_encrypted + delete_on_termination = true + } + + volume_tags = { + Name = "ebs_block_device-${var.setup_name}-DB-${count.index + 1}" + setup = "${var.setup_name}" + triggering_env = "${var.triggering_env}" + github_actor = "${var.github_actor}" + github_org = "${var.github_org}" + github_repo = "${var.github_repo}" + github_sha = "${var.github_sha}" + timeout_secs = "${var.timeout_secs}" + } + + + ################################################################################ + # This will ensure we wait here until the instance is ready to receive the ssh connection + ################################################################################ + provisioner "remote-exec" { + script = "./../scripts/wait_for_instance.sh" + connection { + host = self.public_ip # The `self` variable is like `this` in many programming languages + type = "ssh" # in this case, `self` is the resource (the server). + user = var.ssh_user + private_key = file(var.private_key) + #need to increase timeout to larger then 5m for metal instances + timeout = "15m" + agent = "false" + } + } + + ################################################################################ + # Deployment related + ################################################################################ +} diff --git a/terraform/oss-redistimeseries-m5-spot-instances/output.tf b/terraform/oss-redistimeseries-m5-spot-instances/output.tf new file mode 100644 index 0000000..88b5744 --- /dev/null +++ b/terraform/oss-redistimeseries-m5-spot-instances/output.tf @@ -0,0 +1,15 @@ +output "server_public_ip" { + value = ["${aws_spot_instance_request.server[0].public_ip}"] +} + +output "server_private_ip" { + value = ["${aws_spot_instance_request.server[0].private_ip}"] +} + +output "client_public_ip" { + value = ["${aws_spot_instance_request.client[0].public_ip}"] +} + +output "client_private_ip" { + value = ["${aws_spot_instance_request.client[0].private_ip}"] +} diff --git a/terraform/oss-redistimeseries-m5-spot-instances/shared_resources.tf b/terraform/oss-redistimeseries-m5-spot-instances/shared_resources.tf new file mode 100644 index 0000000..824e6b9 --- /dev/null +++ b/terraform/oss-redistimeseries-m5-spot-instances/shared_resources.tf @@ -0,0 +1,17 @@ +# provider +provider "aws" { + region = var.region +} + +################################################################################ +# This is the shared resources bucket key -- you will need it across environments like security rules,etc... +# !! do not change this !! +################################################################################ +data "terraform_remote_state" "shared_resources" { + backend = "s3" + config = { + bucket = "performance-cto-group" + key = "benchmarks/infrastructure/shared_resources.tfstate" + region = "us-east-1" + } +} diff --git a/terraform/oss-redistimeseries-m5-spot-instances/tags.tf b/terraform/oss-redistimeseries-m5-spot-instances/tags.tf new file mode 100644 index 0000000..a108572 --- /dev/null +++ b/terraform/oss-redistimeseries-m5-spot-instances/tags.tf @@ -0,0 +1,41 @@ + + +locals { + + tags_db = { + Name = "${var.setup_name}-DB-1" + setup = "${var.setup_name}" + triggering_env = "${var.triggering_env}" + github_actor = "${var.github_actor}" + github_org = "${var.github_org}" + github_repo = "${var.github_repo}" + github_sha = "${var.github_sha}" + timeout_secs = "${var.timeout_secs}" + } + + tags_client = { + Name = "${var.setup_name}-CLIENT-1" + setup = "${var.setup_name}" + triggering_env = "${var.triggering_env}" + github_actor = "${var.github_actor}" + github_org = "${var.github_org}" + github_repo = "${var.github_repo}" + github_sha = "${var.github_sha}" + timeout_secs = "${var.timeout_secs}" + } +} + +resource "aws_ec2_tag" "server" { + resource_id = aws_spot_instance_request.server[0].spot_instance_id + for_each = local.tags_db + key = each.key + value = each.value +} + + +resource "aws_ec2_tag" "client" { + resource_id = aws_spot_instance_request.client[0].spot_instance_id + for_each = local.tags_client + key = each.key + value = each.value +} diff --git a/terraform/oss-redistimeseries-m5-spot-instances/variables.tf b/terraform/oss-redistimeseries-m5-spot-instances/variables.tf new file mode 100644 index 0000000..37db6d8 --- /dev/null +++ b/terraform/oss-redistimeseries-m5-spot-instances/variables.tf @@ -0,0 +1,161 @@ +################################################################################ +# Variables used for deployment tag +################################################################################ + +variable "setup_name" { + description = "setup name" + default = "oss-redistimeseries-m5-spot-instances" +} +variable "github_actor" { + description = "The name of the person or app that initiated the deployment." + default = "N/A" +} + +variable "github_repo" { + description = " The owner and repository name. For example, testing-infrastructure." + default = "N/A" +} + +variable "triggering_env" { + description = " The triggering environment. For example circleci." + default = "N/A" +} + +variable "github_org" { + description = " The owner name. For example, RedisModules." + default = "N/A" +} + +variable "github_sha" { + description = "The commit SHA that triggered the deployment." + default = "N/A" +} + +variable "timeout_secs" { + description = "The maximum time to wait prior destroying the VM via the watchdog." + default = "3600" +} + + + +################################################################################ +# Access keys +################################################################################ +variable "private_key" { + description = "private key" + default = "/tmp/benchmarks.redislabs.pem" +} + +variable "public_key" { + description = "public key" + default = "~/.ssh/perf-ci.pub" +} + +variable "key_name" { + description = "key name" + default = "perf-ci" +} + +variable "region" { + default = "us-east-2" +} + +# (Ubuntu 20.04) +# ubuntu-bionic-20.04-amd64-server +variable "instance_ami" { + description = "AMI for aws EC2 instance - us-east-2 Ubuntu 20.04 - perf-cto-base-image-ubuntu20.04-redis-7.1.241" + default = "ami-078c8a93768628849" +} + +variable "instance_device_name" { + description = "EC2 instance device name" + default = "/dev/sda1" +} + +variable "redis_module" { + description = "redis_module" + default = "N/A" +} + +variable "instance_volume_size" { + description = "EC2 instance volume_size" + default = "256" +} + +variable "instance_volume_type" { + description = "EC2 instance volume_type" + default = "gp3" +} + +variable "instance_volume_iops" { + description = "EC2 instance volume_iops" + default = "100" +} + +variable "instance_volume_encrypted" { + description = "EC2 instance instance_volume_encrypted" + default = "false" +} + +variable "instance_root_block_device_encrypted" { + description = "EC2 instance instance_root_block_device_encrypted" + default = "false" +} + +variable "instance_cpu_threads_per_core" { + description = "CPU threads per core for aws EC2 instance" + default = 1 +} + +variable "instance_cpu_threads_per_core_hyperthreading" { + description = "CPU threads per core when hyperthreading is enabled for aws EC2 instance" + default = 2 +} + +variable "instance_network_interface_plus_count" { + description = "number of additional network interfaces to add to aws EC2 instance" + default = 0 +} + +variable "os" { + description = "os" + default = "ubuntu18.04" +} + +variable "ssh_user" { + description = "ssh_user" + default = "ubuntu" +} + +################################################################################ +# Specific DB machine variables +################################################################################ +# m5.8xlarge 32 VCPUs 128 GB MEM +variable "server_instance_type" { + description = "type for aws EC2 instance" + default = "m5.8xlarge" +} + +variable "server_instance_count" { + default = "1" +} + +variable "server_instance_cpu_core_count" { + description = "CPU core count for aws EC2 instance" + default = 16 +} + + +################################################################################ +# Specific Client machine variables +################################################################################ +# c5.4xlarge 16 VCPUs + +variable "client_instance_type" { + description = "type for aws EC2 instance" + default = "c5.4xlarge" +} + +variable "client_instance_count" { + default = "1" +} \ No newline at end of file