-
Notifications
You must be signed in to change notification settings - Fork 19
/
app.py
109 lines (98 loc) · 2.43 KB
/
app.py
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/env python3
# import modules
import os
from aws_cdk import core
# import cdk classes
from vpc.vpc_stack import VpcStack
from kafka.kafka_stack import KafkaStack
from elastic.elastic_stack import ElasticStack
from logstash.logstash_stack import LogstashStack
from filebeat.filebeat_stack import FilebeatStack
from athena.athena_stack import AthenaStack
from kibana.kibana_stack import KibanaStack
app = core.App()
# Vpc stack
vpc_stack = VpcStack(
app,
"elkk-vpc",
env=core.Environment(
account=os.environ["CDK_DEFAULT_ACCOUNT"],
region=os.environ["CDK_DEFAULT_REGION"],
),
)
# Kafka stack
kafka_stack = KafkaStack(
app,
"elkk-kafka",
vpc_stack,
client=True,
env=core.Environment(
account=os.environ["CDK_DEFAULT_ACCOUNT"],
region=os.environ["CDK_DEFAULT_REGION"],
),
)
kafka_stack.add_dependency(vpc_stack)
# Filebeat stack (Filebeat on EC2)
filebeat_stack = FilebeatStack(
app,
"elkk-filebeat",
vpc_stack,
kafka_stack,
env=core.Environment(
account=os.environ["CDK_DEFAULT_ACCOUNT"],
region=os.environ["CDK_DEFAULT_REGION"],
),
)
filebeat_stack.add_dependency(kafka_stack)
# Elastic stack
elastic_stack = ElasticStack(
app,
"elkk-elastic",
vpc_stack,
client=True,
env=core.Environment(
account=os.environ["CDK_DEFAULT_ACCOUNT"],
region=os.environ["CDK_DEFAULT_REGION"],
),
)
elastic_stack.add_dependency(vpc_stack)
# Kibana stack
kibana_stack = KibanaStack(
app,
"elkk-kibana",
vpc_stack,
elastic_stack,
update_lambda_zip=False,
env=core.Environment(
account=os.environ["CDK_DEFAULT_ACCOUNT"],
region=os.environ["CDK_DEFAULT_REGION"],
),
)
kibana_stack.add_dependency(elastic_stack)
# Athena stack
athena_stack = AthenaStack(
app,
"elkk-athena",
env=core.Environment(
account=os.environ["CDK_DEFAULT_ACCOUNT"],
region=os.environ["CDK_DEFAULT_REGION"],
),
)
athena_stack.add_dependency(vpc_stack)
# Logstash stack
logstash_stack = LogstashStack(
app,
"elkk-logstash",
vpc_stack,
logstash_ec2=False,
logstash_fargate=True,
env=core.Environment(
account=os.environ["CDK_DEFAULT_ACCOUNT"],
region=os.environ["CDK_DEFAULT_REGION"],
),
)
logstash_stack.add_dependency(kafka_stack)
logstash_stack.add_dependency(elastic_stack)
logstash_stack.add_dependency(athena_stack)
# synth the app
app.synth()