AWMS lambda create-function only accepts one environment variable

I am trying to use environment variables for my lambda, but when I run the following command to create an AWS CLI Lambda function from a gradle task that launches a wrapper script,

aws $PROFILESTR lambda create-function \
--region us-east-1 \
--function-name MyLambda \
--zip-file fileb://$ZIP \
--role arn:aws:iam::$AWS_ACCT_ID:role/my_lambda \
--handler com.test.MyLambda::handleRequest \
--runtime java8 \
--description "Lambda description..." \
--memory-size 256 \
--timeout 45 \
--environment Variables={DEV_URL=dev,PROD_URL=prod}

      

it gives me this message and does not create lambda function

:my-lambda:createLambda
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

Unknown options: Variables=PROD_URL=prod
:my-lambda:createLambda FAILED

      

If I remove the second variable (declare only one env variable) it creates the function fine.

From the lambda create-function cli documentation, the environment parameter accepts several variables:

- environment (structure)

The parent object containing the configuration of your environment Settings. Abbreviated syntax:

Variables = {section_name_1 = string, KeyName2 = string}

I have to create the lambda through a script, not through the AWS console (the release should be automatic).

What am I missing here or what am I doing wrong?

+3


source to share


1 answer


You should try Variables="{KeyName1=string,KeyName2=string}"



+5


source







All Articles