github.com/tetrafolium/tflint@v0.8.0/tflint/test-fixtures/v0.11.0_module/.terraform/modules/75f06b5c36dd1be566ec9e32e6aca4b5/README.md (about) 1 # Amazon ECS on Spot Fleet Terraform module 2 3 [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE) 4 5 A terraform module for create ECS on Spot Fleet. This is a demo repository. 6 The outline is as following: 7 8 * Bid on Spot Fleet and launch instances that spans two AZs. 9 * Started instances constitute an ECS cluster. 10 * Invoked containers support dynamic port mapping by ALB. 11 12 ## Quick Start 13 14 By using the bundled ruby script, you can try ECS on Spot Fleet fastest. 15 16 ``` 17 $ git clone https://github.com/wata727/tf_aws_ecs_on_spotfleet.git 18 $ cd tf_aws_ecs_on_spotfleet/cli 19 $ bundle install 20 $ ruby wizard.rb generate 21 create template.tf 22 $ terraform init 23 $ terraform apply 24 ``` 25 26 This script generates Terraform template. By default, it requests the cheapest spot price with the two subnets in default VPC on `us-east-1`. Also, if you do not have a key pair in us-east-1, it will automatically generate `demo-app.pem`. Since AWS credentials are required for this operation, please use environment variables or shared credentials. 27 28 If you want to delete this cluster, please run the following: 29 30 ``` 31 $ terraform destroy 32 ``` 33 34 ## Module Input Variables 35 36 **Required** 37 38 * `vpc` - VPC id for ECS cluster 39 * `subnets` - List of subnet ids for ECS cluster, please choose 2 subnets 40 * `key_name` - Name of key pair for SSH login to ECS cluster instances 41 42 **Optional** 43 44 * `ami` - ECS cluster instance AMI id, default is Amazon ECS-optimized AMI in `us-east-1` 45 * `app_name` - Your application name, default is `demo-app` 46 * `image` - Your docker image name, default it ECS PHP Simple App 47 * `container_port` - Port number exposed by container, default is 80 48 * `service_count` - Number of containers, default is 3 49 * `cpu_unit` - Number of cpu_units for container, default is 128 50 * `memory` - Number of memory for container, default is 128 51 * `spot_prices` - Bid amount to spot fleet, please choose 2 prices, default is `$0.03` 52 * `strategy` - Instance placement strategy name, default is `diversified` 53 * `instance_count` - Number of instances, default is 3 54 * `instance_type` - Instance type launched by Spot Fleet. default is `m3.medium` 55 * `volume_size` - Root volume size, default is 16 56 * `https` - Whether the load balancer should listen to https requests, default is `false` 57 * `app_certificate_arn` - The ARN of the ssl certificate, default is empty 58 * `app_ssl_policy` - The ssl policy, default is `ELBSecurityPolicy-2015-05` 59 * `valid_until` - limit of Spot Fleet request, default is `2020-12-15T00:00:00Z` 60 61 ## Usage 62 63 Like other modules, you can easily start ECS cluster by adding this module to your template with required parameters. 64 65 ```hcl 66 provider "aws" { 67 region = "us-east-1" 68 } 69 70 module "ecs_on_spotfleet" { 71 source = "github.com/wata727/tf_aws_ecs_on_spotfleet" 72 73 vpc = "vpc-12345" 74 subnets = ["subnet-12345", "subnet-abcde"] 75 spot_prices = ["0.03", "0.02"] 76 key_name = "demo-app" 77 } 78 79 output "endpoint" { 80 value = "${module.ecs_on_spotfleet.endpoint}" 81 } 82 ``` 83 84 ## Customize 85 86 This module is very simple, please remodel and create your own module. 87 88 ## Author 89 90 [Kazuma Watanabe](https://github.com/wata727)