-
Notifications
You must be signed in to change notification settings - Fork 3
/
cdk.py
101 lines (87 loc) · 2.05 KB
/
cdk.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
#!/usr/bin/env python3
"""
Main AWS CDK app
Docs: https://docs.aws.amazon.com/cdk/api/latest/python/
"""
from os import environ
from sys import stdout
### Setup environment and logging
with open("VERSION") as f:
environ["VERSION"] = f.read().rstrip()
from aws_cdk import core
from stacks.api import ApiStack
from stacks.backups_monitor import BackupsMonitorStack
from stacks.deployer import DeployerStack
from stacks.log_report import LogReportStack
from stacks.notifications import NotificationsStack
from stacks.pocket_to_kindle import PocketToKindleStack
from stacks.publish_to_social import SocialPublishStack
from stacks.whois_poller import WhoisStack
print("### api-l3x-in version ", end="")
stdout.write("\033[1;31m") # Set red, ref https://stackoverflow.com/a/37340245/2274124
print(environ["VERSION"])
stdout.write("\033[0;0m") # Unset color
### Main CDK code follows
APP = core.App()
NOTIFICATIONS_STACK = NotificationsStack(
APP,
'notifications',
tags={
'Managed': 'cdk',
'Name': 'notifications',
},
)
PUBLISH_TO_SOCIAL_STACK = SocialPublishStack(
APP,
'publish-to-social',
tags={
'Managed': 'cdk',
'Name': 'publish-to-social',
},
)
ApiStack(
APP,
'api',
lambda_notifications=NOTIFICATIONS_STACK.pushover,
social_log_group=PUBLISH_TO_SOCIAL_STACK.log_group,
tags={
'Managed': 'cdk',
'Name': 'api',
},
)
LogReportStack(
APP,
'log-report',
lambda_notifications=NOTIFICATIONS_STACK.mailjet,
tags={
'Managed': 'cdk',
'Name': 'log-report',
},
)
WhoisStack(
APP,
'whois-poller',
lambda_notifications=NOTIFICATIONS_STACK.pushover,
tags={
'Managed': 'cdk',
'Name': 'whois-poller',
},
)
DeployerStack(
APP,
'deployer',
tags={
'Managed': 'cdk',
'Name': 'deployer',
},
)
BackupsMonitorStack(
APP,
'backups-monitor',
lambda_notifications=NOTIFICATIONS_STACK.pushover,
tags={
'Managed': 'cdk',
'Name': 'backups-monitor',
},
)
APP.synth()