-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
48 lines (34 loc) · 1.57 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
#!/usr/bin/env python3
import os
import json
from aws_cdk import App
from cdk_stack_project.cdk_stack_project_stack import CdkStackProjectStack
app = App()
# Reading context variables:
asset_model_name = app.node.try_get_context("assetModelName")
asset_properties = app.node.try_get_context("assetProperties")
assets = app.node.try_get_context("assets")
# Ensure context variables are parsed correctly
if isinstance(asset_properties, str):
asset_properties = json.loads(asset_properties)
if isinstance(assets, str):
assets = json.loads(assets)
print("Asset Model Name:", asset_model_name)
print("Asset Properties:", asset_properties)
print("Assets:", assets)
CdkStackProjectStack(app, "CdkStackProjectStack",
asset_model_name,
asset_properties,
assets
# If you don't specify 'env', this stack will be environment-agnostic.
# Account/Region-dependent features and context lookups will not work,
# but a single synthesized template can be deployed anywhere.
# Uncomment the next line to specialize this stack for the AWS Account
# and Region that are implied by the current CLI configuration.
#env=cdk.Environment(account=os.getenv('CDK_DEFAULT_ACCOUNT'), region=os.getenv('CDK_DEFAULT_REGION')),
# Uncomment the next line if you know exactly what Account and Region you
# want to deploy the stack to. */
#env=cdk.Environment(account='123456789012', region='us-east-1'),
# For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html
)
app.synth()