-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
45 lines (32 loc) · 1.12 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
#!/usr/bin/env python3
# Built-in imports
import os
# External imports
import aws_cdk as cdk
# Own imports
from cdk.helpers.add_tags import add_tags_to_app
from cdk.stacks.cdk_bedrock_stack import BedrockStack
print("--> Deployment AWS configuration (safety first):")
print("CDK_DEFAULT_ACCOUNT", os.environ.get("CDK_DEFAULT_ACCOUNT"))
print("CDK_DEFAULT_REGION", os.environ.get("CDK_DEFAULT_REGION"))
app: cdk.App = cdk.App()
# Configurations for the deployment (obtained from env vars and CDK context)
DEPLOYMENT_ENVIRONMENT = os.environ.get("DEPLOYMENT_ENVIRONMENT", "dev")
MAIN_RESOURCES_NAME = app.node.try_get_context("main_resources_name")
stack: BedrockStack = BedrockStack(
app,
f"{MAIN_RESOURCES_NAME}-{DEPLOYMENT_ENVIRONMENT}",
MAIN_RESOURCES_NAME,
DEPLOYMENT_ENVIRONMENT,
env={
"account": os.environ.get("CDK_DEFAULT_ACCOUNT"),
"region": os.environ.get("CDK_DEFAULT_REGION"),
},
description=f"Stack for {MAIN_RESOURCES_NAME} infrastructure in {DEPLOYMENT_ENVIRONMENT} environment",
)
add_tags_to_app(
app,
MAIN_RESOURCES_NAME,
DEPLOYMENT_ENVIRONMENT,
)
app.synth()