Skip to content

spotinst/terraform-spotinst-ocean-aws-ecs

Repository files navigation

Spot Ocean ECS Terraform Module

Prerequisites

  • Have an ECS cluster
  • Spot Account and API Token defined in the Spotinst Terraform Provider

Usage

module "ocean_ecs" {
  source = "spotinst/ocean-aws-ecs/spotinst"

  cluster_name                    = "ECS-Workshop"
  region                          = "us-west-2"
  subnet_ids                      = ["subnet-123456789,subnet-123456789"]
  security_group_ids              = ["sg-123456789"]
  image_id                        = "ami-123456789"
  iam_instance_profile            = "arn:aws:iam::123456789:instance-profile/ecsInstanceRole"
  availability_vs_cost            = "costOriented"

  tags = {CreatedBy = "terraform"}
}

Providers

Name Version
spotinst >= 1.78.0

Modules

  • ecs-ocean - Creates Ocean Cluster
  • ecs-ocean-launchspec - (Optional) Add custom virtual node groups Doc

Inputs

Name Description Type Default Required
cluster_name Add a name for the Ocean cluster. string null yes
availability_vs_cost (Optional, Default: balanced) You can control the approach that Ocean takes while launching nodes by configuring this value. Possible values: costOriented,balanced,cheapest. string balanced no
region The region the cluster is located string n/a yes
max_size The upper limit of worker nodes the Ocean cluster can scale up to number 1000 no
min_size The lower limit of worker nodes the Ocean cluster can scale down to number 0 no
desired_capacity The number of instances to launch and maintain in the cluster.
number null no
subnet_ids A comma-separated list of subnet identifiers for the Ocean cluster. Subnet identifiers should be configured with auto-assign public IP. list(string) n/a yes
whitelist Instance types allowed in the Ocean cluster. Cannot be configured if a deny list is configured. list(string) null no
user_data The base 64 encoded MIME user data to make available to the instances. string null no
image_id identifier of the image used to launch the instances. string n/a yes
security_groups_ids One or more security group identifiers. list(string) n/a yes
iam_instance_profile The instance profile iamRole. string null no
associate_public_ip_address (Optional, Default: false) Configure public IP address allocation. bool false no
utilize_reserved_instances If there are any vacant Reserved Instances, launch On-Demand to consume them bool true no
draining_timeout 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. number 120 no
monitoring Enable detailed monitoring for cluster. Flag will enable Cloud Watch detailed monitoring (one minute increments). Note: there are additional hourly costs for this service based on the region used. bool false no
spot_percentage The percentage of Spot instances number null no
utilize_commitments If savings plans commitment has available capacity, Ocean will utilize them alongside RIs (if exist) to maximize cost efficiency. bool false no
http_tokens Determines if a signed token is required or not. Valid values: optional or required. string "optional" no

Documentation

If you're new to Spot and want to get started, please checkout our Getting Started guide, available on the Spot Documentation website.

Getting Help

We use GitHub issues for tracking bugs and feature requests. Please use these community resources for getting help:

Community

Contributing

Please see the contribution guidelines.

License

Code is licensed under the Apache License 2.0.