...
The goal of the tutorial is to add the environment variables, using the environment file present at the git repository and input argument, and also 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 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 the document to get more details about environment variables' acceptable structure.
configuration of the properties e.g. Cloud account, and CLI path.
cloning the environment file from a Git repository.
adding the environment variables to the Lamba function.
sample code to retrieve the value of secured environment variables.
Checklist
Checklist | Description |
AWS Access Key | AWS Access Key of the user. |
AWS Secret Key | Password for the Access Key |
AWS Default Region | Default region can be set. eg. ap-south-1 |
AWS CLI installation | AWS CLI needs to be installed where the plugin operation shall run (FlexDeploy server) |
AWS CLI in class path | AWS CLI should be added to the class path on the FlexDeploy Server. Else the path can also be set under FlexDeploy environment level property |
AWS Lambda Function | AWS Lambda Function should be already present. |
AWS KMS Key | AWS KMS key to secured the environment variable. |
Configure Cloud Account
To connect with AWS Lambda Function, we required to configure Cloud account, with credentials details. Configure AWS Cloud Account under Integration. FlexDeploy will connect to the Lambda Function and add the environment variables.
...
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
...
In above configuration using following Inputs.
Input Name | Input Code | Type | Required | Description |
Additional Arguments | FDAWS_LAMBDA_INP_ADD_ENV_VAR_ADDITIONAL_ARG | String | No | Literal key and value pairs. e.g. --region=us-east-1 --memory-size=512 --timeout=33 And for boolean type arguments give the option without any value. e.g --publish --debug |
Environment Variables | FDAWS_LAMBDA_INP_ENV_VAR | String | No | Environment Variables in acceptable format. |
Publish new version | FDAWS_LAMBDA_INP_PUBLISH_VERSION | Boolean | No | Select to publish a new version. Default value is false. |
Project Configuration
Navigate to the Project tab and create a Project with a logical name(AWS-Lambda-Environment-Variable in this case)
...
Select Topology from the menu and then select Targets. Select the target group and environment, provide the properties detail, according to the description.
Properties | Mandatory field | Description |
Cloud Account | Optional | Select the Cloud Account to connect the Lambda Function. |
CLI Path | Optional | Directory where Cloud CLI is installed. |
AWS Region | Optional | Value of the AWS Region. |
Below given are the environment-specific values which need to be updated.
...