-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathapp.py
63 lines (50 loc) · 1.35 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
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab
import os
import aws_cdk as cdk
from cdk_stacks import (
VpcStack,
KafkaClientEC2InstanceStack,
MSKProvisionedStack,
MSKClusterPolicyStack,
S3Stack,
KinesisFirehoseStack
)
AWS_ENV = cdk.Environment(
account=os.environ["CDK_DEFAULT_ACCOUNT"],
region=os.environ["CDK_DEFAULT_REGION"]
)
app = cdk.App()
vpc_stack = VpcStack(app, 'MSKVpcStack',
env=AWS_ENV)
msk_stack = MSKProvisionedStack(app, "MSKProvisionedStack",
vpc_stack.vpc,
env=AWS_ENV
)
msk_stack.add_dependency(vpc_stack)
msk_policy_stack = MSKClusterPolicyStack(app, "MSKClusterPolicyForFirehose",
vpc_stack.vpc,
msk_stack.msk_cluster_name,
env=AWS_ENV
)
msk_policy_stack.add_dependency(msk_stack)
kafka_client_ec2_stack = KafkaClientEC2InstanceStack(app, "MSKClientEC2InstanceStack",
vpc_stack.vpc,
msk_stack.sg_msk_client,
msk_stack.msk_cluster_name,
env=AWS_ENV
)
kafka_client_ec2_stack.add_dependency(msk_policy_stack)
s3_stack = S3Stack(app, "MSKtoS3AsFirehoseDestinationStack",
env=AWS_ENV
)
s3_stack.add_dependency(kafka_client_ec2_stack)
firehose_stack = KinesisFirehoseStack(app, "FirehosefromMSKtoS3Stack",
msk_stack.msk_cluster_name,
msk_stack.msk_cluster_arn,
s3_stack.s3_bucket,
env=AWS_ENV
)
firehose_stack.add_dependency(s3_stack)
app.synth()