skip to Main Content

I’m using the AWS CDK, and currently I have parameters that I want to be able to change in a sort of configuration file. I can’t use the –parameters argument from the command line because A) I need to use the parameter values in the actual code (mainly in function calls/if statements) and B) There are enough parameters that it would be annoying to type every single one into the command line.

Is there some type of way I can just define a JSON or YAML file that the user can edit, and then use those values directly in the cdk_stack.py file?

2

Answers


  1. This question doesn’t exactly need an answer. However, you can create a .json file and then simply add a key named "params" and the value as a list or whatever you want to name it. There, the user can enter the parameter names, then using the open() function and the json module you can read the file using python.

    Login or Signup to reply.
  2. AWS CDK Context is recommended way to do that:

    https://docs.aws.amazon.com/cdk/v2/guide/context.html

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search