-
Notifications
You must be signed in to change notification settings - Fork 4
/
app.py
44 lines (33 loc) · 1019 Bytes
/
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
#!/usr/bin/env python3
from aws_cdk import core
from infrastructure.ecs_stack import Fargate
import os
import json
# Load config
project_dir = os.path.dirname(os.path.abspath(__file__))
config_file = os.path.join(project_dir, "config.json")
with open(config_file) as json_file:
config = json.load(json_file)
print(config)
image_name = config["image-name"]
stack_id = config["stack-id"]
ecr_repository_name = config["ecr-repository-name"]
cpu = config["cpu"]
memory_limit_mib = config["memory-limit-mib"]
timeout_minutes = config["timeout-minutes"]
default_environment_vars = config["environment-variables"]
app = core.App()
Fargate(
app,
stack_id,
image_name=image_name,
environment_vars=default_environment_vars,
ecr_repository_name=ecr_repository_name,
cpu=cpu,
memory_limit_mib=memory_limit_mib,
timeout_minutes=timeout_minutes,
env=core.Environment(
account=os.environ["CDK_DEFAULT_ACCOUNT"],
region=os.environ["CDK_DEFAULT_REGION"])
)
app.synth()