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
질문됨 일 년 전58회 조회
답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠