...
The goal of this tutorial is to add the environment variables and publish the function version. We will also add secured variables, and to encrypt these variables we are going to use the AWS KMS key. We will have a project property added in the deploy workflow and this project property value will contain the list of the environment variables that we are going to use in the workflow input. We can use the dynamic value in both the environment file and input argument, please refer to this document to get more details about environment variables' acceptable structure: AWS Lambda Environment Variables Accepted Structure. These are the general steps we’ll follow:
...
This is the example of environment file with json structure, please refer the document to get more details about environment variables' acceptable structure.
...
Pre-requisite
Configure IAM User
...
Below given is a sample build workflow to copy the file from Git repository.
...
Step-i: Clone Git Repository
This step will clone the Git repository codebase into the project execution working directory. The Git URL will be retrieved from Source Control configured under Project Configuration.
...
Step-ii: Copy the environment file
The below step will copy the environment file to the artifacts directory. Make sure to check the Produces Artifact option to save the files as artifact so that can be used from Deploy workflow.
...
Below given is a sample deploy workflow to add the environment variable to the AWS Lambda function.
...
Step-i: add environment variables
This step will add environment variables to the Lambda Function and publish the version.
...