github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/providers/spotinst/r/aws_group.html.markdown (about) 1 --- 2 layout: "spotinst" 3 page_title: "Spotinst: aws_group" 4 sidebar_current: "docs-do-resource-aws_group" 5 description: |- 6 Provides a Spotinst AWS group resource. 7 --- 8 9 # spotinst_aws_group 10 11 Provides a Spotinst AWS group resource. 12 13 ## Example Usage 14 15 ```hcl 16 # Create an AWS group 17 resource "spotinst_aws_group" "workers" { 18 name = "workers-group" 19 description = "created by Terraform" 20 product = "Linux/UNIX" 21 22 capacity { 23 target = 50 24 minimum = 25 25 maximum = 100 26 } 27 28 strategy { 29 risk = 100 30 } 31 32 scheduled_task { 33 task_type = "scale" 34 cron_expression = "0 5 * * 0-4" 35 scale_target_capacity = 80 36 } 37 38 scheduled_task { 39 task_type = "backup_ami" 40 frequency = "hourly" 41 } 42 43 instance_types { 44 ondemand = "c3.large" 45 spot = ["m3.large", "m4.large", "c3.large", "c4.large"] 46 } 47 48 availability_zone { 49 name = "us-west-2b" 50 subnet_id = "subnet-7bbbf51e" 51 } 52 53 launch_specification { 54 monitoring = false 55 image_id = "ami-f0091d91" 56 key_pair = "pemfile" 57 security_group_ids = ["default", "allow-ssh"] 58 } 59 60 tags { 61 foo = "bar" 62 bar = "baz" 63 } 64 65 scaling_up_policy { 66 policy_name = "Scaling Policy 1" 67 metric_name = "CPUUtilization" 68 statistic = "average" 69 unit = "percent" 70 threshold = 80 71 adjustment = 1 72 namespace = "AWS/EC2" 73 period = 300 74 evaluation_periods = 2 75 cooldown = 300 76 } 77 78 scaling_down_policy { 79 policy_name = "Scaling Policy 2" 80 metric_name = "CPUUtilization" 81 statistic = "average" 82 unit = "percent" 83 threshold = 40 84 adjustment = 1 85 namespace = "AWS/EC2" 86 period = 300 87 evaluation_periods = 2 88 cooldown = 300 89 } 90 ``` 91 92 ## Argument Reference 93 94 The following arguments are supported: 95 96 * `name` - (Optional) The group description. 97 * `description` - (Optional) The group description. 98 * `product` - (Required) Operation system type. 99 * `capacity` - (Required) The group capacity. Only a single block is allowed. 100 101 * `target` - (Required) The desired number of instances the group should have at any time. 102 * `minimum` - (Optional; Required if using scaling policies) The minimum number of instances the group should have at any time. 103 * `maximum` - (Optional; Required if using scaling policies) The maximum number of instances the group should have at any time. 104 105 * `strategy` - (Required) This determines how your group request is fulfilled from the possible On-Demand and Spot pools selected for launch. Only a single block is allowed. 106 107 * `risk` - (Optional; Required if not using `ondemand_count`) The percentage of Spot instances that would spin up from the `capcity.target` number. 108 * `ondemand_count` - (Optional; Required if not using `risk`) Number of on demand instances to launch in the group. All other instances will be spot instances. When this parameter is set the "risk" parameter is being ignored. 109 * `availability_vs_cost` - (Optional) The percentage of Spot instances that would spin up from the `capcity.target` number. 110 * `draining_timeout` - (Optional) 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. 111 112 * `instance_types` - The type of instance determines your instance's CPU capacity, memory and storage (e.g., m1.small, c1.xlarge). 113 114 * `ondemand` - (Required) The base instance type. 115 * `spot` - (Required) One or more instance types. 116 117 * `launch_specification` - (Required) Describes the launch specification for an instance. 118 119 * `image_id` - (Required) The ID of the AMI used to launch the instance. 120 * `key_pair` - (Optional) The key name that should be used for the instance. 121 * `security_group_ids` - (Optional) A list of associated security group IDS. 122 * `monitoring` - (Optional) Indicates whether monitoring is enabled for the instance. 123 * `user_data` - (Optional) The user data to provide when launching the instance. 124 * `iam_instance_profile` - (Optional) The ARN of an IAM instance profile to associate with launched instances. 125 * `load_balancer_names` - (Optional) Registers each instance with the specified Elastic Load Balancers. 126 127 * `tags` - (Optional) A mapping of tags to assign to the resource. 128 * `elastic_ips` - (Optional) A list of [AWS Elastic IP](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) allocation IDs to associate to the group instances. 129 130 131 <a id="availability-zone"></a> 132 ## Availability Zone 133 134 Each `availability_zone` supports the following: 135 136 * `name` - The name of the availability zone. 137 * `subnet_id` - (Optional) A specific subnet ID within the given availability zone. If not specified, the default subnet will be used. 138 139 140 <a id="scheduled-task"></a> 141 ## Scheduled Tasks 142 143 Each `scheduled_task` supports the following: 144 145 * `task_type` - (Required) The task type to run. Supported task types are `scale` and `backup_ami`. 146 * `cron_expression` - (Optional; Required if not using `frequency`) A valid cron expression. The cron is running in UTC time zone and is in [Unix cron format](https://en.wikipedia.org/wiki/Cron). 147 * `frequency` - (Optional; Required if not using `cron_expression`) The recurrence frequency to run this task. Supported values are `hourly`, `daily` and `weekly`. 148 * `scale_target_capcity` - (Optional) The desired number of instances the group should have. 149 * `scale_min_capcity` - (Optional) The minimum number of instances the group should have. 150 * `scale_max_capcity` - (Optional) The maximum number of instances the group should have. 151 152 153 <a id="scaling-policy"></a> 154 ## Scaling Policies 155 156 Each `scaling_*_policy` supports the following: 157 158 * `namespace` - (Required) The namespace for the alarm's associated metric. 159 * `metric_name` - (Required) The name of the metric, with or without spaces. 160 * `threshold` - (Required) The value against which the specified statistic is compared. 161 * `policy_name` - (Optional) The name of the policy. 162 * `statistic` - (Optional) The metric statistics to return. For information about specific statistics go to [Statistics](http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/index.html?CHAP_TerminologyandKeyConcepts.html#Statistic) in the Amazon CloudWatch Developer Guide. 163 * `unit` - (Optional) The unit for the alarm's associated metric. 164 * `adjustment` - (Optional) The number of instances to add/remove to/from the target capacity when scale is needed. 165 * `period` - (Optional) The granularity, in seconds, of the returned datapoints. Period must be at least 60 seconds and must be a multiple of 60. 166 * `evaluation_periods` - (Optional) The number of periods over which data is compared to the specified threshold. 167 * `cooldown` - (Optional) 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. 168 * `dimensions` - (Optional) A mapping of dimensions describing qualities of the metric. 169 170 171 <a id="network-interface"></a> 172 ## Network Interfaces 173 174 Each of the `network_interface` attributes controls a portion of the AWS 175 Instance's "Elastic Network Interfaces". It's a good idea to familiarize yourself with [AWS's Elastic Network 176 Interfaces docs](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html) 177 to understand the implications of using these attributes. 178 179 * `network_interface_id` - (Optional) The ID of the network interface. 180 * `device_index` - (Optional) The index of the device on the instance for the network interface attachment. 181 * `subnet_id` - (Optional) The ID of the subnet associated with the network string. 182 * `description` - (Optional) The description of the network interface. 183 * `private_ip_address` - (Optional) The private IP address of the network interface. 184 * `security_group_ids` - (Optional) The IDs of the security groups for the network interface. 185 * `delete_on_termination` - (Optional) If set to true, the interface is deleted when the instance is terminated. 186 * `secondary_private_ip_address_count` - (Optional) The number of secondary private IP addresses. 187 * `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. 188 189 190 <a id="block-devices"></a> 191 ## Block Devices 192 193 Each of the `*_block_device` attributes controls a portion of the AWS 194 Instance's "Block Device Mapping". It's a good idea to familiarize yourself with [AWS's Block Device 195 Mapping docs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html) 196 to understand the implications of using these attributes. 197 198 Each `ebs_block_device` supports the following: 199 200 * `device_name` - The name of the device to mount. 201 * `snapshot_id` - (Optional) The Snapshot ID to mount. 202 * `volume_type` - (Optional) The type of volume. Can be `"standard"`, `"gp2"`, or `"io1"`. 203 * `volume_size` - (Optional) The size of the volume in gigabytes. 204 * `iops` - (Optional) The amount of provisioned 205 [IOPS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-io-characteristics.html). 206 This must be set with a `volume_type` of `"io1"`. 207 * `delete_on_termination` - (Optional) Whether the volume should be destroyed on instance termination. 208 * `encrypted` - (Optional) Enables [EBS encryption](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) on the volume. 209 210 Modifying any `ebs_block_device` currently requires resource replacement. 211 212 Each `ephemeral_block_device` supports the following: 213 214 * `device_name` - The name of the block device to mount on the instance. 215 * `virtual_name` - The [Instance Store Device Name](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html#InstanceStoreDeviceNames) 216 (e.g. `"ephemeral0"`). 217 218 ~> **NOTE:** Currently, changes to `*_block_device` configuration of _existing_ 219 resources cannot be automatically detected by Terraform. After making updates 220 to block device configuration, resource recreation can be manually triggered by 221 using the [`taint` command](/docs/commands/taint.html). 222 223 224 <a id="third-party-integrations"></a> 225 ## Third-Party Integrations 226 227 * `rancher_integration` - (Optional) Describes the [Rancher](http://rancherlabs.com/) integration. 228 229 * `master_host` - (Required) The URL of the Rancher Master host. 230 * `access_key` - (Required) The access key of the Rancher API. 231 * `secret_key` - (Required) The secret key of the Rancher API. 232 233 * `elastic_beanstalk_integration` - (Optional) Describes the [Elastic Beanstalk](https://aws.amazon.com/documentation/elastic-beanstalk/) integration. 234 235 * `environment_id` - (Required) The ID of the Elastic Beanstalk environment. 236 237 * `nirmata_integration` - (Optional) Describes the [Nirmata](http://nirmata.io/) integration. 238 239 * `api_key` - (Required) The API key of the Nirmata API. 240 241 ## Attributes Reference 242 243 The following attributes are exported: 244 245 * `id` - The group ID.