Skip to content

Instantly share code, notes, and snippets.

@matschaffer
Created January 10, 2015 20:28
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 matschaffer/5ff02b3b22578269cf87 to your computer and use it in GitHub Desktop.
Save matschaffer/5ff02b3b22578269cf87 to your computer and use it in GitHub Desktop.
bluegreen experiment
provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "us-east-1"
}
resource "aws_elb" "experiments-main" {
name = "experiments-main"
availability_zones = ["us-east-1c", "us-east-1d"]
listener {
instance_port = 8000
instance_protocol = "http"
lb_port = 80
lb_protocol = "http"
}
health_check {
healthy_threshold = 2
unhealthy_threshold = 2
timeout = 3
target = "HTTP:8000/"
interval = 30
}
cross_zone_load_balancing = true
}
resource "aws_launch_configuration" "experiments-v000" {
name = "experiments-v000"
image_id = "ami-aa7ab6c2"
instance_type = "t1.micro"
}
resource "aws_autoscaling_group" "experiments-v000" {
availability_zones = ["us-east-1c", "us-east-1d"]
name = "experiments-v000"
min_size = 1
max_size = 1
desired_capacity = 1
health_check_grace_period = 300
health_check_type = "EC2"
force_delete = true
launch_configuration = "${aws_launch_configuration.experiments-v000.name}"
load_balancers = ["${aws_elb.experiments-main.name}"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment