#Set Lambda Env Var from CI/CD

2 messages · Page 1 of 1 (latest)

shrewd dune
#

Hello,

How can I add values to an environment variable in a Lambda Function, from CI/CD?

I have multiple environments, but when I try to display in a new one (where the Lambda is not yet created), it throws the following error:

2023-03-04T00:48:23.760Z [INFO]: 🛑 The following resources failed to deploy:
                                 Resource Name: functiontestinglLambda1 (AWS::CloudFormation::Stack)
                                 Event Type: create
                                 Reason: Parameters: [variableUno] must have values

Edit: find an answer in documentation
:

https://docs.amplify.aws/cli/function/env-vars/#multi-environment-flows

Is not possible to add env value programmatically, I need to push backend from local first

white burrow
#

You could use the pre-push hook. You would need to read the cloudformation-template.json of the lambda, add your ENV varaible to it and then write it back with fs.writeFile()