-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.py
41 lines (31 loc) · 1.19 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
# This is the entry point for the CDK app
# It loads the configuration from config.yml and creates the FashionAgentStack
import os
from pathlib import Path
import aws_cdk as cdk
from cdk_nag import AwsSolutionsChecks, NagSuppressions
import yaml
from components.stacks.fashion_agent_stack import FashionAgentStack
# Load the configuration from config.yml
with open(os.path.join(Path(__file__).parent, "config.yml"), "r") as ymlfile:
stack_config = yaml.load(ymlfile, Loader=yaml.loader.SafeLoader)
current_file_path = Path(__file__).resolve()
# Create the CDK app and environment
app = cdk.App()
env = cdk.Environment(
account=os.getenv("CDK_DEFAULT_ACCOUNT"), region=os.getenv("CDK_DEFAULT_REGION")
)
# Create the FashionAgentStack with the loaded configuration
stack = FashionAgentStack(
scope=app, stack_name=stack_config["stack_name"], config=stack_config, env=env
)
NagSuppressions.add_stack_suppressions(
stack,
[
{"id": "AwsSolutions-IAM5", "reason": "Need the wildcard for CloudWatch logs so the stack can create several streams"},
],
True,
)
cdk.Aspects.of(app).add(AwsSolutionsChecks())
# Synthesize the AWS CloudFormation template for the stack
app.synth()