-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathes-cluster-config.tf
78 lines (68 loc) · 1.62 KB
/
es-cluster-config.tf
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#Authenticate to AWS provider
provider "aws" {
access_key = "AKIAJ46----------"
secret_key = "BaFWAjBpb8+J61AO---------------------------"
region = "us-east-1"
}
#Create 3 EC2 Instances for ElasticSearch cluster nodes
resource "aws_instance" "es-node-1" {
ami = "ami-0d4cfd66"
key_name = "id_rsa"
security_groups = ["georgi-es-group"]
instance_type = "t2.micro"
tags {
Owner = "Georgi"
Environment = "Production"
}
}
resource "aws_instance" "es-node-2" {
ami = "ami-0d4cfd66"
key_name = "id_rsa"
security_groups = ["georgi-es-group"]
instance_type = "t2.micro"
tags {
Owner = "Georgi"
Environment = "Production"
}
}
resource "aws_instance" "es-node-3" {
ami = "ami-0d4cfd66"
key_name = "id_rsa"
security_groups = ["georgi-es-group"]
instance_type = "t2.micro"
tags {
Owner = "Georgi"
Environment = "Production"
}
}
# Create new load balancer for EC2 ElasticSearch Cluster
resource "aws_elb" "elasticsearch-loadbalancer" {
name = "lb-es"
availability_zones = [
"us-east-1a",
"us-east-1b",
"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/isALive.json"
interval = 30
}
instances = [
"${aws_instance.es-node-1.id}",
"${aws_instance.es-node-2.id}",
"${aws_instance.es-node-3.id}"
]
cross_zone_load_balancing = true
idle_timeout = 400
connection_draining = true
connection_draining_timeout = 400
}