diff options
-rw-r--r-- | fdio.infra.ansible/roles/aws/tasks/main.yaml | 7 | ||||
-rw-r--r-- | fdio.infra.terraform/2n_aws_c5n/deploy/main.tf | 50 | ||||
-rw-r--r-- | fdio.infra.terraform/2n_aws_c5n/deploy/variables.tf | 6 | ||||
-rw-r--r-- | fdio.infra.terraform/3n_aws_c5n/deploy/main.tf | 46 | ||||
-rw-r--r-- | fdio.infra.terraform/3n_aws_c5n/deploy/variables.tf | 6 | ||||
-rw-r--r-- | fdio.infra.terraform/3n_aws_c5n/variables.tf | 6 |
6 files changed, 74 insertions, 47 deletions
diff --git a/fdio.infra.ansible/roles/aws/tasks/main.yaml b/fdio.infra.ansible/roles/aws/tasks/main.yaml index 2d209762c3..2b8c22ccce 100644 --- a/fdio.infra.ansible/roles/aws/tasks/main.yaml +++ b/fdio.infra.ansible/roles/aws/tasks/main.yaml @@ -82,7 +82,7 @@ tags: - aws-reload-systemd-modules -- name: Performance Tuning - Adjust nr_hugepages +- name: Adjust nr_hugepages sysctl: name: "vm.nr_hugepages" value: "8192" @@ -91,3 +91,8 @@ reload: "yes" tags: - aws-set-hugepages + +- name: Shutdown host with delay + command: "/sbin/shutdown -P +720" + tags: + - aws-set-self-terminate diff --git a/fdio.infra.terraform/2n_aws_c5n/deploy/main.tf b/fdio.infra.terraform/2n_aws_c5n/deploy/main.tf index 95464fa177..8ab8311220 100644 --- a/fdio.infra.terraform/2n_aws_c5n/deploy/main.tf +++ b/fdio.infra.terraform/2n_aws_c5n/deploy/main.tf @@ -219,18 +219,19 @@ data "aws_network_interface" "tg_if2" { # Instances resource "aws_instance" "tg" { - depends_on = [aws_vpc.CSITVPC, aws_placement_group.CSITPG] - ami = var.ami_image - availability_zone = var.avail_zone - instance_type = var.instance_type - key_name = aws_key_pair.CSITKP.key_name - associate_public_ip_address = true - subnet_id = aws_subnet.mgmt.id - private_ip = var.tg_mgmt_ip - vpc_security_group_ids = [aws_security_group.CSITSG.id] - placement_group = aws_placement_group.CSITPG.id - source_dest_check = false - # host_id = "1" + depends_on = [aws_vpc.CSITVPC, aws_placement_group.CSITPG] + ami = var.ami_image + availability_zone = var.avail_zone + instance_initiated_shutdown_behavior = var.instance_initiated_shutdown_behavior + instance_type = var.instance_type + key_name = aws_key_pair.CSITKP.key_name + associate_public_ip_address = true + subnet_id = aws_subnet.mgmt.id + private_ip = var.tg_mgmt_ip + vpc_security_group_ids = [aws_security_group.CSITSG.id] + placement_group = aws_placement_group.CSITPG.id + source_dest_check = false + # host_id = "1" root_block_device { volume_size = 50 @@ -243,18 +244,19 @@ resource "aws_instance" "tg" { } resource "aws_instance" "dut1" { - depends_on = [aws_vpc.CSITVPC, aws_placement_group.CSITPG, aws_instance.tg] - ami = var.ami_image - availability_zone = var.avail_zone - instance_type = var.instance_type - key_name = aws_key_pair.CSITKP.key_name - associate_public_ip_address = true - subnet_id = aws_subnet.mgmt.id - private_ip = var.dut1_mgmt_ip - vpc_security_group_ids = [aws_security_group.CSITSG.id] - placement_group = aws_placement_group.CSITPG.id - source_dest_check = false - # host_id = "2" + depends_on = [aws_vpc.CSITVPC, aws_placement_group.CSITPG, aws_instance.tg] + ami = var.ami_image + availability_zone = var.avail_zone + instance_initiated_shutdown_behavior = var.instance_initiated_shutdown_behavior + instance_type = var.instance_type + key_name = aws_key_pair.CSITKP.key_name + associate_public_ip_address = true + subnet_id = aws_subnet.mgmt.id + private_ip = var.dut1_mgmt_ip + vpc_security_group_ids = [aws_security_group.CSITSG.id] + placement_group = aws_placement_group.CSITPG.id + source_dest_check = false + # host_id = "2" root_block_device { volume_size = 50 diff --git a/fdio.infra.terraform/2n_aws_c5n/deploy/variables.tf b/fdio.infra.terraform/2n_aws_c5n/deploy/variables.tf index 429c5040de..9fa5a4da9e 100644 --- a/fdio.infra.terraform/2n_aws_c5n/deploy/variables.tf +++ b/fdio.infra.terraform/2n_aws_c5n/deploy/variables.tf @@ -17,6 +17,12 @@ variable "testbed_name" { type = string } +variable "instance_initiated_shutdown_behavior" { + description = "Shutdown behavior for the instance" + type = string + default = "terminate" +} + variable "instance_type" { description = "AWS instance type" type = string diff --git a/fdio.infra.terraform/3n_aws_c5n/deploy/main.tf b/fdio.infra.terraform/3n_aws_c5n/deploy/main.tf index 3ca8758678..769aa59f1a 100644 --- a/fdio.infra.terraform/3n_aws_c5n/deploy/main.tf +++ b/fdio.infra.terraform/3n_aws_c5n/deploy/main.tf @@ -263,17 +263,18 @@ data "aws_network_interface" "tg_if2" { # Instances resource "aws_instance" "tg" { - ami = var.ami_image - availability_zone = var.avail_zone - instance_type = var.instance_type - key_name = aws_key_pair.CSITKP.key_name - associate_public_ip_address = true - subnet_id = aws_subnet.mgmt.id - private_ip = var.tg_mgmt_ip - vpc_security_group_ids = [aws_security_group.CSITSG.id] - placement_group = aws_placement_group.CSITPG.id - source_dest_check = false - # host_id = "1" + ami = var.ami_image + availability_zone = var.avail_zone + instance_initiated_shutdown_behavior = var.instance_initiated_shutdown_behavior + instance_type = var.instance_type + key_name = aws_key_pair.CSITKP.key_name + associate_public_ip_address = true + subnet_id = aws_subnet.mgmt.id + private_ip = var.tg_mgmt_ip + vpc_security_group_ids = [aws_security_group.CSITSG.id] + placement_group = aws_placement_group.CSITPG.id + source_dest_check = false + # host_id = "1" depends_on = [ aws_vpc.CSITVPC, @@ -291,17 +292,18 @@ resource "aws_instance" "tg" { } resource "aws_instance" "dut1" { - ami = var.ami_image - availability_zone = var.avail_zone - instance_type = var.instance_type - key_name = aws_key_pair.CSITKP.key_name - associate_public_ip_address = true - subnet_id = aws_subnet.mgmt.id - private_ip = var.dut1_mgmt_ip - vpc_security_group_ids = [aws_security_group.CSITSG.id] - placement_group = aws_placement_group.CSITPG.id - source_dest_check = false - # host_id = "2" + ami = var.ami_image + availability_zone = var.avail_zone + instance_initiated_shutdown_behavior = var.instance_initiated_shutdown_behavior + instance_type = var.instance_type + key_name = aws_key_pair.CSITKP.key_name + associate_public_ip_address = true + subnet_id = aws_subnet.mgmt.id + private_ip = var.dut1_mgmt_ip + vpc_security_group_ids = [aws_security_group.CSITSG.id] + placement_group = aws_placement_group.CSITPG.id + source_dest_check = false + # host_id = "2" depends_on = [ aws_vpc.CSITVPC, diff --git a/fdio.infra.terraform/3n_aws_c5n/deploy/variables.tf b/fdio.infra.terraform/3n_aws_c5n/deploy/variables.tf index 97e986bb2f..f7f3e6189c 100644 --- a/fdio.infra.terraform/3n_aws_c5n/deploy/variables.tf +++ b/fdio.infra.terraform/3n_aws_c5n/deploy/variables.tf @@ -17,6 +17,12 @@ variable "testbed_name" { type = string } +variable "instance_initiated_shutdown_behavior" { + description = "Shutdown behavior for the instance" + type = string + default = "terminate" +} + variable "instance_type" { description = "AWS instance type" type = string diff --git a/fdio.infra.terraform/3n_aws_c5n/variables.tf b/fdio.infra.terraform/3n_aws_c5n/variables.tf index c5c74f6d13..0d11014744 100644 --- a/fdio.infra.terraform/3n_aws_c5n/variables.tf +++ b/fdio.infra.terraform/3n_aws_c5n/variables.tf @@ -18,6 +18,12 @@ variable "ami_image" { default = "ami-0a875db8a031a9efb" } +variable "instance_initiated_shutdown_behavior" { + description = "Shutdown behavior for the instance" + type = string + default = "terminate" +} + variable "instance_type" { description = "AWS instance type" type = string |