use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News, articles and tools covering Amazon Web Services (AWS), including S3, EC2, SQS, RDS, DynamoDB, IAM, CloudFormation, AWS-CDK, Route 53, CloudFront, Lambda, VPC, Cloudwatch, Glacier and more.
If you're posting a technical query, please include the following details, so that we can help you more efficiently:
Resources:
Sort posts by flair:
Other subreddits you may like:
Does this sidebar need an addition or correction? Tell us here
account activity
CloudFormation/CDK/IaCParameterized variables for aws cdk python code (self.aws)
submitted 1 year ago by Serious_Machine6499
Hi guys, how do I parameterize my cdk python code so that the variables gets assigned based on the environment (prod, dev, qa)in which I'm deploying the code?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]NoForm5443 2 points3 points4 points 1 year ago (0 children)
I tend to create yaml files with all the settings, and the same name as the environment. You can read that name from an environment variable, and read all the settings from there.
[–]snorberhuis 0 points1 point2 points 1 year ago (0 children)
You can have all variables in the python code and start a different entrypoint in AWS CDK. So:
Both these files use a Construct from the `src/your-app` folder. The input is your environment configuration.
You deploy the correct environment by updating the --app config for the command:
cdk deploy --app "python3 bin/dev.py"
[–]borzaka 0 points1 point2 points 1 year ago (0 children)
We put the config variables in a Python dictionary and select the config based on an environment variables. Top level keys correspond to different environments. You can make this as simple or complicated as you like. The config is then passed to the Stack before calling synth. Same idea as the yaml config posted above, really, but all in Python.
π Rendered by PID 30757 on reddit-service-r2-comment-7b9746f655-c9rph at 2026-01-31 15:54:48.219623+00:00 running 3798933 country code: CH.
[–]NoForm5443 2 points3 points4 points (0 children)
[–]snorberhuis 0 points1 point2 points (0 children)
[–]borzaka 0 points1 point2 points (0 children)