티스토리 뷰

반응형

다음은 aws_elb 타입의 리소스인 "My_LB"의 설정이다.

resource "aws_elb" "My_LB" {
  name = "My-Public-LB"
//  availability_zones = ["ap-northeast-2a"]
  security_groups = [aws_security_group.my_lb_sg.id]
  subnets = [aws_subnet.my_subnet.id]

  listener {
    instance_port = 12345
    instance_protocol = "HTTP"
    lb_port = 80
    lb_protocol = "HTTP"
  }
  listener {
    instance_port = 12345
    instance_protocol = "HTTP"
    lb_port = 8080
    lb_protocol = "HTTP"
  }

  health_check {
    healthy_threshold = 2
    interval = 30
    target = "HTTP:12345/"
    timeout = 3
    unhealthy_threshold = 2
  }

  instances = [aws_instance.my-server.id]
  cross_zone_load_balancing = false
  connection_draining = false
}
  • terraform의 elb는 vpc를 명시할 수 없다.
  • availability_zones만 작성한 경우, default vpc의 해당 az에 생성된다.
  • subnets만 작성한 경우, 해당 서브넷이 위치한 vpc에 생성된다.
  • listner들의 lb_port는 겹칠 수 없다. instance_port는 당연히 겹칠 수 있음!
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함