How to get the graph plugin to generate a graph? #646
-
I have a Python CDK project I installed the cdk graph lib and plugin:
I added it to my app.py: from typing import cast
import aws_cdk as cdk
from aws_prototyping_sdk.cdk_graph import CdkGraph, ICdkGraphPlugin
from aws_prototyping_sdk.cdk_graph_plugin_diagram import (
CdkGraphDiagramPlugin,
DiagramFormat,
)
app = cdk.App()
# ...added stack here as usual ...
graph_plugin = CdkGraphDiagramPlugin(
diagrams=[
{
"name": "cdk_graph_diagram",
"title": "AWS stack",
"format": DiagramFormat.PNG,
}
]
)
graph = CdkGraph(app, plugins=[cast(ICdkGraphPlugin, graph_plugin)])
if __name__ == "__main__":
app.synth()
graph.report() I have done a Then from the cli I run I get no errors, but also no graph is output. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Oh, it does work! the output files go to it'd be nice if you could specify a different output path and lose the prefix |
Beta Was this translation helpful? Give feedback.
-
one odd thing is it seems to have hallucinated connections to my S3 bucket that don't really exist at first I thought maybe this was just unfortunate arrow positioning but I checked in the .dot file that's also generated and no, these are explicit edges between "AssetsBucket" S3 bucket and the "Bastion" (a but they don't have any relation to the S3 bucket in my stack code, either intentional or unintentional AFAICT |
Beta Was this translation helpful? Give feedback.
Oh, it does work!
the output files go to
cdk.out/cdkgraph/diagram.<the name you specified>.png
it'd be nice if you could specify a different output path and lose the prefix