-
I was wondering what the recommended way is to deal with environment variables here is. Some of my environment variables include:
Do I create a subproject, something like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hey! It usually depends a bit on the use case :) For database DSNs and access tokens I'd do the same of injecting via lambda environment variables in CDK :) Note that for anything secret it's usually best to use secrets manager and pass the secret arn as an environment variable instead of the plaintext value, then retrieve the secret with the AWS SDK in the lambda function itself :) For an API url - if you want to pass that to say a website you can make use of the Hope that helps! :) |
Beta Was this translation helpful? Give feedback.
Hey! It usually depends a bit on the use case :)
For database DSNs and access tokens I'd do the same of injecting via lambda environment variables in CDK :) Note that for anything secret it's usually best to use secrets manager and pass the secret arn as an environment variable instead of the plaintext value, then retrieve the secret with the AWS SDK in the lambda function itself :)
For an API url - if you want to pass that to say a website you can make use of the
runtimeOptions
in theStaticWebsite
CDK construct, which lets you pass the value from CDK down to the website when it first loads :)Hope that helps! :)