Elastigroup
This post demonstrates how to create an Elastigroup using the Spotinst Terraform V2 plugin.
This post assumes that you already have a Spotinst account and went through Spotinst Terraform Installation.Creating an Elastigroup
#Importing an Existing Elastigroup
Example Usage – Creating an Elastigroup resource – Basic Example
// --- CREATE AN ELASTIGROUP --------------------- provider "spotinst" { token = "7df2e7df2e42344860de001de7df2e4961860dw001de4961860de001de" account = "act-e4f5td40" } resource "spotinst_elastigroup_aws" "spot-elastigroup-tf-provider-v2" { name = "Terraform-V2-Elastigroup-01" description = "created by Terraform" product = "Linux/UNIX" availability_zones = ["us-west-2b", "us-west-2c"] // --- CAPACITY --------------------------------- max_size = 0 min_size = 0 desired_capacity = 0 capacity_unit = "weight" // --- LAUNCH CONFIGURATION --------------------- image_id = "ami-a21f6y83" iam_instance_profile = "iam-profile" key_name = "my-key.ssh" security_groups = ["sg-188ae33"] user_data = "echo hello world" // RAW enable_monitoring = false ebs_optimized = false placement_tenancy = "default" // --- INSTANCE TYPES ---------------------------- instance_types_ondemand = "m3.2xlarge" instance_types_spot = ["m3.xlarge", "m3.2xlarge"] instance_types_weights = [ { instance_type = "c3.large" weight = 10 }, { instance_type = "c4.xlarge" weight = 16 }] // --- STRATEGY -------------------------------- orientation = "balanced" fallback_to_ondemand = false }Importing an Existing Elastigroup
You can easily import an existing Elastigroup via the following command:
terraform import spotinst_elastigroup_aws.name-of-resource-in-terraform sig-12345Note: This will only import the state to the machine’s memory, and you will have to create the configuration by yourself, as configuration creation is not yet supported in TF. Please see: https://www.terraform.io/docs/import/
Parameters
name
– (Required; String) The group name.
description
– (Required; String) The group description.
product
– (Required; String) Operation system type. Supported Arguments: Linux/UNIX
, SUSE Linux
, Windows
. If you are using VPC in EC2 Classic regions: Linux/UNIX (Amazon VPC)
, SUSE Linux (Amazon VPC)
, Windows (Amazon VPC)
.
availability_zones
– (Optional; Array) List of Strings of availability zones.
Note: When this parameter is set, subnet_ids
should be left unused.
availability_zones = ["us-east-1a", "us-east-1b", "us-east-1c"]
subnet_ids
– (Optional; Array) List of Strings of subnet identifiers.
Note: When this parameter is set, availability_zones
should be left unused.
subnet_ids = ["subnet-4c1d1538", "subnet-2791bb61", "subnet-703a6f58"]
region
– The AWS region your group will be created in.
Note: This parameter is required if you specify subnets (through subnet_ids). This parameter is optional if you specify Availability Zones (through availability_zones).
name = "terraform" description = "terraform" product = "Linux/UNIX"
desired_capacity
– (Required; String) The desired number of instances the group should have at any time.
capacity_unit
– (Optional; String) The capacity unit to launch instances by. if not specified, when choosing the weight unit, each instance will weigh as the number of its vCPUs.
Available options are `instance` and `weight`
security_groups
– (Optional; String) A list of associated security group IDS.
min_size
– (Optional; Required if using scaling policies; Integer) The minimum number of instances the group should have at any time.
max_size
– (Optional; Required if using scaling policies; Integer) The maximum number of instances the group should have at any time.
instance_type_weights
– (Optional) List of weights per instance type for weighted groups. Each object in the list should have the following attributes:
instance_type
– (Required; String) The instance type you would like to assign the weight value.weight
– (Required; Integer) the assigned weight for the instance.
instance_type_weights = [ { instance_type = "c3.large" weight = 10 }, { instance_type = "c4.xlarge" weight = 16 }, ]
orientation
– (Required; String) Select a prediction strategy. Supported Arguments: costOriented | availabilityOriented | balanced | equalAzDistribution
draining_timeout
– (Optional; Integer) The time in seconds, the instance is allowed to run while detached from the ELB. This is to allow the instance time to be drained from incoming TCP connections before terminating it, during a scale down operation.
spot_percentage
– (Optional; Required if not using ondemand_count
) The percentage of Spot instances that would spin up from the desired_capacity
number.
ondemand_count
– (Optional; Required if not usingspot_percentage
) Number of on-demand instances to launch in the group. All other instances will be spot instances. When this parameter is set thespot_percentage
parameter is being ignored.
utilize_reserved_instances
– (Optional; Boolean) In a case of any available reserved instances, Elastigroup will utilize them first before purchasing Spot instances
fallback_to_ondemand
– (Optional; Boolean) In a case of no Spot instances available, Elastigroup will launch on-demand instances instead.
revert_to_spot
– (Optional) Hold settings for strategy correction – replacing On-Demand for Spot instances.
Supported Arguments: never | always | timeWindow
perform_at
– (Required; String) In the event of a fallback to On-Demand instances, select the time period to revert back to Spot. Supported Arguments – always (default), timeWindow, never. For timeWindow or never to be valid the group must have availabilityOriented OR persistence defined.time_windows
– (Required when performAt: ‘timeWindow’): Specify a list of time windows for to execute revertToSpot strategy. Time window format: ddd:hh:mm-ddd:hh:mm. Example: Mon:03:00-Wed:02:30
Please note that for
revert_to_spot
select only one option:revert_to_spot { perform_at = "never" }revert_to_spot { perform_at = "always" }revert_to_spot { perform_at = "timeWindow", time_windows = ["Mon:12:00-Tue:12:00", "Fri:12:00-Sat:12:00"] }Instance Types
instance_types_ondemand
-(Required, String) The type of instance determines your instance’s CPU capacity, memory and storage (e.g., m1.small, c1.xlarge).
instance_types_spot
– (Required, String) One or more instance types.instance_types { ondemand = "c3.large" spot = ["c3.large", "m4.xlarge"] }
image_id
– (Required, String) The ID of the AMI used to launch the instance.image_id = "ami-f0091d91"Private IP pool
private_ips
– (Optional, Integer) List of Private IPs to associate to the group instances.(e.g. “172.1.1.0”). Please note: This setting will only apply if persistence.persist_private_ip is set to true.private_ips = ["1.2.3.4", "99.88.77.66"]Launch Specification
launch_specification
– (Required) Describes the launch specification for an instance.
enable_monitoring
– (Optional) Indicates whether monitoring is enabled for the instance.
key_name
– (Optional) The key name that should be used for the instance.
health_check_type
– (Optional) The service that will perform health checks for the instance. Supported Arguments : ELB | HCS | TARGET_GROUP | CUSTOM | K8S_NODE
health_check_grace_period
– (Optional) The amount of time, in seconds, after the instance has launched to starts and check its health
health_check_unhealthy_duration_before_replacement
– (Optional) The amount of time, in seconds, that we will wait before replacing an instance that is running and became unhealthy (this is only applicable for instances that were once healthy)
user_data
– (Optional) The user data to provide when launching the instance.
ebs_optimized
– (Optional, Boolean) Enable high bandwidth connectivity between instances and AWS’s Elastic Block Store (EBS). For instance types that are EBS-optimized by default this parameter will be ignored.
placement_tenancy
– (Optional, Boolean) Enable dedicated tenancy. Note: There is a flat hourly fee for each region in which dedicated tenancy is used.
iam_instance_profile
– (Optional) The ARN of an IAM instance profile to associate with launched instances.monitoring = false key_name = "east" security_group_ids = ["default", "sg-123"] user_data = "#!/bin/sh echo hello" shutdown_script = "#!/bin/sh echo hello" iam_instance_profile = "admin" }Load Balancers
AWS Load Balancers:
elastic_load_balancers
– (Optional) Registers each instance with the specified Elastic Load Balancers (ELB).
target_group_arns
– (Optional; String) List of Target Group ARNs to register the instances to.Multai Load Balancer:
multai_target_sets
– (Optional) – TBD
balancer_id
– (Required) – Your Multai balancer IDtarget_set_id
– (Required) – Your Multai target set IDelastic_load_balancers = ["elb-name-01", "elb-name-02"] target_group_arns = ["target-arn-01", "target-arn-02"] multai_target_sets = [{ target_set_id = "ts-01", balancer_id = "mlb-bal-01" }, { target_set_id = "ts-02", balancer_id = "mlb-bal-02" }]Tags
tags
– (Optional) A mapping of tags to assign to the resource.tags = [{ foo = "bar" bar = "baz" }, { key = "explicit2" value = explicit1" } ]Elastic IPs
elastic_ips
– (Optional) A list of AWS Elastic IP allocation IDs to associate to the group instances.
elastic_load_balancers
– (Optional) Registers each instance with the specified Elastic Load Balancers (ELB).elastic_ips = ["eipalloc-01","eipalloc-02"]Stateful
We support instance persistence via the following configurations. all values are Boolean.
For more information on instance persistence please see: Stateful configuration
persist_root_device
– (Optional, Boolean) should the instance maintain its root device volumes.
persist_block_devices
– (Optional, Boolean) should the instance maintain its Data volumes
block_device_mode
– (Optional, String) determine the way we attach the data volumes to the data devices. Required whenpersist_block_devices
is set. Supported Arguments: ‘reattach’ and ‘onLaunch’ (default is onLaunch)
persist_private_ip
– (Optional, Boolean) should the instance maintain its private IPpersist_root_device = true persist_block_devices = true block_devices_mode = "reattach" persist_private_ip = true
Stateful DeallocationThe deallocation configuration applied on elastigroup deletion.
should_delete_images
– (Optional) For stateful groups: remove persistent images.
should_delete_network_interfaces
– (Optional) For stateful groups: remove network interfaces.
should_delete_volumes
– (Optional) For stateful groups: remove persistent volumes.
should_delete_snapshots
– (Optional) For stateful groups: remove snapshots.stateful_deallocation = { should_delete_images = true should_delete_network_interfaces = true should_delete_volumes = true should_delete_snapshots = true }
health_check_type
– (Optional) The service that will perform health checks for the instance. Supported Arguments:"ELB"
,"HCS"
,"TARGET_GROUP"
,"CUSTOM"
,"K8S_NODE"
,"MLB"
,"EC2"
,"MULTAI_TARGET_SET"
,"MLB_RUNTIME"
,"K8S_NODE"
,"NOMAD_NODE"
,"ECS_CLUSTER_INSTANCE"
.health_check_grace_period
– (Optional) The amount of time, in seconds, after the instance has launched to starts and check its healthhealth_check_unhealthy_duration_before_replacement
– (Optional) The amount of time, in seconds, that we will wait before replacing an instance that is running and became unhealthy (this is only applicable for instances that were once healthy)health_check_type = "ELB" health_check_grace_period = 300Block Devices
Each of the
*_block_device
attributes controls a portion of the AWS Instance’s “Block Device Mapping”. It’s a good idea to familiarize yourself with AWS’s Block Device Mapping docs to understand the implications of using these attributes.1. Each
ebs_block_device
supports the following:
device_name
– (Required). The name of the device to mount.
snapshot_id
– (Optional) The Snapshot ID to mount.
volume_type
– (Optional) The type of volume. Can be"standard"
,"gp2"
, or"io1"
.
volume_size
– (Optional) The size of the volume in gigabytes.
iops
– (Optional) The amount of provisioned IOPS. This must be set with avolume_type
of"io1"
.
delete_on_termination
– (Optional) Whether the volume should be destroyed on instance termination.
encrypted
– (Optional) Enables EBS encryption on the volume.
kms_key_id
– (Optional) ID for a user managed CMK under which the EBS Volume is encrypted.//optional data "aws_ami" "amazon_linux" { most_recent = true name_regex = "amzn-ami-hvm-.*-gp2" owners = ["amazon"] } //optionalebs_block_device { device_name = “${data.aws_ami.amazon_linux.root_device_name}” volume_type = ‘gp2’ volume_size = 80 delete_on_termination = true }
ebs_block_device { device_name = “/dev/xvdb” snapshot_id = ‘snap-12345678’ volume_type = ‘io1’ volume_size = 80 iops = 100 delete_on_termination = true encrypted = true }Modifying any
ebs_block_device
currently resource replacement.Using the default AMi is optional, any AMI can be used.
2. Each
ephemeral_block_device
supports the following:
device_name
– The name of the block device to mount on the instance.
virtual_name
– The Instance Store Device Name(e.g."ephemeral0"
).ephemeral_block_device { device_name = "/dev/xvdc" virtual_name = "ephemeral0" }Currently, changes to
*_block_device
configuration of existing resources cannot be automatically detected by Terraform. After making updates to block device configuration, resource recreation can be manually triggered by using thetaint
command.Network Interfaces
Each of the
network_interface
attributes controls a portion of the AWS Instance’s “Elastic Network Interfaces”. It’s a good idea to familiarize yourself witsh AWS’s Elastic Network Interfaces docs to understand the implications of using these attributes.Please note: if you wish for instances to have a specific Private IP you should use Private IP pools along with Stateful configuration.
network_interface_id
– (Optional) The ID of the network interface.device_index
– (Required) The index of the device on the instance for the network interface attachment.description
– (Required) The description of the network interface.private_ip_address
– (Optional) The private IP address of the network interface.delete_on_termination
– (Optional) If set to true, the interface is deleted when the instance is terminated.secondary_private_ip_address_count
– (Optional) The number of secondary private IP addresses.associate_public_ip_address
– (Optional) Indicates whether to assign a public IP address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one.network_interface { network_interface_id = "bar" device_index = 0 subnet_id = "foo" description = "foo" private_ip_address = "172.0.0.1" security_group_ids = ["sg-foo"] delete_on_termination = false secondary_private_ip_address_count = 1 associate_public_ip_address = false }Scheduled Tasks
Each
scheduled_task
supports the following:
task_type
– (Required) The task type to run.Supported Arguments:
scale
,backup_ami
,roll
,scaleUp
,percentageScaleUp
,scaleDown
,percentageScaleDown
,statefulUpdateCapacity
.
is_enabled
– (optional) setting the task to being enabled or disabled. Supported Arguments : true | false
start_time
– (Format: ISO 8601) – (Optional) Set a start time for one time tasks.
cron_expression
– (Optional; Required if not usingfrequency
) A valid cron expression. The cron is running in UTC time zone and is in Unix cron format.
frequency
– (Optional; Required if not usingcron_expression
) The recurrence frequency to run this task. Supported Arguments arehourly
,daily
,weekly
andcontinuous
.
scale_target_capacity
– (Optional) The desired number of instances the group should have.
scale_min_capacity
– (Optional) The minimum number of instances the group should have.
scale_max_capacity
– (Optional) The maximum number of instances the group should have.
target_capacity
– (Optional – only valid for statefulUpdateCapacity) The desired number of instances the group should have.
min_capacity
– (Optional – only valid for statefulUpdateCapacity) The minimum number of instances the group should have.
max_capacity
– (Optional – only valid for statefulUpdateCapacity) The maximum number of instances the group should have.scheduled_task { task_type = "scale" cron_expression = "0 5 * * 0-4" scale_target_capacity = 2 scale_min_capacity = 0 scale_max_capacity = 10 } scheduled_task { task_type = "scale" start_time = "2018-05-18T02:00:00Z" scale_target_capacity = 0 } scheduled_task { task_type = "statefulUpdateCapacity" cron_expression = "0 20 * * 0-4" target_capacity = 0 } scheduled_task { task_type = "backup_ami" is_enabled = true frequency = "hourly" }Scaling Policies
Each
scaling_*_policy
supports the following:Replace ‘*’ with “up” or “down”
policy_name
– (Required) The name of the policy
namespace
– (Required) The namespace for the alarm’s associated metric. Default value is AWS/EC2
statistic
– (Optional) The metric statistics to return. For information about specific statistics go to Statistics in the Amazon CloudWatch Developer Guide. Supported Arguments: average | sum | sampleCount | maximum | minimum
metric_name
– (Required) The name of the metric. Default value is CPUUtilization
cooldown
– (Optional, Default:300
) The amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start. If this parameter is not specified, the default cooldown period for the group applies.
dimensions
– (Optional) A mapping of dimensions describing qualities of the metric.
operator
– (Optional, Scale Up Default:gte
, Scale Down Default:lte
)The operator to use in order to determine if the scaling policy is applicable. Supported Arguments:
gt, gte, lt, lte
source
– (Optional) The source of the metric. Supported Arguments: cloudWatch, spectrum
threshold
– (Required) The value against which the specified statistic is compared.
statistic
– (Optional, Default:"average"
) The metric statistics to return. For information about specific statistics go to Statistics in the Amazon CloudWatch Developer Guide.
unit
– (Optional) The unit for the alarm’s associated metric. Supported Arguments: seconds | microseconds | milliseconds | bytes | kilobytes | megabytes | gigabytes | terabytes | bits | kilobits | megabits | gigabits | terabits | percent | count | bytes/second | kilobytes/second | megabytes/second | gigabytes/second | terabytes/second | bits/second | kilobits/second | megabits/second | gigabits/second | terabits/second | count/second | none
evaluation_periods
– (Optional) The number of periods over which data is compared to the specified threshold.
period
– (Optional,Default:300
) The granularity, in seconds, of the returned data points. The period must be at least 60 seconds and must be a multiplication of 60 (120, 180, 240 etc…).
action_type
– (Optional; if not usingmin_target_capacity
ormax_target_capacity
) The type of action to perform for scaling. Supported Arguments:"adjustment"
,"percentageAdjustment"
,"setMaxTarget"
,"setMinTarget"
,"updateCapacity"
.If you do not specify an action type, you can only use –
adjustment
,minTargetCapacity
,maxTargetCapacity
. While using action_type, please also set the following:When using
adjustment
– set the fieldadjustment
When usingpercentageAdjustment
– set the fieldadjustment
When usingsetMaxTarget
– set the fieldmax_target_capacity
When usingsetMinTarget
– set the fieldmin_target_capacity
When usingupdateCapacity
– set the fieldsminimum
,maximum
, andtarget
adjustment
– (Optional; if not usingmin_target_capacity
ormax_target_capacity
) The number of instances to add/remove to/from the target capacity when scale is needed. Can be used as advanced expression for scaling of instances to add/remove to/from the target capacity when scale is needed. You can see more information here: Advanced expression. Example value:"MAX(currCapacity / 5, value * 10)"
min_target_capacity
– (Optional; if not usingadjustment
; available only for scale up). The number of the desired target (and minimum) capacitymax_target_capacity
– (Optional; if not usingadjustment
; available only for scale down). The number of the desired target (and maximum) capacityminimum
– (Optional; if usingupdateCapacity
) The minimal number of instances to have in the group.maximum
– (Optional; if usingupdateCapacity
) The maximal number of instances to have in the group.target
– (Optional; if usingupdateCapacity
) The target number of instances to have in the group.
scaling_up_policy { policy_name = "Scaling Policy 1" namespace = "AWS/EC2" statistic = "average" metric_name = "CPUUtilization" operator = "gte" threshold = 80 unit = "percent" evaluation_periods = 2 period = 300 adjustment = 1 min_target_capacity = 30 max_target_capacity = 13 cooldown = 300 dimensions }Target Scaling
policy_name
– (Optional) The name of the policy
namespace
– (Required) The namespace for the alarm’s associated metric. Value supported is AWS/EC2
metric_name
– (Required) The name of the metric. Default value is CPUUtilization, Other Supported Arguments: NetworkIn, NetworkOut
statistic
– (Optional) The metric statistics to return. Supported Arguments: average sum sampleCount maximum minimum
unit
– (Optional) The unit for the alarm’s associated metric. Supported Arguments: seconds microseconds milliseconds bytes kilobytes megabytes gigabytes terabytes bits kilobits megabits gigabits terabits percent count bytes/second kilobytes/second megabytes/second gigabytes/second terabytes/second bits/second kilobits/second megabits/second gigabits/second terabits/second count/second none
target
– (Optional) The target value for the group
cooldown
– (Optional) The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can startscaling_target_policy { policy_name = "Test Scaling target Policy" namespace = "AWS/EC2" metric_name = "CPUUtilization" statistic = "average" unit = "percent" target = 50 cooldown = 300 }Signals (Optional)
Each
signal
supports the following:
name
– (Required) – The name of the signal defined for the group. Supported Arguments: INSTANCE_READY,INSTANCE_READY_TO_SHUTDOWN.
timeout
– (Optional) – The signals defined timeout- default is 40 minutes (1800 seconds)signal { name = "INSTANCE_READY" timeout = 900 }Third-Party Integrations
Rancher Integration
integration_rancher
– (Optional) Describes the Rancher integration.
master_host
– (Required) The URL of the Rancher Master host.access_key
– (Required) The access key of the Rancher API.secret_key
– (Required) The secret key of the Rancher API.integration_rancher { master_host = "localhost" access_key = "foo" secret_key = "bar" }Beanstalk Integration
integration_elastic_beanstalk
– (Optional) Describes the [Elastic Beanstalk (https://aws.amazon.com/documentation/elastic-beanstalk/) integration definitions.
environment_id
– (Required) The ID of the Elastic Beanstalk environment.integration_elastic_beanstalk { environment_id = "e-hc8mvnayrx" }Kubernetes Integration
integration_kubernetes
– (Optional). Describes the Kubernetes integration definitions.token
– (Optional). Kubernetes Tokenautoscale_is_enabled
– (Boolean) – (Optional). Enabling the k8s auto-scaler functionality. For more information please see: Kubernetes auto scalerautoscale_is_auto_config
– (Boolean) – (Optional). Enabling the automatic k8s auto-scaler functionality. For more information please see: Kubernetes auto scaler .autoscale_cooldown
– How long should the scaling should wait after the last scale action before initiating addition scaling actionautoscale_headroom
– (Optional). An option to set compute reserve for the clustercpu_per_unit
– (Optional). How much CPU to allocate for headroom unitmemory_per_unit
– (Optional). How much Memory allocate for headroom unitnum_of_units
– (Optional). How many units to allocate for headroom unitautoscale_down
– (Optional). Setting for scale down actionsevaluation_periods
– (Optional). How many evaluation periods should accumulate before a scale down action takes placeintegration_kubernetes
{ api_server = “https://master.addr” token = “secret” autoscale_is_enabled = true autoscale_cooldown = 300 autoscale_headroom { cpu_per_unit = 10 memory_per_unit = 10 num_of_units = 10 } autoscale_down { evaluation_periods = 5 } }EC2 Container Service (ECS)
integration_ecs
– (Optional). Describes the EC2 Container Service integration definitions.cluster_name
– (Required). EC2 Container Service cluster nameautoscale_is_enabled
– (Optional). EC2 Container autoscaling stateautoscale_cooldown
– (Optional). Cooldown period between scaling actionsautoscale_is_auto_config
– (Optional, Default: `false`) Enabling the automatic auto-scaler functionality. For more information please see: ECS Autocaler.autoscale_headroom
– (Optional). headroom for the clustercpu_per_unit
– (Optional). Cpu units for computememory_per_unit
– (Optional). RAM units for computenum_of_unit
– (Optional). Amount of units for computeautoscale_down
– (Optional). Enabling scale downevaluation_periods
– (optional). Amount of cooldown evaluation periods for scale downintegration_ec2_container_service
{ cluster_name = “foo” autoscale_is_enabled = true autoscale_cooldown = 300 autoscale_headroom { cpu_per_unit = 8 memory_per_unit = 8 num_of_units = 10 } autoscale_down{ evaluation_periods = 2} }Code Deploy
integration_codedeploy
– (Optional). Describes the Code Deploy integration definitions.cleanup_on_failure
– (Optional). Cleanup automatically after a failed deploy.terminate_instance_on_failure
– (Optional). Terminate the instance automatically after a failed deploy.deployment_groups
– (Optional). Specify the deployment groups detailsapplication_name
– (Optional). The application namedeployment_group_name
– (Optional). The deployment group name.integration_codedeploy
{ cleanup_on_failure = true terminate_instance_on_failure = true deployment_groups = [ { application_name = “foo” deployment_group_name = “bar” }, { application_name = “alice” deployment_group_name = “bob” }, ] }Nomad Integration
integration_nomad
– (Optional). Describes the Nomad integration definitions.api_server
– (Optional). URL for Nomad API Serveracl_token
– (Optional). Nomad ACL Tokenautoscale_is_enabled
– (Optional). Enabling the k8s auto-scaler functionality. for more information please see: Nomad auto-scalerautoscale_cooldown
– How long should the scaling wait after the last scale action before initiating addition scaling actionautoscale_headroom
– (Optional). An option to set compute reserve for the clustercpu_per_unit
– (Optional). How much CPU (MHz) to allocate for headroom unitmemory_per_unit
– (Optional). How much Memory allocate for headroom unitnum_of_units
– (Optional). How many units of headroom to allocateautoscale_down
– (Optional). Settings for scale down actionsevaluation_periods
– (Optional). How many evaluation periods should accumulate before a scale down action takes placeautoscale_constraints
– (Optional). Constraints that apply to the Nomad Clients.integration_nomad
{ master_host = “https://master.addr” master_port = 4646 acl_token = “someTokenHere” autoscale_is_enabled = true autoscale_cooldown = 300 autoscale_headroom { cpu_per_unit = 1000 memory_per_unit = 2000 num_of_units = 1 } autoscale_down { evaluation_periods = 5 } autoscale_constraints = [ { key = “attr.kernel.name” value = “linux” } ] }Docker Swarm
integration_docker_swarm
– (Optional) Describes the Docker Swarm integration.master_host
– (Required) IP or FQDN of one of your swarm managers.master_port
– (Required) Network port used by your swarm.autoscale_is_enabled
– (Optional, Default: `false`) Specifies whether the auto scaling feature is enabled.autoscale_cooldown
– (Optional, Default: `300`) The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start. Minimum 180, must be a multiple of 60.autoscale_headroom
– (Optional) An option to set compute reserve for the cluster.cpu_per_unit
– (Optional, Default: `0`) How much CPU to allocate for headroom unit.memory_per_unit
– (Optional, Default: `0`) The amount of memory in each headroom unit. Measured in MiB.num_of_units
– (Optional, Default: `0`) How many units to allocate for headroom unit.autoscale_down
– (Optional) Setting for scale down actions.evaluation_periods
– (Optional, Default: `5`) Number of periods over which data is compared. Minimum 3, Measured in consecutive minutes.Usage:
hcl integration_docker_swarm = { master_host = "10.10.10.10" master_port = 2376 autoscale_is_enabled = true autoscale_cooldown = 180 autoscale_headroom = { cpu_per_unit = 2048 memory_per_unit = 2048 num_of_units = 1 } autoscale_down = { evaluation_periods = 3 } }
Update Policy (Optional)
should_resume_stateful
– (Optional) Boolean, this will apply resuming action for Stateful instances in the Elastigroup upon scale up or capacity changes. Example usage will be for Elastigroups that will have schedualing rules to set a target capacity of 0 instances in the night and automatically restore the same state of the isntnaces in the morning.
should_roll
– (Required; Boolean) – sets the enablement of the roll option
roll_config
– (Optional) While used, you can control whether the group should perform a deployment after an update to the configuration
batch_size_percentage
– (Required; integer) – Sets the percentage of the instances to deploy in each batchgrace_period
– (Optional; integer) – Sets the grace period for new instances to become healthyhealth_check_type
– (Optional; String) – Sets the health check type to use.
Supported Arguments: EC2 | K8S_NODE | ECS_CLUSTER_INSTANCE | ELB | HCS | MLB | MLB_RUNTIME | TARGET_GROUP | MULTAI_TARGET_SET | NOMAD_NODEupdate_policy = { should_resume_stateful = false should_roll = true roll_config = { batch_size_percentage = 33 grace_period = 300 health_check_type = "" } }