awsdocs / aws-cdk-guide

User guide for the AWS Cloud Development Kit (CDK).
Other
335 stars 222 forks source link

How to handle different env approach #273

Open StErMi opened 4 years ago

StErMi commented 4 years ago

Hi everyone, I'm new to CDK but I already love it!

I come from serverless-framework so maybe it's just a problem to dig more or learn which is the correct best practice with CDK. I need to specify different env variables to be used inside my CDK App/Stacks based on which is the stage I want to deploy.

How do you usually handle it in CDK?

For example, I would like to load a specific config (to be used inside my custom construct) based on stage I (or the CI/CD) deploying to. For different stages, I'm going to use a different AWS region and different variable values.

So my question is:

1) how do you usually specify to which stage are you deploying to? 2) how do you define/load env variables based on the stage you have specified?

ghost commented 4 years ago

@StErMi Thanks for the suggestion. Keep in mind this isn't a support forum; it's a place to request content to be added to the Developer Guide. If you need a quicker response to your question, I suggest a community forum like Stack Overflow, cdk.dev, Gitter, or the like. We'll leave your suggestion here as a content request, but can't guarantee we'll get to it in any particular timeframe.