Getting empty context when using Python CDK library explicitly without CDK CLI

0

Hello,

In the documentation about Runtime Context it's clearly stated how the context is getting populated from the various sources, however it's unclear how this context is getting populated when I use a Python CDK library explicitly without the CDK CLI. It seems in this case the context is not following what was described in the documentation, that's why I am getting an empty context after tryGetContext calls (for example even ~/.cdk.json is ignored). Having this caveat in mind I'd like to understand what options I have to be able to enrich the context without the CDK CLI helpers? Is there a way to distinguish between a state when my code runs as a sub-process of the CDK CLI and I can rely lets say on existing cdk.json context, or as a standalone application and in this case I have to load it myself in the code?

  • I was able to identify only these three options:

    • to supply the context via CDK_CONTEXT_JSON env. variable (context data might be huge to accommodate everything into one env. variable)
    • to supply the context file location via CONTEXT_OVERFLOW_LOCATION_ENV (has recently been introduced and backported)
    • to supply key-value parameters by calling setContext method
sliva
質問済み 1年前58ビュー
回答なし

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ