How do I update Lambda environment variables without hardcoding a new function version into my application?
I want to update my AWS Lambda function's environment variables without changing the Lambda Qualified Amazon Resource Name (Lambda Version ARN) in my client-side application. How do I avoid hardcoding a specific Lambda function version into my application each time I update my function's environment variables?
"I want to update my AWS Lambda function's environment variables without changing the Lambda Qualified Amazon Resource Name (Lambda Version ARN) in my client-side application. How do I avoid hardcoding a specific Lambda function version into my application each time I update my function's environment variables?Short descriptionYou can't change the environment variables or function code in a published Lambda function version. You can change only the current, unpublished function version ($LATEST). To avoid hardcoding a specific Lambda function version into your application, you can configure a Lambda alias ARN into your application instead. Each Lambda alias has a unique ARN and can be reconfigured once created to point to new versions of your function.ResolutionNote: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you’re using the most recent AWS CLI version.Update the environment variables in your unpublished Lambda function versionTo use the Lambda consoleFollow the instructions in Using AWS Lambda environment variables.To use the update-function-configuration AWS CLI commandFollow the instructions in update-function-configuration (AWS CLI command reference).To use the Lambda API calls in the AWS SDKsFollow the instructions in Configuring environment variables with the API.Publish a new Lambda function version that includes the updated environment variablesFollow the instructions in Creating function versions.Create a new Lambda function alias (or use an existing alias) to point to your updated function version and configure it into your applicationNote: Lambda aliases can point only to a function version, not to another alias.To create a new function aliasFollow the instructions in Creating a function alias (Console). Then, point the alias to your updated function version by following the instructions in Alias routing configuration.To use an existing function aliasFollow the instructions in Alias routing configuration.Important: Make sure that you configure the Lambda alias's ARN into your client-side application, not the ARN of your new function version.Invoke your updated function version manuallyFollow the instructions in the Invoke the Lambda function section of Create a Lambda function with the console.Your Lambda function alias now points to the latest function version that's configured with the environment variables that you want to use.Follow"