Skip to content

Instantly share code, notes, and snippets.

@abhiyerra
Last active September 28, 2016 03:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhiyerra/4e4f6b50ab0fac1f48884c8c6bad2411 to your computer and use it in GitHub Desktop.
Save abhiyerra/4e4f6b50ab0fac1f48884c8c6bad2411 to your computer and use it in GitHub Desktop.
parkingspot-terraform-spot-instance
variable "spot_price" {
type = "string"
}
variable "instance_type" {
type = "string"
}
variable "region" {
type = "string"
}
resource "aws_spot_instance_request" "cheap_worker" {
ami = "ami-1234"
spot_price = "${var.spot_price}"
instance_type = "${var.instance_type}"
region = "${var.region}"
tags {
Name = "CheapWorker"
}
}
eval $(parkingspot -region us-west-2 -cpu 6)
export TF_VAR_region=${PARKINGSPOT_REGION}
export TF_VAR_spot_price=${PARKINGSPOT_BID}
export TF_VAR_instance_type=${PARKINGSPOT_INSTANCE_TYPE}
terraform apply
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment