-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathapp.py
61 lines (49 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
#!/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 (
AuroraMysqlServerlessV2ClusterStack,
BastionHostEC2InstanceStack,
ECSNlbFargateServiceStack,
ECSClusterStack,
ECSTaskStack,
VpcStack
)
AWS_ENV = cdk.Environment(
account=os.environ["CDK_DEFAULT_ACCOUNT"],
region=os.environ["CDK_DEFAULT_REGION"]
)
app = cdk.App()
vpc_stack = VpcStack(app, "ECSNlbFargateServiceVpcStack",
env=AWS_ENV)
rds_stack = AuroraMysqlServerlessV2ClusterStack(app, "AuroraMySQLServerlessV2Stack",
vpc_stack.vpc,
env=AWS_ENV
)
rds_stack.add_dependency(vpc_stack)
bastion_host = BastionHostEC2InstanceStack(app, "BastionHostStack",
vpc_stack.vpc,
rds_stack.sg_mysql_client,
env=AWS_ENV
)
bastion_host.add_dependency(rds_stack)
ecs_cluster_stack = ECSClusterStack(app, "ECSClusterStack",
vpc_stack.vpc,
env=AWS_ENV
)
ecs_cluster_stack.add_dependency(bastion_host)
ecs_task_stack = ECSTaskStack(app, "ECSTaskStack",
rds_stack.database_secret,
env=AWS_ENV
)
ecs_task_stack.add_dependency(ecs_cluster_stack)
ecs_fargate_stack = ECSNlbFargateServiceStack(app, "ECSNlbFargateServiceStack",
vpc_stack.vpc,
ecs_cluster_stack.ecs_cluster,
ecs_task_stack.ecs_task_definition,
env=AWS_ENV
)
ecs_fargate_stack.add_dependency(ecs_task_stack)
app.synth()