Reputation: 16821
I know I can specify environment variables when I'm creating a lambda function like this:
var params = {
Code: { /* required */
ZipFile: new Buffer('...')
},
FunctionName: 'STRING_VALUE', /* required */
Environment: {
Variables: {
'<EnvironmentVariableName>': 'STRING_VALUE',
}
},
};
lambda.createFunction(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
But how can I set/update environment variables for a lambda function that already exists? I don't see any parameter for updateFunctionCode!
Upvotes: 1
Views: 5603
Reputation: 2350
After you've changed the environment variable in the console, you can run
aws lambda update-function-configuration --function-name <YOUR_LAMBDA_NAME> --memory-size <YOUR_LABMDA_MEMORY_LIMIT_DEFAULT_128MB>
I don't see the option to execute this command from AWS Console, which is pretty odd.
Upvotes: 0
Reputation: 16275
There's a separate API call for updating the lambda runtime config, including the environment.
https://docs.aws.amazon.com/lambda/latest/dg/API_UpdateFunctionConfiguration.html
It also updates the timeout, memory, dead letter queue, etc.
Upvotes: 2